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.
~12.8× faster checkpoint writes than
SqliteSaveron LangGraph's interface, and O(1) state snapshots (hundreds of thousands× faster than adeepcopyon large state). Reproducible numbers → swarmstate.github.io/benchmarks.
swarmstate is a state and checkpointing backend with a Rust core and a Python API for multi-agent
systems. It does not compete with visible agent frameworks; it acts as low-level infrastructure - much
like engines such as DuckDB, ClickHouse, Arrow, or Polars sit underneath data applications without
replacing them.
It solves three production pains:
- State lock-in across frameworks - a framework-agnostic store so migrating frameworks doesn't lose state.
- Checkpointing cost and latency - a Rust-backed implementation of LangGraph's checkpointer interface.
- 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
uv add swarmstate # or with uv
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 swarmstateworks. - 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-inBaseCheckpointSaverbacked by theStore; snapshot/roll back the whole checkpoint DB at once. - M4 (Benchmarks) ✅ -
SwarmStateSaver.put~12.8× faster thanSqliteSaver;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 + backends) ✅ - persistent, drop-in checkpointer backends
RedisStore,DiskStore(SQLite) andPostgresStore, all msgpack wire-format, plusSwarmStateStorage(portable memory backed by a sharedStore). - M6 (docs · wheels · PyPI) ✅ - full docs site, benchmarks, cross-platform abi3 wheels, and PyPI publishing via Trusted Publishing (OIDC).
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmstate-0.8.0.tar.gz.
File metadata
- Download URL: swarmstate-0.8.0.tar.gz
- Upload date:
- Size: 74.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77883dd51453ff894ea23de354990f1c9925ffe2d6e9576019cab4c40b55d743
|
|
| MD5 |
016f3b3e6202585609cef83f555e0fa1
|
|
| BLAKE2b-256 |
7c795a7ff090d0adc654290bb6592e8224ed5bad9ccf862b32708ae15ec71fd8
|
Provenance
The following attestation bundles were made for swarmstate-0.8.0.tar.gz:
Publisher:
release.yml on swarmstate/swarmstate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swarmstate-0.8.0.tar.gz -
Subject digest:
77883dd51453ff894ea23de354990f1c9925ffe2d6e9576019cab4c40b55d743 - Sigstore transparency entry: 2056594128
- Sigstore integration time:
-
Permalink:
swarmstate/swarmstate@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/swarmstate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Trigger Event:
release
-
Statement type:
File details
Details for the file swarmstate-0.8.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: swarmstate-0.8.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 252.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50ab36aa42d381d6b19ad1592e09119e2dca28563039b70abe2b585f78a8f066
|
|
| MD5 |
00c4bca6f24d30c97f75ea530c675fe8
|
|
| BLAKE2b-256 |
b0149da98af836156811b3a393a064fd6b9125096e7627c13097ac6c0299978c
|
Provenance
The following attestation bundles were made for swarmstate-0.8.0-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on swarmstate/swarmstate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swarmstate-0.8.0-cp39-abi3-win_amd64.whl -
Subject digest:
50ab36aa42d381d6b19ad1592e09119e2dca28563039b70abe2b585f78a8f066 - Sigstore transparency entry: 2056594870
- Sigstore integration time:
-
Permalink:
swarmstate/swarmstate@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/swarmstate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Trigger Event:
release
-
Statement type:
File details
Details for the file swarmstate-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: swarmstate-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 373.3 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18559bf9fa2c79e6d758a772312537d676dbdd6e87fabb324694ab6202b1cfe0
|
|
| MD5 |
4d92ca79045bab54c25d706a4ea96e0c
|
|
| BLAKE2b-256 |
84f3ab6ee577c598b6f31e1f5e1c8a63e6ea1c12ddcc07292dc5016d18778cf6
|
Provenance
The following attestation bundles were made for swarmstate-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on swarmstate/swarmstate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swarmstate-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
18559bf9fa2c79e6d758a772312537d676dbdd6e87fabb324694ab6202b1cfe0 - Sigstore transparency entry: 2056595801
- Sigstore integration time:
-
Permalink:
swarmstate/swarmstate@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/swarmstate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Trigger Event:
release
-
Statement type:
File details
Details for the file swarmstate-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: swarmstate-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 369.8 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0001d02409d445402baaeb098a325e838956db329319e03a64da047065361447
|
|
| MD5 |
0199e82e832cc4cf379497dd35e4b70c
|
|
| BLAKE2b-256 |
2178e7af1711d932ef16514ca1040185058087a4fcbe037373fba3a53e5a310c
|
Provenance
The following attestation bundles were made for swarmstate-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on swarmstate/swarmstate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swarmstate-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
0001d02409d445402baaeb098a325e838956db329319e03a64da047065361447 - Sigstore transparency entry: 2056595466
- Sigstore integration time:
-
Permalink:
swarmstate/swarmstate@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/swarmstate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Trigger Event:
release
-
Statement type:
File details
Details for the file swarmstate-0.8.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: swarmstate-0.8.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 347.5 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7320ea3f1e6e42f8d02495b1c46bf0182deb0563bc30ac378897a7c87b7dbd94
|
|
| MD5 |
e39cd38f8e374c891dc9ee87a8e527e1
|
|
| BLAKE2b-256 |
84690a8b6e7ab4cb048319fbbbd329acd7cea327602edf82e49d3fea907c6117
|
Provenance
The following attestation bundles were made for swarmstate-0.8.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on swarmstate/swarmstate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swarmstate-0.8.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
7320ea3f1e6e42f8d02495b1c46bf0182deb0563bc30ac378897a7c87b7dbd94 - Sigstore transparency entry: 2056595108
- Sigstore integration time:
-
Permalink:
swarmstate/swarmstate@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/swarmstate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Trigger Event:
release
-
Statement type:
File details
Details for the file swarmstate-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: swarmstate-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 361.4 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b1fe0084fc3c3bd42327721a9ee915c9181ba0b264b8241d819bee3fe1052d8
|
|
| MD5 |
1c2a68f65f280591dc1f8ebbf00ecd83
|
|
| BLAKE2b-256 |
b16a83b1ac20cb3f3165dc127326137649389dc8a685691cc173eebecb06c058
|
Provenance
The following attestation bundles were made for swarmstate-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on swarmstate/swarmstate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swarmstate-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
7b1fe0084fc3c3bd42327721a9ee915c9181ba0b264b8241d819bee3fe1052d8 - Sigstore transparency entry: 2056594357
- Sigstore integration time:
-
Permalink:
swarmstate/swarmstate@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/swarmstate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc71a7cc2a7c9bee68ee28c3ce969f2ee88daf0f -
Trigger Event:
release
-
Statement type: