Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Troupekit and swarms-rs

swarms-rs is a Rust framework for multi-agent swarms and DAG workflows. It came up in our searches for Rust agent frameworks on 2026-11-28. Its crates.io release 0.3.0 from 2026-09-29 has no git tag, so we read the main branch at 1ccbfbf, whose manifest reads 0.3.0. Checked on 2026-11-28.

The same agent

The test agent is small on purpose: a persona, one tool, a run that is killed and resumed, and a spend cap.

In swarms-rs

From the README (README):

use swarms_macro::tool;
use swarms_rs::llm::provider::openrouter::OpenRouter;
use swarms_rs::structs::agent::Agent;

#[derive(Debug, thiserror::Error)]
#[error("unknown unit '{0}'")]
pub struct UnknownUnit(String);

#[tool(
    description = "Convert a temperature between Celsius and Fahrenheit",
    arg(value, description = "The temperature to convert"),
    arg(to, description = "Target unit: 'celsius' or 'fahrenheit'")
)]
fn convert_temperature(value: f64, to: String) -> Result<f64, UnknownUnit> {
    match to.as_str() {
        "celsius" => Ok((value - 32.0) * 5.0 / 9.0),
        "fahrenheit" => Ok(value * 9.0 / 5.0 + 32.0),
        other => Err(UnknownUnit(other.to_string())),
    }
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let agent = OpenRouter::from_env_with_model("openai/gpt-5.5")
        .agent_builder()
        .system_prompt("Use the tools for unit conversions instead of guessing.")
        .add_tool(ConvertTemperature)
        .max_loops(2)
        .build();

    println!("{}", agent.run("What is 98.6°F in Celsius?".to_string()).await?);
    Ok(())
}

With .enable_autosave() the agent writes its state to a JSON file during and after each run; reading it back is your code (persistence.md). We found no spend cap; .max_loops(2) above caps the loop.

In troupekit

The persona is the doc comment and the tool is a #[tool] function. This is the tool_agent example:

#![allow(unused)]
fn main() {
/// Adds numbers with the add tool.
#[agent(model = "openai/gpt-6-luna", tools = [add])]
fn calc() {}
}

A role, a goal, evals, a spend cap of 5 000 millionths of a dollar per run and the checkpoint store are keys on the same macro. This one is from a test of the kit:

#![allow(unused)]
fn main() {
#[agent(
    model = "fake/m",
    role = "Checks facts.",
    goal = "A short answer.",
    display_name = "Fact Checker",
    evals = ["min_items(items, 1)"],
    limits = Limits { run: Some(5_000), ..Limits::default() },
    checkpoints = Storage::memory(),
    max_turns = 3,
    max_tokens = 256,
    retries = 1,
    laws = "tests/fixtures/rules.bend",
    auto_laws = false,
)]
}

In 0.4 the laws key is validated at build and not enforced by the run (Proofs and laws). With the SQLite store as checkpoints, a new process resumes a killed run by its id. This is the kill_model_call example, which is killed in the middle of a local model call:

#![allow(unused)]
fn main() {
("resume", Some(id)) => {
    let run_id: RunId = serde_json::from_str(&format!("\"{id}\""))?;
    let text = built.resume(run_id).await?;
    println!("RESUMED {}", text.len());
}
}

Nothing else is needed: no server, no second process to run the engine, no Python. Durable runs and Spend limits say what each part guarantees.

Side by side

swarms-rs 0.3.0Troupekit 0.4
DurabilityAutosave writes state files; loading them is your codeCheckpoint after every step and resume by run id in a new process, once checkpoints use Storage::sqlite; the default in-memory store is lost when the process exits
Spend limitsNone found; a loop capUSD per call, per run and per period, when you set them; checked before each call
TracingDebug log lines; no spans foundOwn tracer, JSONL and an HTML viewer
EvalsNone foundEvals on the persona, checked on every run
Offline and on-deviceAn OpenAI-compatible base URL (openai.rs); no Ollama docs and no in-process modelllama.cpp in process, Ollama, and a route policy per call
MobileNone foundBuilds for iOS and Android in CI; Swift and Kotlin bindings since 0.4, built from source
Single binaryYes, it is a Rust libraryYes, it is a Rust library

Where swarms-rs is better

Multi-agent shapes ready to use: a DAG of agents with conditional edges and cycle detection (graph_workflow.rs), sequential, concurrent and router swarms, and MCP tools over STDIO and SSE. Troupekit's team and crew patterns are planned for 0.5.

Where troupekit is different

With Storage::sqlite checkpoints runs are durable, and with limits set each model call is checked against a USD cap before it is sent, using an estimate a token-dense request can exceed. Tracing and evals are built in, and the model can run on the device.