How fast-langraph works
The design goal is simple: make LangGraph faster without asking you to change a line of graph code. fast-langraph is a thin Rust layer bolted onto LangGraph’s hot paths through PyO3 — not a fork, not a reimplementation.
The stack
Patches checkpointer · apply_writes · state merge · executor factory
The principle
- → Only touch paths that are already isolated behind interfaces.
- → Keep every public LangGraph API identical, so upstream tests pass.
- → Cross the Python/Rust boundary as rarely as possible; do bulk work in Rust.
- → Make it reversible — remove the import and you’re back to vanilla LangGraph.
- → Don’t force Rust where Python is already fast (native dict merge stays Python).
The path of an invocation
You import fast-langraph
A single import at process startup. In automatic mode, fast_langgraph.shim.patch_langgraph() runs before you build any graph.
The shim monkey-patches hot paths
It replaces well-isolated internals — the checkpointer’s serialization, apply_writes, state merge, and the executor factory — with Rust implementations via PyO3. Public LangGraph APIs are untouched.
Your graph runs unchanged
StateGraph, nodes, edges, tools, retrievers, prompts — all vanilla. When execution hits a patched path, work crosses into Rust and back through a thin PyO3 boundary.
Rust does the heavy lifting
Serialization, merging, and caching happen in native code with zero-copy where possible. Executors are cached across invocations instead of rebuilt every call.
Why Rust + PyO3 specifically
Python’s deepcopy and object model are the ceiling for serialization-heavy workloads. Rust gives predictable, allocation-light performance with no GC pauses, and PyO3 lets us expose it as ordinary Python objects — so a RustSQLiteCheckpointer looks and behaves exactly like the checkpointer it replaces. The result: native speed at the hot path, zero ergonomic cost at the call site.
Hit a LangGraph scaling wall?
We help production teams squeeze every bottleneck out of LangGraph — checkpoints, state, LLM costs, memory. Honest audits. Measurable fixes.