Skip the server. Ship the agent.
AgentKit is a Swift framework for building agentic apps. You describe your app's abilities once as tool domains. The model — a cloud LLM, your backend, or Apple's on-device model — decides what to do; your code decides how. Every tool runs locally, in code you write.
import AgentKit
let runtime = AgentKitRuntime()
try runtime.register(WeatherDomain())
let agent = try runtime.makeAgent(
provider: .anthropic(apiKey: key),
role: AgentRole(staticPersona: "You are a helpful weather assistant.")
)
try await agent.send("What's the weather in Tokyo?")
print(agent.currentText)
AgentSession is @Observable. Bind a SwiftUI view to it and the view
updates as text streams, tools run, and confirmations arrive — no glue code.
What you get
- One surface, any model. Swap Anthropic for OpenAI, your backend, or the on-device model by changing one line. Domains, guards, and UI never change.
- Tools run in your app. The model requests; your executor runs the call against your app state and returns the result. No server round-trip for execution, no remote code.
- Safety built in. Guards allow, confirm, or deny every tool call before it runs. Every turn's mutations group into one undo transaction. Run limits bound every turn.
- A production path. AgentKit Cloud keeps provider keys and model choices server-side — the app ships a publishable key and a short-lived user token, nothing worth stealing.
Requirements
- Swift 6.0+
- macOS 15+ / iOS 18+ / visionOS 2+
- On-device models additionally require macOS 26+ / iOS 26+ / visionOS 26+
Install
dependencies: [
.package(url: "https://github.com/AmirShayegh/agentkit.git", from: "0.1.0"),
],
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "AgentKit", package: "AgentKit"),
]),
]
One import gives you the whole surface:
import AgentKit
Where to go
- Your first agent — domain to SwiftUI in six steps.
- How a turn works — the loop, the observable state, cancellation.
- Choose a provider — direct, cloud, on-device, or your own.
- Go to production — no keys, no model names in the app.