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) — next.

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.2.1.tar.gz (55.9 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.2.1-cp39-abi3-win_amd64.whl (238.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

swarmstate-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (360.0 kB view details)

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

swarmstate-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (355.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

swarmstate-0.2.1-cp39-abi3-macosx_11_0_arm64.whl (333.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

swarmstate-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl (347.4 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for swarmstate-0.2.1.tar.gz
Algorithm Hash digest
SHA256 19e90b8fdb673d0425dd9a95435bdb50ba3a96730c1d8c3d7bff3960ae8e5b2b
MD5 6d1b91bb4b8574c5d5f6fb5d3c6f3940
BLAKE2b-256 b0e0353c5fbd1002f4ccd5fcc737afa66b2ce4492229b41a0a5e62c0744d7db2

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.2.1.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.2.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: swarmstate-0.2.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 238.8 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.2.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 335fdd44bc3cb3f0e0d1c121940d6f70ac5c456e05851cdb46c32670e1751686
MD5 2438f7b5d54ebe710fa98d65944c3da9
BLAKE2b-256 5eddc2abca54aaa97bd37598606d245101d914254a0250dae332978328e91352

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.2.1-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.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for swarmstate-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5c8a3f9763e88011c6bd044d14444b05e7ba9b6e1e57461ad7df88f3090095e
MD5 50d135d8aef9e80e02b615ab6179ac2a
BLAKE2b-256 7781c48a620bdf73ee5d047bd0faf0eafb99fcd8bd9cc55ec9991c07e4a4917f

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.2.1-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.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for swarmstate-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 614667904b44a2c597b5efcf3cbb16bc4c3e8b4ba240710ca1b1d5a355ec8a33
MD5 db3d14c50140ce7de29a58fbbe9f3908
BLAKE2b-256 188130c0072706998eb4acaceefad79c5719d9b276cb1e5bf54c833206e5e19b

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.2.1-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.2.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for swarmstate-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b6abbebf855741f875cac2204c65a6ad46ce2b0dc95cc8831f4d1f6f22bcf0e
MD5 d437b2635e03290806d31334fda37294
BLAKE2b-256 092c1a4e981a041e00fccb74dfdb4e3a67ed2600ebffcf5d057a06e6281d6c42

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.2.1-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.2.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for swarmstate-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4bbf808c3eaa63b99558c960c3b9cb862dc6eb08e4bdd90d4bcf3a3c80ff3502
MD5 c80b93dfcc9d9a5dc95a71f0ede1c0f6
BLAKE2b-256 a80a0119ad335513befb12257390eb819f77c1f7f44f0614f47e248ac316fa6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for swarmstate-0.2.1-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