AgentRunKit

v1.0.0Coding Agentsstable

Swift 6 agent SDK: type-safe tools, streaming, cloud + on-device inference via MLX on Apple Silicon

agent-sdkai-agentsanthropicapple-siliconfunction-calling
Share:
24
Stars
0
Downloads
0
Weekly
0/5

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

Swift 6 agent SDK
On-device MLX inference
Type-safe tool definitions
Tom-Ryder

Maintainer

LicenseMIT
Languageswift
Versionv1.0.0
UpdatedMay 16, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx agentrunkit

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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")
2

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"
    ]
)
3

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"] ?? "")
4

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)"
}
5

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)
6

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.

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.

Quick Config Preview

{ "mcpServers": { "agentrunkit": { "command": "npx", "args": ["-y", "agentrunkit"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides