Skip to content

swarmstate

Drop-in state backend for LangGraph, CrewAI & custom agent loops - Rust core, framework-agnostic, built for production.

pip install swarmstate uv add swarmstate

Left: swarmstate sits between your orchestration (LangGraph, CrewAI, a custom loop) and four storage backends (memory, disk, redis, postgres) - the Python API delegates across the PyO3 boundary, GIL released, to the Rust core. Right: three measured results. Reading the newest checkpoint stays flat at about 7.5 microseconds from 5 to 2,000 checkpoints in a thread while InMemorySaver climbs from 5.5 to 40; Store.snapshot() stays at 0.0005 ms as state grows to 50,000 entries where a dict deepcopy costs 50.2 ms; and a durable put lands at 34.1 microseconds p50 against SqliteSaver's 34.7 at the same fsync policy, 63.9 at its shipped default.

Where swarmstate sits, and what the Rust core costs. Every number is reproducible - see Benchmarks.

No state lock-in

A framework-agnostic store with a stable, language-neutral (msgpack) format. Migrate between frameworks without losing accumulated state.

Fast checkpointing

A Rust core with fast serialization, O(1) immutable snapshots and incremental diffs. The GIL is released on the hot paths.

Deterministic routing

Rule-based "which agent is next" decisions resolved natively in Rust - no LLM tokens spent on transitions you can express as rules.


swarmstate does not compete with visible agent frameworks; it acts as low-level infrastructure, much like engines such as DuckDB, ClickHouse, Arrow, or Polars can sit underneath data applications without replacing them.

See the Guide to get started, or the API reference for the full surface.

Citing

If you use swarmstate in academic work, please cite it. GitHub's "Cite this repository" button (from CITATION.cff) produces ready-made APA and BibTeX entries. To cite the archived software release, use its Zenodo DOI (10.5281/zenodo.22067264) — it always resolves to the latest version:

@software{salmeron_swarmstate,
  author    = {Salmeron, Jose L.},
  title     = {{swarmstate}: A state and checkpointing backend for multi-agent
               systems with a Rust core},
  year      = {2026},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.22067264},
  url       = {https://github.com/swarmstate/swarmstate}
}