Skip to content
Tech News
← Back to articles

Show HN: I Built LangGraph for Swift

read original more articles

A Swift framework for building agents and multi-agent workflows.

let result = try await Workflow ( ) . step ( researchAgent ) . step ( writerAgent ) . run ( " Summarize the latest WWDC session on Swift concurrency. " )

Two agents, one pipeline, compiled to a DAG with crash recovery and Swift concurrency safety.

Install

. package ( url : " https://github.com/christopherkarani/Swarm.git " , from : " 0.6.0 " )

Quick Start

import Swarm // The @Tool macro generates the JSON schema at compile time @ Tool ( " Looks up the current stock price " ) struct PriceTool { @ Parameter ( " Ticker symbol " ) var ticker : String func execute ( ) async throws -> String { " 182.50 " } } // Create an agent with unlabeled instructions first and tools in the trailing @ToolBuilder closure let agent = try Agent ( " Answer finance questions using real data. " , configuration : . init ( name : " Analyst " ) , inferenceProvider : . anthropic ( key : " {ENV " ) ) { PriceTool ( ) CalculatorTool ( ) } let result = try await agent . run ( " What is AAPL trading at? " ) print ( result . output ) // "Apple (AAPL) is currently trading at $182.50."

That is a working agent with type-safe tool calling. Swarm also supports AGENTS.md and SKILL.md for declarative agent specs and reusable skills — see the Getting Started guide for the full workspace layout.

Why Swarm

Swift concurrency is part of the surface. Swift 6.2 StrictConcurrency is enabled across the package.

... continue reading