Skip to main content

LangGraph LMDB Checkpointer

A high-performance, local checkpoint saver for LangGraph using LMDB (Lightning Memory-Mapped Database).

🚀 Why LMDB?

LMDB is a transactional, memory-mapped key-value store. It is incredibly fast because it uses the operating system's memory-map (mmap) to provide zero-copy reads and highly efficient writes. For LangGraph, where state persistence can become a bottleneck during complex agentic loops, LMDB offers a near-memory speed with full persistence.

🏢 When to Use?

  • High-Performance Local Agents: When running agents on a single machine or edge device where network latency to a database (like Postgres) is unacceptable.
  • Embedded Applications: Desktop or mobile apps that need a self-contained, lightweight, and zero-configuration database.
  • Development & Prototyping: Fast startup and easy portability of checkpoints during the R&D phase.

🏆 Where it Excels

  • Read Latency: Since it maps the database file directly into memory, reading a checkpoint is essentially a memory access.
  • Reliability (ACID): Fully ACID compliant with a crash-proof design. If the power fails, your checkpoints stay consistent.
  • Multi-Process/Multi-Thread: Highly concurrent reads without blocking, making it perfect for multi-agent workflows.

Features

  • Blazing Fast Local Storage: Optimized for high-frequency writes and low-latency state retrieval.
  • Binary Key Strategy: Uses a compact binary key layout (thread_id\x00checkpoint_ns\x00checkpoint_id) for efficient multi-index prefix scanning.
  • Flexible Serialization: Supports both msgpack (default) and orjson for high-speed state encoding.
  • Async & Sync Support: Provides both thread-safe synchronous (LMDBSaver) and non-blocking asynchronous (AsyncLMDBSaver) implementations.

Installation

pip install langgraph-checkpoint-lmdb

Quick Start

import lmdb
from langgraph_checkpoint_lmdb import LMDBSaver
from langgraph.graph import StateGraph

# Initialize LMDB environment
env = lmdb.open("./checkpoints", max_dbs=10)
saver = LMDBSaver(env)

# Use in your LangGraph as a checkpointer
graph = builder.compile(checkpointer=saver)

Real-World Examples

  • Customer Support Bot: See examples/customer_support.py for a complete implementation of a multi-turn support agent with state persistence.
  • Interactive Chatbot: See examples/chatbot.py for a simple interactive CLI chatbot that remembers your name across sessions.

Performance

Benchmarks conducted on local hardware comparing LMDBSaver with the default MemorySaver.

Scenario MemorySaver LMDBSaver 🏆 Winner
Sequential Writes (1K) 30,914 ops/s 19,619 ops/s MemorySaver
Concurrent Writes (15T×200) 33,947 ops/s 8,523 ops/s MemorySaver
History Query (list 100) 52,672 ops/s 45,319 ops/s MemorySaver

Development

Run Tests

pytest

Run Benchmarks

python benchmark.py

License

MIT License. See LICENSE for details.

Metadata

Release files for langgraph-checkpoint-lmdb 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph-checkpoint-lmdb 0.3.1
File Size Uploaded
langgraph_checkpoint_lmdb-0.3.1.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-checkpoint-lmdb 0.3.1
File Interpreter ABI Platform
langgraph_checkpoint_lmdb-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / langgraph_checkpoint_lmdb-0.3.1.tar.gz

Download URL langgraph_checkpoint_lmdb-0.3.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ac4062e80f9823b6152d7615ad4ac02defe49b38ba21156b8d019b250f751daf
BLAKE2b-256 checksum
How to use checksums
c1a6cec81b519134eb296a0c38b00376d2d5f3fa6e2603a55bae991b73e17b9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / langgraph_checkpoint_lmdb-0.3.1-py3-none-any.whl

Download URL langgraph_checkpoint_lmdb-0.3.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
700fd7586b7f676e7dd84a9bb6a3dcbcc04941bf81c74d5d1a4f54eeafd9b63d
BLAKE2b-256 checksum
How to use checksums
8bad48a4a7767d8e15c7d7e3a95a536f3b318724764ec879d8fe8fd36eacf250
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page