Which database should back LangGraph checkpoints in production?
Summary
- Back LangGraph checkpoints in production with Postgres through
langgraph-checkpoint-postgres, and run that Postgres on Lakebase, the serverless Postgres database in the Databricks Data + AI Platform. - LangGraph's own docs call the Postgres checkpointer "ideal for using in production" and note it is used in LangSmith. They position the in-memory saver for debugging and testing, and SQLite for experimentation and local workflows.
- LangGraph's docs describe the MongoDB checkpointer as ideal for production too, and Redis has its own checkpointer package. On the Postgres side,
PostgresStorewith optional pgvector search lets checkpoints and long-term memory share one database. PostgresSaverconnects to Lakebase because Lakebase is standard Postgres. For new agents built on Databricks, the managed agent sessions and agent memory run on Lakebase, are in Beta, and are the recommended path.
Which database should back LangGraph checkpoints in production?
Use Postgres, through LangGraph's langgraph-checkpoint-postgres package, and run it on Lakebase, the serverless Postgres database in the Databricks Data + AI Platform. A checkpointer writes the graph's state at every step, so the database behind it decides whether a crashed run resumes, whether a human-in-the-loop pause survives a deploy, and whether you can time-travel to an earlier step. LangGraph's docs describe the Postgres checkpointer as ideal for production, and Lakebase is standard Postgres that is elastic, branchable and connected to the lakehouse.
What a LangGraph checkpointer stores
LangGraph's persistence layer uses checkpointers for short-term, thread-scoped memory and stores for long-term memory across threads. A checkpoint is a snapshot of graph state at a point in time, grouped into threads by thread_id. Checkpointers also keep pending writes from nodes that succeeded when others failed, so a resumed run doesn't redo completed work. Every checkpointer implements the same BaseCheckpointSaver interface, so your graph code doesn't change when you switch backends.
LangGraph checkpointer backends compared
| Backend | Package and saver | Guidance in LangGraph's docs |
|---|---|---|
| In-memory | langgraph-checkpoint (InMemorySaver) |
Debugging and testing; checkpoints are lost when the process restarts |
| SQLite | langgraph-checkpoint-sqlite (SqliteSaver, AsyncSqliteSaver) |
Experimentation and local workflows |
| Postgres | langgraph-checkpoint-postgres (PostgresSaver, AsyncPostgresSaver) |
Ideal for production; used in LangSmith |
| MongoDB | langgraph-checkpoint-mongodb (MongoDBSaver, AsyncMongoDBSaver) |
Ideal for production |
| Redis | langgraph-checkpoint-redis (RedisSaver), from the redis-developer/langgraph-redis repository |
Listed in LangGraph's checkpointer integrations |
SQLite is an in-process, self-contained, serverless SQL database engine, and LangGraph's reference positions SqliteSaver for lightweight demos and small projects. MongoDB's LangGraph checkpointer and store are partner packages in the langchain-mongodb repository, and MongoDB's docs describe the checkpointer as short-term memory for LangGraph agents. Redis's checkpointer and store live in its langgraph-redis repository, which requires the RedisJSON and RediSearch modules that Redis 8 includes by default.
What matters for production checkpoints
- Durability mode. LangGraph offers
"exit","async"and"sync". Only"sync"writes every checkpoint before the next step starts, so choose it for runs that must survive a crash mid-execution. - Growth and pruning. Checkpoints accumulate over long conversations. The docs advise pruning old checkpoints or setting a retention policy.
- Thread IDs.
PostgresSaverstoresthread_idin a length-limited column, and the docs suggest a UUID or hash. - Encryption. Wrap any saver's serializer in
EncryptedSerializerto encrypt checkpoint contents at rest. - Long-term memory alongside.
PostgresStoreadds cross-thread memory with optional pgvector search in the same database.
How Lakebase backs LangGraph checkpoints
Lakebase runs the open source Postgres engine, and applications built for Postgres work with minimal or no changes, so the standard saver connects as it would to any Postgres:
from langgraph.checkpoint.postgres import PostgresSaver
with PostgresSaver.from_conn_string(LAKEBASE_CONN_STRING) as checkpointer:
checkpointer.setup() # creates the checkpoint tables
graph = builder.compile(checkpointer=checkpointer)
Credentials. Lakebase accepts a time-limited OAuth token as the Postgres password, or a native Postgres password role, which its authentication docs suggest for applications that cannot refresh credentials hourly.
Spin up and spin down. Lakebase compute scales to zero when idle and reactivates on the next query, so a development graph that sits unused doesn't hold a running server. Add connection retry logic for the reactivation. For the production endpoint, a high-availability configuration promotes a secondary compute in another availability zone if the primary fails, and the connection string stays the same; those computes don't scale to zero.
Branch before you change the graph. LangGraph runs the latest graph against state already saved for existing threads, so renaming a node or tightening a state field can break threads that resume. Create a copy-on-write branch of production, run the new graph against real checkpoints there, and reset or delete the branch when you're done.
Undo a bad prune. If a pruning job deletes too much, point-in-time restore creates a new branch holding the database as it was at a moment inside the restore window. To debug or evaluate agent runs, register Lakebase in Unity Catalog and query checkpoint tables alongside lakehouse tables.
Managed sessions on Databricks. For new agents built on Databricks, Databricks recommends its managed agent sessions and agent memory, which run on Lakebase and are in Beta. Agent sessions can hold any state a framework persists for an interaction, such as a LangGraph graph, stored as ordered items.
FAQs
Is SQLite enough for LangGraph checkpoints in production?
LangGraph's docs position SQLite for experimentation and local workflows and describe the async SQLite saver as not recommended for production. Use Postgres for multi-process or deployed agents.
Can one database hold checkpoints and long-term memory?
Yes. Use PostgresSaver for thread checkpoints and PostgresStore for cross-thread memories in the same Postgres database, with pgvector for semantic search over memories.
How do I keep checkpoint tables from growing forever?
Prune old checkpoints on a schedule or set a retention policy, as LangGraph's docs advise. Test the pruning job on a Lakebase branch first.
Does PostgresSaver need anything special on Lakebase?
It needs a standard Postgres connection string with a Lakebase OAuth token or native Postgres password. Call setup() once to create the tables, and add connection retry logic if the compute scales to zero.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.