High-performance Rust implementation of LangGraph components
Project description
Fast-LangGraph
High-performance Rust accelerators for LangGraph applications. Drop-in components that provide up to 700x speedups for checkpoint operations and 10-50x speedups for state management.
Why Fast-LangGraph?
LangGraph is great for building AI agents, but production workloads often hit performance bottlenecks:
- Checkpoint serialization - Python's deepcopy is slow for complex state
- State management at scale - High-frequency updates accumulate overhead
- Repeated LLM calls - Identical prompts waste API costs
Fast-LangGraph solves these by reimplementing critical paths in Rust while maintaining full API compatibility.
Install
pip install fast-langgraph
or
uv add fast-langgraph
Acceleration Modes
Fast-LangGraph offers two types of acceleration:
Automatic Acceleration (via Shim)
Enable transparent acceleration with a single environment variable or function call. No code changes required to your existing LangGraph application.
# Option 1: Environment variable (recommended for production)
export FAST_LANGGRAPH_AUTO_PATCH=1
python your_app.py
# Option 2: Explicit patching at startup
import fast_langgraph
fast_langgraph.shim.patch_langgraph()
# Your existing LangGraph code runs faster automatically
What gets accelerated automatically:
| Component | Speedup | Description |
|---|---|---|
| Executor Caching | 2.3x | Reuses ThreadPoolExecutor across invocations |
| apply_writes | 1.2x | Rust-based channel batch updates |
Combined automatic speedup: ~2.8x for typical graph invocations.
Check acceleration status:
import fast_langgraph
fast_langgraph.shim.print_status()
Manual Acceleration (Explicit Usage)
For maximum performance, use Rust components directly. These require small code changes but provide the largest speedups.
from fast_langgraph import (
RustSQLiteCheckpointer, # 5-6x faster checkpointing
cached, # LLM response caching
langgraph_state_update, # Fast state merging
)
| Component | Speedup | When to Use |
|---|---|---|
RustSQLiteCheckpointer |
5-6x | State persistence |
@cached decorator |
10x+ | Repeated LLM calls (with 90% hit rate) |
langgraph_state_update |
13-46x | High-frequency state updates |
Quick Start
1. Automatic Acceleration (Easiest)
# At the top of your application
import fast_langgraph
fast_langgraph.shim.patch_langgraph()
# Rest of your code unchanged - runs 2-3x faster
from langgraph.graph import StateGraph
# ...
2. Fast Checkpointing (Biggest Impact)
Drop-in replacement for LangGraph's SQLite checkpointer:
from fast_langgraph import RustSQLiteCheckpointer
# 5-6x faster than the default checkpointer
checkpointer = RustSQLiteCheckpointer("state.db")
graph = graph.compile(checkpointer=checkpointer)
3. LLM Response Caching
Cache LLM responses to avoid redundant API calls:
from fast_langgraph import cached
@cached(max_size=1000)
def call_llm(prompt):
return llm.invoke(prompt)
# First call: hits the API (~500ms)
response = call_llm("What is LangGraph?")
# Second identical call: returns from cache (~0.01ms)
response = call_llm("What is LangGraph?")
# Check cache statistics
print(call_llm.cache_stats())
# {'hits': 1, 'misses': 1, 'size': 1}
4. Optimized State Updates
Efficient state merging for high-frequency updates:
from fast_langgraph import langgraph_state_update
new_state = langgraph_state_update(
current_state,
{"messages": [new_message]},
append_keys=["messages"]
)
5. Performance Profiling
Find bottlenecks with minimal overhead:
from fast_langgraph.profiler import GraphProfiler
profiler = GraphProfiler()
with profiler.profile_run():
result = graph.invoke(input_data)
profiler.print_report()
Performance
Rust's Key Strengths
These are the operations where Rust provides the most dramatic improvements:
| Operation | Speedup | Best Use Case |
|---|---|---|
| Checkpoint Serialization | 43-737x | State persistence (scales with state size) |
| Sustained State Updates | 13-46x | Long-running graphs with many steps |
| E2E Graph Execution | 2-3x | Production workloads with checkpointing |
All Features
| Feature | Performance | Use Case |
|---|---|---|
| Complex Checkpoint (250KB) | 737x faster than deepcopy | Large agent state |
| Complex Checkpoint (35KB) | 178x faster | Medium state |
| LLM Response Caching | 10x speedup (90% hit rate) | Repeated prompts, RAG |
| Function Caching | 1.6x speedup | Expensive computations |
| In-Memory Checkpoint | 1.4 us/op | Fast state snapshots |
| LangGraph State Update | 1.4 us/op | High-frequency updates |
Note: Rust excels at complex state operations. For simple dict operations, Python's built-in dict (implemented in C) is already highly optimized. See BENCHMARK.md for detailed results.
Requirements
- Python 3.9+
- Works with any LangGraph version
Documentation
Authoritative docs live under documentation/docs/ and power the MkDocs site.
- Getting Started - Installation + first run
- User Guide - Automatic/manual acceleration details
- API Reference - Python + Rust surface area
- Architecture - Internal design + trade-offs
- Contributing - Tooling, tests, and release flow
Project Metadata
- Author: Dipankar Sarkar (me@dipankar.name)
- Organization: Neul Labs
- Repository: https://github.com/neul-labs/fast-langgraph
- License: MIT
Examples
See the examples/ directory for complete working examples:
function_cache_example.py- Caching patternsprofiler_example.py- Performance analysisstate_merge_example.py- State manipulation
Contributing
Contributions welcome! See documentation/docs/development/contributing.md for setup instructions.
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
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 fast_langgraph-0.1.15.tar.gz.
File metadata
- Download URL: fast_langgraph-0.1.15.tar.gz
- Upload date:
- Size: 370.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a93d18ee830e251180f955868845b936b7eb605c3bca3a1711337995d4d7fb96
|
|
| MD5 |
f4b99b5e42d98a425b326ac186be367e
|
|
| BLAKE2b-256 |
9e37fe3ab77734613077b2fd6507a579b74af746048dd9d1aec5d8814fa58ad2
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15.tar.gz:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15.tar.gz -
Subject digest:
a93d18ee830e251180f955868845b936b7eb605c3bca3a1711337995d4d7fb96 - Sigstore transparency entry: 1454907741
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_langgraph-0.1.15-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: fast_langgraph-0.1.15-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1430f4685e9a4f9775452dda3e65a8f070c39730b7ed067fa6da7d32ac20a92
|
|
| MD5 |
16f7e033e2db1875776fba5dd9f3346e
|
|
| BLAKE2b-256 |
bdabbf6401b7829bf914bee515a48c25f246fa276aba1fb130fa293f184b4256
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15-cp37-abi3-win_amd64.whl:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15-cp37-abi3-win_amd64.whl -
Subject digest:
c1430f4685e9a4f9775452dda3e65a8f070c39730b7ed067fa6da7d32ac20a92 - Sigstore transparency entry: 1454908140
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.7+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a5d37089f55f58c619ec252b745c4ff2082c93f3a6ef7ad7889531fa69f95cb
|
|
| MD5 |
3903f92487cf8bf0302531e3a62ec8a2
|
|
| BLAKE2b-256 |
c27afb81c3953b3c1eb5cf33c2eada149a66d419b3f258593e390965bbf29e7b
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_x86_64.whl:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
5a5d37089f55f58c619ec252b745c4ff2082c93f3a6ef7ad7889531fa69f95cb - Sigstore transparency entry: 1454908698
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.7+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e883ce55521261e82683e09b8b23ed7859bf5e508a5ceaece7072c530d91683a
|
|
| MD5 |
62672c8f75238da36c47e3868090de4a
|
|
| BLAKE2b-256 |
b6426edbb55502a5b78db103468ded65056a607100b1258adc79482b287da181
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_aarch64.whl:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15-cp37-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
e883ce55521261e82683e09b8b23ed7859bf5e508a5ceaece7072c530d91683a - Sigstore transparency entry: 1454907832
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.7+, 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 |
66a674552e7fb4a1bd97ca280a7786e83242626fccda213e092fb5345d200faf
|
|
| MD5 |
38d46ca98e4630be674d68c30cf0b1d2
|
|
| BLAKE2b-256 |
7a1db181ff492afdd3186862537e03de947a37354dc42ae85294d392c950c103
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
66a674552e7fb4a1bd97ca280a7786e83242626fccda213e092fb5345d200faf - Sigstore transparency entry: 1454907951
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.7+, 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 |
febb3583741f439ed48a8b0a2105a60acd90c540741f6e71ceaa70e5ed3db8dd
|
|
| MD5 |
7da99449853ae7e8455be2b7cf947d5b
|
|
| BLAKE2b-256 |
bdec51f3af26b531120fd6af1dc81e97aefc801194f127e017743396e26c03e1
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
febb3583741f439ed48a8b0a2105a60acd90c540741f6e71ceaa70e5ed3db8dd - Sigstore transparency entry: 1454908293
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_langgraph-0.1.15-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fast_langgraph-0.1.15-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.7+, 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 |
d9c3ee8363e4ca5945b9821fcf235301f183eddaf2631dafbe449a071b21a91e
|
|
| MD5 |
ad9ea689abeaa1b5c333c50ea3c92f95
|
|
| BLAKE2b-256 |
a78a99e603da931824d8f4f4eae353b43e7de4c6b65fec061d887d714f3082f4
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15-cp37-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15-cp37-abi3-macosx_11_0_arm64.whl -
Subject digest:
d9c3ee8363e4ca5945b9821fcf235301f183eddaf2631dafbe449a071b21a91e - Sigstore transparency entry: 1454908435
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_langgraph-0.1.15-cp37-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: fast_langgraph-0.1.15-cp37-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.7+, 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 |
92bc11cbb5f7c4ce43312cb36e92d420032866bd9e62cde29710b9a3c9e21f62
|
|
| MD5 |
6e334bcacbbbb63fbbf27b257c5143b1
|
|
| BLAKE2b-256 |
9121b9b1ed50b65dc1788d987a46b6087098a92836c8e586cd723fc0f16e4150
|
Provenance
The following attestation bundles were made for fast_langgraph-0.1.15-cp37-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on neul-labs/fast-langgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_langgraph-0.1.15-cp37-abi3-macosx_10_12_x86_64.whl -
Subject digest:
92bc11cbb5f7c4ce43312cb36e92d420032866bd9e62cde29710b9a3c9e21f62 - Sigstore transparency entry: 1454908613
- Sigstore integration time:
-
Permalink:
neul-labs/fast-langgraph@c9c4377751d2e3621269f3033f57dd598fa094ce -
Branch / Tag:
refs/tags/v0.1.15 - Owner: https://github.com/neul-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9c4377751d2e3621269f3033f57dd598fa094ce -
Trigger Event:
push
-
Statement type: