ya-luotao

Claude Agent SDK Swift — Development skill for Claude Code

Development community

Community Claude Agent SDK for Swift, with streaming, MCP, session stores, and tracing.

How to install Claude Agent SDK Swift

This entry records only its repository, not the path inside it, so there is no exact command to give. Open ya-luotao/claude-agent-sdk-swift and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Agent SDK Swift does

Community Claude Agent SDK for Swift, with streaming, MCP, session stores, and tracing.

Alternatives in Development

  • Root Cause Tracing — Use when errors occur deep in execution and you need to trace back to find the original trigger 102.5k ★
  • MCP Python SDK — Python SDK for building MCP servers 22.3k ★
  • Storybloq — Cross-session context for Claude Code 696 ★

README

Claude Agent SDK for Swift

A community Swift SDK for the Claude Code CLI, built with Swift 6, `async/await`, actors, and `AsyncSequence`. **macOS 13+ comes first**. The `CLITransport` interface separates the protocol from native process management to support a future Linux implementation. No third-party runtime dependencies, Python, or Ruby are required.

The protocol follows the [official Python SDK 0.2.153](https://github.com/anthropics/claude-agent-sdk-python/tree/763922b0de2c9fb5371504d73ae54cde49536fe1), with additional API capabilities from the [community Ruby SDK 0.33.1](https://github.com/ya-luotao/claude-agent-sdk-ruby/tree/7d4ec3779770adb83b32be86b5431a506b1a6ce5): one-shot and multi-turn queries, asynchronous input, permissions and hooks, MCP, session history and external storage, a CLI installer, observers, and OTLP tracing.

The implementation covers the main feature areas, with explicit semantic and platform differences documented in the [feature comparison](docs/PARITY.md). Builds, local tests, and initialization with the real CLI have passed. Live model tests did not pass because the test environment was not authenticated; see the [validation record](docs/VALIDATION.md).

Installation

Requires Swift 6, macOS 13+, and an authenticated Claude Code CLI. Add the [repository](https://github.com/ya-luotao/claude-agent-sdk-swift) to your application's `Package.swift`:

dependencies: [
    .package(url: "https://github.com/ya-luotao/claude-agent-sdk-swift.git", branch: "main"),
],
targets: [
    .executableTarget(name: "MyAgent", dependencies: [
        .product(name: "ClaudeAgentSDK", package: "claude-agent-sdk-swift"),
    ]),
]

The SDK discovers the CLI in this order: `options.cliPath`, the project's `vendor/claude`, PATH, and common user installation directories. You can explicitly install a pinned version with SHA-256 verification:

let executable = try await CLIInstaller().install(version: "2.1.278")
var options = ClaudeAg