AgenticKit: A Swift Agent Harness for Apple Platforms
I have been building AI capabilities into Matisse lately. It is a photo editor, and the feature is an assistant: you tell it to warm up a photo, lift the shadows and crop it square, and it should open the photo, make the edits and show you the result. That is not a single model call anymore. The model has to look at your library, pick a photo, read its metadata, apply adjustments one by one and check what changed. In other words, it needs an agent with real tools inside the app.
When I went looking for the layer that would run that loop, I came up empty. There are agent frameworks for Python and TypeScript in every flavor, but nothing like an agent SDK for Swift. The architecture I liked most was the Claude Agent SDK's: tools, hooks, subagents, permissions, sessions, one loop that ties them together. But there is no Swift version of it, and my apps are Swift. So I wrote the shape natively, as an independent implementation. AgenticKit is modelled after the Claude Agent SDK, but it shares no code with it and it is not tied to Claude. It speaks directly to the HTTP APIs of Anthropic, OpenAI, OpenRouter, or anything OpenAI-compatible, and the provider layer is the only place that knows a wire format.
A minimal session looks like this:
import AgenticKit
let provider = AnthropicModelProvider(apiKey: myKey)let agent = Agent(provider: provider)
let text = try await agent .query("What is the capital of France?") .text()On top of that you opt into what your app needs. Built-in tools for files, web, tasks and shell exist, but nothing gets filesystem or network access unless you ask for it. Persistent sessions checkpoint after every turn, so an app kill loses at most the in-flight turn. Subagents roll their token spend into the parent's total, which matters when you set a budget. And transient failures retry with backoff on the same model before any fallback, decided by a structured error taxonomy instead of matching provider error strings, which I can confirm are not phrased the same way twice.
Two decisions I should explain. The first is zero dependencies. AgenticKit is Foundation and a few system modules, nothing else. An agent harness sits in the middle of everything your app does, and I do not think that position belongs to somebody else's release schedule. The second is paranoia by default. Remote fetches reject private and loopback hosts, providers refuse cross-origin redirects so an API key cannot leak to a redirected host, and file tools resolve inside a sandbox. If you plan to ship an app with a model key inside the binary, please read the security notes first, because that key will not stay yours for long. A user-owned key or a small backend is the honest way.
The Matisse assistant is not public yet, but it already drives the editor through AgenticKit's tool surface: listing and opening photos, reading metadata, adjusting tone, color and crop, all landing on the same non-destructive edits you can make by hand. When it ships, AgenticKit will be the layer underneath it. I do not know if the Claude Agent SDK's shape is the right one for every app, and the package is still young enough that I expect to be wrong about parts of it. But the alternative was writing this layer privately, again, per app.
The source is on GitHub, with docs for sessions, tools, MCP servers and model providers. If you are building agents in Swift, give it a try and open an issue when something breaks.