Swift API Reference
Complete API reference for the AgentSDK Swift. A native agent execution library with typed tools, providers, and loop strategies.
Installation
Add AgentSDK to your Package.swift:
Core Classes
Agent
Runner
Providers
Provider Protocol
OpenAIProvider
ProviderFactory
Supported: "openai", "openrouter"
Tools
ToolDefinition
Built-in Tools
ReadFileTool- Read file contentsWriteFileTool- Write content to a fileEditFileTool- Exact string replacementsBashTool- Execute shell commandsWebSearchTool- Search the web via DuckDuckGo- Git tools:
GitStatusTool,GitDiffTool,GitLogTool,GitCommitTool,GitAddTool,GitPushTool,GitPullTool,GitBranchTool,GitCheckoutTool
ToolRegistry
Loop Strategies
LoopType
Built-in Strategies
ReActStrategy- General-purpose reasoning + actingPlanAndExecuteStrategy- Complex multi-step tasksParallelStrategy- Independent operationsReflexionStrategy- Quality-critical tasks