Swarms Rust · v0.3.0
Multi-agent systems in Rust, ready in 6 milliseconds
swarms-rs is the enterprise-grade multi-agent orchestration framework for Rust. Build agents with tools and MCP, run them on any model, and compose them into sequential, concurrent, graph and router workflows that use a fraction of the memory.
- cold start
- 6 ms
- memory at startup
- 3.7 MB
- framework time per LLM call
- 0.11 ms
- for 100 parallel agents
- 0.52 s
130x to 440x faster than the others
25x to 68x less memory
10x to 88x less overhead
against an ideal 0.50 s
Measured on swarms-rs 0.3.0 against Swarms Python, LangGraph and CrewAI, all driving Claude Sonnet 5.5.
Quickstart
From an empty project to a multi-model pipeline in three steps
You need the latest stable Rust and one OpenRouter key. Each step builds on the one before it.
- 1
Install and set one API key
Create a project, add the crate, and export a key. One OpenRouter key reaches models from Anthropic, OpenAI, Google, Meta, Mistral, DeepSeek and xAI.
terminalcargo new my-agents && cd my-agents cargo add swarms-rs cargo add tokio --features full cargo add anyhow export OPENROUTER_API_KEY="sk-or-..."terminal · example output - 2
Build and run your first agent
Pick any model by its ID. Swapping the model is a one-string change, and tools work the same on every provider.
src/main.rsuse swarms_rs::llm::provider::openrouter::OpenRouter; use swarms_rs::structs::agent::Agent; #[tokio::main] async fn main() -> anyhow::Result<()> { let agent = OpenRouter::from_env_with_model("anthropic/claude-opus-5.5") .agent_builder() .agent_name("Researcher") .system_prompt("You are a concise research assistant.") .build(); println!("{}", agent.run("What is a vector database?".to_string()).await?); Ok(()) }terminal · example output - 3
Chain agents into a multi-model pipeline
A SequentialWorkflow passes each agent's output to the next. Here a fast model researches, a strong model writes, and a third model edits. Run it with cargo run.
src/main.rsuse swarms_rs::llm::provider::openrouter::OpenRouter; use swarms_rs::structs::agent::Agent; use swarms_rs::structs::sequential_workflow::SequentialWorkflow; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = OpenRouter::from_env(); let stage = |model: &str, name: &str, prompt: &str| -> Box<dyn Agent> { Box::new( client .clone() .set_model(model) .agent_builder() .agent_name(name) .system_prompt(prompt) .build(), ) }; let workflow = SequentialWorkflow::builder() .name("OpenRouterPipeline") .agents(vec![ stage("google/gemini-3.8-flash", "Researcher", "List the key facts as bullet points."), stage("anthropic/claude-opus-5.5", "Writer", "Turn the notes into a 300-word article."), stage("openai/gpt-5.5", "Editor", "Fix errors and return only the final article."), ]) .build(); let result = workflow.run("How Rust's borrow checker prevents data races").await?; if let Some(article) = result.history.last() { println!("{}", article.content); } Ok(()) }terminal · example output
Multi-agent harnesses
Six ways to put agents to work together
Every structure takes the same agents, so you can start with a pipeline and move to a graph without rewriting them.
SequentialWorkflow
A pipeline where each agent builds on the last one's output.
- Research, write, edit and review chains
- A different model for every stage
- The full history of every step is returned
let workflow = SequentialWorkflow::builder()
.name("Pipeline")
.agents(vec![researcher, writer, editor])
.build();
let result = workflow.run("How Rust prevents data races").await?;
println!("{}", result.history.last().unwrap().content);Benchmarks
130x to 440x faster to start, 25x to 68x lighter in memory
Every framework drove the same model, prompts and tasks, so what differs is the framework itself: startup, memory, per-call overhead and real parallelism.
Cold start
Process launch to agent ready
- swarms-rs6 ms
- LangGraph130x780 ms
- CrewAI240x1,439 ms
- Swarms (Python)441x2,647 ms
Memory at startup
Resident memory of an idle agent process
- swarms-rs3.7 MB
- LangGraph25x94 MB
- CrewAI48x179 MB
- Swarms (Python)68x250 MB
Framework time per LLM call
Time the framework spends around each model call
- swarms-rs0.11 ms
- Swarms (Python)10x1.11 ms
- LangGraph16x1.77 ms
- CrewAI88x9.68 ms
100 agents in parallel
Each call takes 0.50 s, so the ideal is 0.50 s
- swarms-rs0.52 s
- LangGraph1.4x0.72 s
- Swarms (Python)4.3x2.21 s
- CrewAI8.1x4.20 s
swarms-rs 0.3.0, Swarms Python 15.0.3, LangGraph 1.2.12, CrewAI 1.15.23 on Claude Sonnet 5.5. Bars use a log scale; labels show the measured values.
Read the full benchmarkWhat you get
Everything an agent service needs, compiled into one binary
Any model, one string
AnyModel picks the provider from the model name. OpenRouter adds Anthropic, OpenAI, Google, Meta, Mistral, DeepSeek and xAI behind one key.
Tools with a macro
Annotate a plain Rust function with #[tool] and the agent can call it. Every call is stored with its name, arguments and JSON result, so workflows read results back as Rust types.
MCP over STDIO and SSE
Attach any Model Context Protocol server to an agent with a single builder call, and use the same tools across every multi-agent structure.
Memory safe by construction
Ownership removes data races and leaks without a garbage collector, which is why 100 agents run in 29 MB.
State you can resume
Turn on autosave and agents write their state to disk. Conversations round-trip through JSON.
Built on Tokio
Agents are async tasks. Batch execution, concurrent runs and workflows share the same runtime your service already uses.
Read more
Everything we have written about swarms-rs
Questions about swarms-rs
What Rust developers ask before they pick an agent framework.
What is swarms-rs?
swarms-rs is the Swarms multi-agent framework written in Rust. It gives you agents with tools, memory and MCP support, plus multi-agent structures such as sequential, concurrent, graph, rearrange and router workflows. It is published on crates.io and licensed under Apache-2.0.
How do I get started with swarms-rs?
Run cargo add swarms-rs along with tokio and anyhow, export an API key such as OPENROUTER_API_KEY, and build an agent with the builder API. The three-step quickstart on this page goes from an empty project to a multi-model pipeline.
Which models and providers does swarms-rs support?
OpenAI, Anthropic and DeepSeek have native providers, and OpenRouter gives you models from Google, Meta, Mistral, xAI and more with one key. AnyModel chooses the provider from the model name, such as anthropic/claude-opus-5-5 or openai/gpt-5.5, so switching providers is a one-string change.
How fast is swarms-rs compared with Python frameworks?
In our benchmark of swarms-rs 0.3.0 against Swarms Python 15.0.3, LangGraph 1.2.12 and CrewAI 1.15.23, all driving Claude Sonnet 5.5, swarms-rs started in 6 ms, used 3.7 MB at startup, added 0.11 ms of framework time per LLM call, and ran 100 agents in parallel in 0.52 seconds. The model's own response time is the same for every framework. The harness is open source so you can rerun it.
Does swarms-rs support MCP and custom tools?
Yes. Define tools with the #[tool] macro from swarms-macro, or attach MCP servers over STDIO or SSE with add_stdio_mcp_server and add_sse_mcp_server.
Which multi-agent structures are included?
SequentialWorkflow, ConcurrentWorkflow, DAGWorkflow for graphs, AgentRearrange for flows written as a string, SwarmRouter for choosing the swarm type at runtime, a batch executor, and sub-agents and handoffs on the agent builder.
Should I use Swarms Python or swarms-rs?
Use Python when you want the widest set of integrations and the fastest path to a prototype. Use swarms-rs for services where startup time, memory, latency and concurrency matter, such as serverless functions, high-throughput APIs and large swarms. Both follow the same agent model.
Ready to build?
Sign up now for the Swarms Cloud and get $5 in free API credits to help you get started building your agentic workflows.

