Hello @Wonder-donbury, welcome to Langchain community
Great suggestion, and this is a real need for on-prem deployments. Here’s what already exists and how to proceed today:
1. The BaseCheckpointSaver interface is your entry point
All checkpointers conform to BaseCheckpointSaver from langgraph-checkpoint. You need to implement four core async methods:
| Method |
Purpose |
aput |
Store a checkpoint |
aput_writes |
Store pending node writes |
aget_tuple |
Fetch a checkpoint by config |
alist |
List checkpoints by config/filter |
For deploying behind LangSmith Agent Server, you also need adelete_thread, and optionally adelete_for_runs, acopy_thread, and aprune for extended capabilities.
Reference: Persistence — Checkpointer interface
2. There is an official “how to use a custom checkpointer” guide
The guide covers defining an async context manager that yields your BaseCheckpointSaver, wiring it into langgraph.json, and validating it against the conformance suite:
Reference: How to use a custom checkpointer (LangSmith deployment)
3. Validate against the conformance suite before deploying
pip install langgraph-checkpoint-conformance
from langgraph.checkpoint.conformance import checkpointer_test, validate
@checkpointer_test(name="MyCheckpointer")
async def my_checkpointer():
async with MyCheckpointer(...) as saver:
yield saver
report = await validate(my_checkpointer)
report.print_report()
assert report.passed_all_base()
This suite auto-detects which extended capabilities your implementation provides and confirms it is compatible with Agent Server.
4. Reference the Postgres source as a model implementation
The Postgres checkpointer (langgraph-checkpoint-postgres) is the production reference. Studying PostgresSaver / AsyncPostgresSaver is the fastest way to understand the full contract, the put, put_writes, get_tuple, and list implementations map 1:1 to any SQL-backed store (including SQLAlchemy-wrapped DBs).
- Installed packages:
libs/checkpoint-postgres/ in the LangGraph repo
- Reference: Checkpoint packages
5. For SQLite as a local/dev pattern, use SqliteSaver as a simpler reference
langgraph-checkpoint-sqlite is a lighter reference for writing a SQL-based checkpointer with minimal complexity, good starting point before scaling to your target DB.
Summary for on-prem / custom DB scenarios:
- Subclass
BaseCheckpointSaver and implement the four required async methods using your ORM/DB driver of choice.
- Wrap it in an
asynccontextmanager that handles connection lifecycle.
- Validate with
langgraph-checkpoint-conformance.
- Point
langgraph.json → checkpointer.path to your context manager.
The conformance suite and the custom checkpointer guide address most of the gaps you’ve described. The ask for a more narrative how-to guide specifically walking through an ORM/SQLAlchemy-based implementation is a valid gap worth filing as a docs issue on the GitHub - langchain-ai/docs: Unified LangChain documentation. · GitHub