---
title: "Swift API Reference Code Agent SDK"
source: https://docs.autohand.ai/agent-sdk/swift-api
---

# 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 contents
-   `WriteFileTool` - Write content to a file
-   `EditFileTool` - Exact string replacements
-   `BashTool` - Execute shell commands
-   `WebSearchTool` - 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 + acting
-   `PlanAndExecuteStrategy` - Complex multi-step tasks
-   `ParallelStrategy` - Independent operations
-   `ReflexionStrategy` - Quality-critical tasks

### LoopOptions

## Hooks

### HookManager

### HookEvent

## Permissions

### PermissionManager

### PermissionMode

### PermissionDecision

## Types

### ToolName

### Message

### RunResult

### StreamEvent

## Errors

### AgentSDKError

## See Also

-   [Swift SDK Overview](swift.html)
-   [CLI Quick Start](../guides/cli-quick-start.html)