Features

Everything the SDK
gives you.

Each feature shipped as part of the v0.1 surface — production-ready, fully typed, and documented in the GitHub README.

01 · providers

Multi-Provider Support.

Anthropic, OpenAI, Ollama, and GLM behind a single AgentOptions surface. Swap the provider — the rest of your agent code stays identical.

swift
// Anthropic
let agent = createAgent(options: AgentOptions(
    provider: .anthropic,
    apiKey: ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"]!,
    model: "claude-sonnet-4-6"
))

// OpenAI
let agent = createAgent(options: AgentOptions(
    provider: .openai,
    apiKey: "sk-...",
    model: "gpt-4o"
))

// Ollama (local)
let agent = createAgent(options: AgentOptions(
    provider: .ollama,
    baseURL: "http://localhost:11434",
    model: "llama3.1"
))

02 · streaming

Streaming & Events.

Subscribe to partial text, tool invocations, and final results as a typed AsyncStream. Drive UI updates token-by-token.

swift
for await event in agent.stream("Summarize this PDF") {
    switch event {
    case .partial(let delta):
        print(delta, terminator: "")
    case .toolUse(let call):
        print("→ \(call.name)(\(call.args))")
    case .result(let final):
        print("\n✓ \(final.text)")
    }
}

03 · tools

Custom Tools.

Declare tools with defineTool. Inputs are validated against a Codable schema, outputs are passed straight back to the model.

swift
let weather = defineTool(
    name: "get_weather",
    description: "Get current weather for a city",
    inputSchema: WeatherInput.self
) { input in
    let temp = try await fetchWeather(city: input.city)
    return ToolResult(content: "\(temp)°C in \(input.city)")
}

let agent = createAgent(options: AgentOptions(
    apiKey: "sk-...",
    model: "claude-sonnet-4-6",
    tools: [weather]
))

04 · mcp

MCP Integration.

Connect to Model Context Protocol servers over stdio or SSE. Tools and resources from the server become available to your agent automatically.

swift
let agent = createAgent(options: AgentOptions(
    apiKey: "sk-...",
    model: "claude-sonnet-4-6",
    mcpServers: [
        .stdio(
            name: "filesystem",
            command: "npx",
            args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
        ),
        .sse(
            name: "remote",
            url: URL(string: "https://example.com/mcp")!
        )
    ]
))

05 · hooks

Hook System.

Intercept tool execution with preToolUse and postToolUse hooks. Add audit logs, guards, retries, telemetry — without changing your tool code.

swift
let agent = createAgent(options: AgentOptions(
    apiKey: "sk-...",
    model: "claude-sonnet-4-6",
    hooks: AgentHooks(
        preToolUse: { call in
            log("→ \(call.name) \(call.args)")
            if call.name == "delete_file" { return .deny("not allowed") }
            return .allow
        },
        postToolUse: { call, result in
            metrics.record(tool: call.name, ms: result.duration)
        }
    )
))

06 · budget

Permission & Budget Control.

Cap tokens, cost, and step count per run. Permission policies decide which tools an agent may call. Stop runaway agents before they cost you.

swift
let result = try await agent.run(
    "Refactor this module",
    budget: RunBudget(
        maxTokens: 50_000,
        maxCostUSD: 0.50,
        maxSteps: 30
    ),
    permissions: PermissionPolicy(
        allowedTools: ["read_file", "write_file"],
        deniedTools: ["shell_exec"]
    )
)