AgentRunKit
Swift 6 agent SDK: type-safe tools, streaming, cloud + on-device inference via MLX on Apple Silicon
What is AgentRunKit?
AgentRunKit is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to swift 6 agent sdk: type-safe tools, streaming, cloud + on-device inference via mlx on apple silicon
Swift 6 agent SDK: type-safe tools, streaming, cloud + on-device inference via MLX on Apple Silicon
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Swift 6 agent SDK: type-safe tools, streaming, cloud + on-de
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx agentrunkitConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use AgentRunKit
AgentRunKit is a Swift 6 SDK for building type-safe AI agents on Apple platforms, supporting both cloud inference (Anthropic, OpenAI, Google, Vertex) and on-device inference via MLX on Apple Silicon. It provides compile-time JSON schema validation for tool definitions, streaming via AsyncThrowingStream, sub-agent composition, context management with automatic compaction, checkpoint/resume, and multimodal input support including images, audio, video, and PDF. It is aimed at iOS and macOS developers who want to embed production-grade agentic AI directly into their Swift apps without depending on Python runtimes.
Prerequisites
- Swift 6.0 or later (Xcode 16+)
- iOS 18.0+ or macOS 15.0+ deployment target
- An API key for at least one supported provider: Anthropic, OpenAI, Google, or Vertex
- For on-device inference: Apple Silicon Mac with MLX (install via AgentRunKitMLX module)
- Swift Package Manager for dependency resolution
Add AgentRunKit to your Swift package
Open your Package.swift file and add AgentRunKit as a dependency pointing to the GitHub repository. Then add it to your target's dependency list.
// Package.swift
.package(url: "https://github.com/Tom-Ryder/AgentRunKit.git", from: "4.3.0")Add AgentRunKit to your target
In the targets section of Package.swift, add AgentRunKit (and optionally AgentRunKitMLX for on-device inference or AgentRunKitFoundationModels for Apple Foundation Models) to your target's dependencies.
.target(
name: "YourApp",
dependencies: [
"AgentRunKit",
// Optional: "AgentRunKitMLX",
// Optional: "AgentRunKitFoundationModels"
]
)Configure your provider client
Initialize a provider client with your API key. AgentRunKit supports seven providers. Set OPENAI_API_KEY (or the equivalent for your provider) in your environment or pass it directly to the client constructor.
import AgentRunKit
let client = AnthropicClient(apiKey: ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"] ?? "")Define type-safe tools
Create tools using the Tool generic type. AgentRunKit validates parameters at compile time against a Codable struct, generating JSON schemas automatically. This eliminates runtime schema errors.
struct WeatherParams: Codable {
let city: String
}
let weatherTool = try Tool<WeatherParams, String, EmptyContext>(
name: "get_weather",
description: "Get the current weather for a city"
) { params, _ in
return "72°F and sunny in \(params.city)"
}Create and run an agent
Instantiate an Agent with your client and tools, then call run() with a user message. The agent handles tool calls, streaming, and multi-turn conversations automatically.
let agent = Agent(client: client, tools: [weatherTool])
let result = try await agent.run(
userMessage: "What's the weather in San Francisco?",
context: EmptyContext()
)
print(result)Enable on-device MLX inference (optional)
For privacy-sensitive workloads on Apple Silicon, swap in the MLX client instead of a cloud provider. Add the AgentRunKitMLX module and initialize the MLX client with your local model path.
import AgentRunKitMLX
let client = MLXClient(modelPath: "/path/to/local/model")
let agent = Agent(client: client, tools: [weatherTool])AgentRunKit Examples
Client configuration
Example MCP client configuration for AgentRunKit used as an MCP server endpoint via stdio transport.
{
"mcpServers": {
"agentrunkit": {
"command": "npx",
"args": ["agentrunkit"],
"env": {
"OPENAI_API_KEY": "your-api-key-here"
}
}
}
}Prompts to try
Example agent interactions you can build with AgentRunKit in your Swift app.
- "What's the weather in Tokyo and convert it to Celsius for me?"
- "Search the web for the latest news and summarize the top 3 stories"
- "Analyze this image and describe what you see" (with multimodal input)
- "Run the data analysis pipeline and checkpoint the results so I can resume later"Troubleshooting AgentRunKit
Build errors about Swift concurrency or Sendable conformance
AgentRunKit requires Swift 6 strict concurrency. Ensure your project's Swift language version is set to 6 in Package.swift or Xcode build settings. Add @unchecked Sendable to types that you control if needed during migration.
Provider client returns 401 authentication errors
Confirm that OPENAI_API_KEY or your provider's equivalent environment variable is set correctly in the process environment where your app runs. In Xcode, set environment variables in the scheme editor under Run > Arguments > Environment Variables.
MLX inference is slow or fails to load the model
MLX on-device inference requires Apple Silicon (M1 or later). Verify you are running on an Apple Silicon Mac, not an Intel machine. Also confirm the model path is correct and the model format is compatible with the version of AgentRunKitMLX you have installed.
Frequently Asked Questions about AgentRunKit
What is AgentRunKit?
AgentRunKit is a Model Context Protocol (MCP) server that swift 6 agent sdk: type-safe tools, streaming, cloud + on-device inference via mlx on apple silicon It connects AI assistants to external tools and data sources through a standardized interface.
How do I install AgentRunKit?
Follow the installation instructions on the AgentRunKit GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with AgentRunKit?
AgentRunKit works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is AgentRunKit free to use?
Yes, AgentRunKit is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
AgentRunKit Alternatives — Similar Coding Agents Servers
Looking for alternatives to AgentRunKit? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up AgentRunKit in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use AgentRunKit?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.