Introducing Railtracks for Swift: Native Agent Development for the Apple Ecosystem
Agents are changing what apps can do. Software is moving beyond waiting for instructions toward understanding context, reasoning across information and taking action on a user’s behalf. With more than 2.5 billion active devices, Apple’s platforms are where people already work, communicate and create. Because Apple builds its hardware, silicon, operating systems and developer tools together, apps can feel consistent from iPhone to Mac to Apple Watch. For agents, that matters: cross-device context, capable local hardware and strong privacy protections are already part of the platform. Railtown sees Apple as the right foundation for the next generation of agentic apps.
Most AI features today are still bolted on, wired to an external service rather than built into the app itself. That’s why we built Railtracks for Swift: Railtown’s open-source Agent Development Kit, so agents become part of the app, not an add-on.
Why Railtracks for Swift?
Railtown believes agentic capability should be part of the application architecture itself. Railtracks for Swift gives developers the native building blocks to make that happen:
- Build agents, tools, and workflows in native Swift code
- Orchestrate multi-agent systems with clear control over what runs when
- Turn Swift functions into tools an agent can call, including Apple framework APIs
- Inspect and debug agent runs as you build, with step-by-step tracing
- Ship agents inside your app, not behind someone else’s server
import RailtracksSwift
import FoundationModels
struct AdditionToolApple: RTSAppleAIToolNode {
typealias Output = String
let id = UUID()
let toolName = "Addition"
var inputs: RTSInput = [:]
let callableRoutine = RTSClosure { inputs in
guard case let .number(a) = inputs["a"] else { throw RTSError.missingInput("a") }
guard case let .number(b) = inputs["b"] else { throw RTSError.missingInput("b") }
return ["result": .number(a + b)]
}
var toolDescription = "Adds two numbers and returns the result."
// parameterSchema and call(arguments:) are provided automatically
@Generable struct Arguments: Encodable {
@Guide(description: "First number") var a: Double
@Guide(description: "Second number") var b: Double
}
}
// Check availability before running
guard case .available = SystemLanguageModel.default.availability else {
// handle unavailable
return
}
let agent = RTSAgent(
llmProvider: .appleAI,
tools: [AdditionToolApple()],
systemMessage: "You are a math assistant. Use the provided tools to solve math problems."
)
let gateway = RTSLLMGateway(apiKeys: [:])
let flow = RTSFlow(title: "Math Assistant (AppleAI)")
let result = try await flow.run(agent: agent, prompt: "What is 12 + 8?", gateway: gateway)
Built for the Apple Ecosystem
Railtracks for Swift is designed around what makes Apple’s platforms different.
One language, every device. Swift is the native language across iPhone, iPad, Mac, Apple Watch and Apple Vision Pro. Railtracks for Swift starts on macOS, and the same language reaches wherever the user is.
The device is part of the agent. Native code means agents can call into the frameworks and on-device models Apple already provides. Tools stop being HTTP endpoints and start being the camera, the calendar, the file system, and the user’s own data. Apple silicon makes running that work on-device practical.
Made for Swift Builders
Most agent frameworks are Python or TypeScript first, leaving Swift teams to bridge to a backend or build their own orchestration. Railtracks for Swift closes that gap.
Railtracks for Swift is open source and developer first. If you’ve used Railtracks in Python, the model carries over: tools are just functions, and agent logic lives in code you already know how to read. Plug in your model of choice and go from idea to working agent in minutes, not weeks.
Part of the Railtown Platform
Railtracks for Swift is the build layer of Railtown’s end-to-end stack: build the agent with Railtracks, feed it context with Railengine, and observe it in production with Conductr.
Not sure where to start?
Reach out to Railtown here to learn how we can help you bring intelligent agents into your Apple apps.