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) — 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.0.tar.gz (31.4 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.0-cp39-abi3-win_amd64.whl (238.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

swarmstate-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (359.6 kB view details)

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

swarmstate-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (355.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

swarmstate-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (333.4 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

swarmstate-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl (347.1 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: swarmstate-0.2.0.tar.gz
  • Upload date:
  • Size: 31.4 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.0.tar.gz
Algorithm Hash digest
SHA256 4c5464e94f3dc33fe0d5f1c9028ac0ba5bc74660ca5a8b2c1748d0365fb7c857
MD5 04de92d1a09dd8236a26db85ded88550
BLAKE2b-256 a9738057efb1e79e232df2c33364813a7cdd33e67a9c962b0eb814153a6301ca

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: swarmstate-0.2.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 238.7 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.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e641e10a25a1143c1ba4c82edd4e21324448ba050d404560f78dbb49419f8bdc
MD5 fd4af83a546fac87ae47ce188dba683b
BLAKE2b-256 648c0439b7d3ab69dd3029ab03e50c5094c02ba51d99c5dfebf2d8233075e6cc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for swarmstate-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2bc4e9831f12228f0277b1de4209c066a47a613a9d3f8c571c7271d807479ed5
MD5 75d14737f1af76bc8ea319abedcd82a4
BLAKE2b-256 e2956cca350d81e9439cc3d4c1cabfd30c0b3fd8c584b1d1a7bac0df7c206c40

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for swarmstate-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8aa1a70dd5434d29289d6ea75118c7fb1a6cc2f23973d40a810425d6f1d9ae61
MD5 45867a02a7a979c5782863ca6116b072
BLAKE2b-256 8e72917dc8a853918009c52d3de1a047bbf3d20767c922520137442dc4b7cddd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for swarmstate-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 386a5a1da1a33e9663c32354b505ea042c32ff0524f3c9eb69a35a8b615b1ed3
MD5 e62f2a7d26d56e37bffddf3250d38166
BLAKE2b-256 96caa0bae4982c95fe1450cf101c138291572660ed5181045d5e98e207d1b9fc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for swarmstate-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f7b4f4162755ee0b3c9f309cdc7b42a2a8507ac1bc31a9d5ada2c53e0d24dfaa
MD5 e0a64fc6a976387bfcc8cbb977e3dc12
BLAKE2b-256 181df1d79eef1453574248334b8a95a1384fe5d076ca71722b7290e3629471ab

See more details on using hashes here.

Provenance

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