A Swift-only LLM and Agents SDK, modelled after the OpenAI Agents SDK and built around the Responses API shape. Lightweight, no third-party LLM dependencies beyond what the providers themselves require, and intended to work with any LLM that can be coaxed into the Responses protocol.
Early. Split out from the private AgentCorp project so the public agent surface can stand on its own. APIs will move.
Providers— LLM provider clients (OpenAI Responses + Chat + Embeddings + Assistants + Realtime + Image Generation, Google Gemini, Anthropic Messages, Ollama) plus theAgent/Runner/Toolruntime built on top of them. The Tool DSL is powered by SwiftMCP;applyDiffhandles V4A-style patches. The runtime will eventually split into its ownAgentstarget; for now everything lives here.TerminalUI— ANSI colours, slash-command parser, terminal handler. Used by the bundled CLI; reusable by other tools.Coder— an in-process coding-agent CLI (executable target). Tool surface:bash,read,write,edit,ls, plusapply_patchfor models that support it. Reference implementation of anAgentagainst the Responses API.
.package(url: "https://github.com/Cocoanetics/SwiftAgents", from: "0.1.0")Then in your target:
.product(name: "Providers", package: "SwiftAgents")Tests and the bundled CLI look for these environment variables (typically loaded from a .env at the package root via swift-dotenv):
| Variable | Used by |
|---|---|
OPENAI_API_KEY |
OpenAI client + integration tests |
GEMINI_API_KEY |
Google client + integration tests |
ANTHROPIC_API_KEY |
Anthropic client + integration tests |
OLLAMA_URL |
Ollama client (defaults to 127.0.0.1:11434) |
LM_STUDIO_URL |
Optional local-OpenAI-compatible endpoint |
A .env.example is provided; copy it to .env and fill in your keys. .env is gitignored.
swift build
swift test # full suite (integration tests need keys)
swift test --filter LocalVectorStore # offline-only
swift run Coder --help # the Coder CLIThe agent runtime is a Swift port of the patterns in openai-agents-python. The Responses wire types are aligned with OpenAI's public spec; other providers (Gemini, Ollama) adapt their native shapes into that contract.
MIT — see LICENSE.