Skip to main content

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

Project description

swarmstate

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

swarmstate is a state and checkpointing backend with a Rust core and a Python API for multi-agent systems. It is not an orchestration framework: it is the fast engine that sits underneath LangGraph, CrewAI, and custom agent loops — the same way a fast columnar engine sits underneath data workloads.

It solves three production pains:

  1. State lock-in across frameworks — a framework-agnostic store so migrating frameworks doesn't lose state.
  2. Checkpointing cost and latency — a Rust-backed implementation of LangGraph's checkpointer interface.
  3. Deterministic routing paid for in tokens — a native handoff graph that resolves rule-based transitions in microseconds.

Installation

pip install swarmstate            # prebuilt abi3 wheels, no compiler required

Optional extras: swarmstate[langgraph], swarmstate[crewai], swarmstate[redis], swarmstate[all].

Usage

import swarmstate as ss

store = ss.Store()                              # in-memory, msgpack codec
store.set("workflow", "onboarding", {"step": 3, "data": {...}})
snap = store.snapshot()                          # cheap, immutable snapshot
store.set("workflow", "onboarding", {"step": 4})
store.restore(snap)                              # rollback
store.get("workflow", "onboarding")              # -> {"step": 3, "data": {...}}

snap2 = store.snapshot()
snap2.diff(snap)                                 # {"added": [...], "removed": [...], "changed": [...]}

# Deterministic, LLM-free routing (resolved natively in Rust)
g = ss.HandoffGraph()
g.add_edge("triage", "billing", when="category == 'billing'")
g.add_edge("triage", "human")                    # unconditional default
g.route("triage", {"category": "billing"})       # -> "billing"

Drop-in LangGraph checkpointer (pip install "swarmstate[langgraph]"):

from swarmstate.integrations.langgraph import SwarmStateSaver

graph = builder.compile(checkpointer=SwarmStateSaver())   # replaces SqliteSaver, 1 line

Status

Early development.

  • M0 (scaffolding) ✅ — Rust core builds; import swarmstate works.
  • M1 (Rust store) ✅ — concurrent KV store, msgpack codec, O(1) immutable snapshots, incremental diffs, GIL released on hot paths.
  • M2 (HandoffGraph) ✅ — deterministic conditional routing with a safe Rust condition evaluator (no eval), cycle detection.
  • M3 (LangGraph adapter) ✅ — SwarmStateSaver, a drop-in BaseCheckpointSaver backed by the Store; snapshot/roll back the whole checkpoint DB at once.
  • M4 (Benchmarks) ✅ — SwarmStateSaver.put ~12.8× faster than SqliteSaver; Store.snapshot() is O(1) (hundreds of thousands× faster than deep-copying large state). Reproducible: benchmarks/run.py; charts & tables in the docs.
  • M5 (CrewAI adapter + Redis backend) ✅ — RedisStore (persistent, msgpack wire-format, drop-in checkpointer backend) and SwarmStateStorage (CrewAI-compatible memory backed by a shared Store).
  • M6 (docs · wheels · PyPI) — mostly done.

Development

python -m venv .venv && source .venv/bin/activate
pip install maturin pytest
maturin develop --release     # compile the Rust core and install it locally
cargo test                    # Rust core tests
pytest -q                     # Python API tests

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmstate-0.3.0.tar.gz (60.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

swarmstate-0.3.0-cp39-abi3-win_amd64.whl (243.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

swarmstate-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (364.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

swarmstate-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (359.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

swarmstate-0.3.0-cp39-abi3-macosx_11_0_arm64.whl (338.2 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

swarmstate-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl (351.7 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file swarmstate-0.3.0.tar.gz.

File metadata

  • Download URL: swarmstate-0.3.0.tar.gz
  • Upload date:
  • Size: 60.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swarmstate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6f7f9f3c9915764f07098aa2fcd0c4fb000c59cfb1e0b2ad11930b99c6d5e225
MD5 17cf794508cf4edd72fa262292014738
BLAKE2b-256 59755c8012ff3a27ddd2388663d23cd1495b288c213c6111731723b5f2c21379

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.3.0.tar.gz:

Publisher: release.yml on swarmstate/swarmstate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swarmstate-0.3.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: swarmstate-0.3.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 243.2 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swarmstate-0.3.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c283617c50e3481a89e5456b22ab6fac33266d30b773eaddb801dee4848c9516
MD5 9273923579b1d98ddfe75348fdfec97f
BLAKE2b-256 65f4470fcced97094e779bbe01857f6c319695272b62c3899c560ef365899d58

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.3.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on swarmstate/swarmstate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swarmstate-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for swarmstate-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6302fd91ecb37b3cb93dd624cd84dd6a824a13c529d6c1d34534c80ce2f208e6
MD5 ba123414ce86659a5bbef30c3fb74027
BLAKE2b-256 f33f72a2e800953d07a3b4aa3c97063334e077774637c8bf9a95187ba0c36260

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on swarmstate/swarmstate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swarmstate-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for swarmstate-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 678b19d13a00172fa8034d9316844759350bd96812029373101ad8d3affeab43
MD5 5083d7810a3dae6ccc29f958a47b46e5
BLAKE2b-256 0199ac2c10165ab9acb710a6d5a50717d3248b1b3188aaf0fbbd461c9a38cd61

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on swarmstate/swarmstate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swarmstate-0.3.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for swarmstate-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd6eb46bce37cbe96f27e56d562fdad6b904971836dc48a3971ac31ba7bdfb1d
MD5 82aed70499fa040ea3e584a0ad40e646
BLAKE2b-256 a6fa21be2fc179bc58d1b51f85cc44adcce77482af8c6fdfb1e5a80ab5466645

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.3.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on swarmstate/swarmstate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swarmstate-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for swarmstate-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f0237bc87f5d62a3f6297bd8de6be8352abda92cf294905f11ff102375672d0c
MD5 0ddad4cb126989baf82e4464d229c0dd
BLAKE2b-256 af5558c5ef324f8f0e4fb4de32d5382d173be52e1a6249f73d992237324ac077

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on swarmstate/swarmstate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page