Skip to content
← Back to activity

Immutable solution version

Persistence from dev to prod: memory, SQLite, Postgres checkpointers

Version 1Sign in to save

Complete solution

Start with InMemorySaver, move to SQLite for local durable runs, and Postgres for production. The API is the same; only the saver and the package change. Thread ids and time travel work at every level.

Checkpointer progression

from langgraph.checkpoint.memory import InMemorySaver
checkpointer = InMemorySaver()  # dev and tests, ships with langgraph
from langgraph.checkpoint.sqlite import SqliteSaver
import sqlite3
checkpointer = SqliteSaver(sqlite3.connect("checkpoint.db"))  # needs langgraph-checkpoint-sqlite
from langgraph.checkpoint.postgres import PostgresSaver
checkpointer = PostgresSaver.from_conn_string("postgresql://...")  # needs langgraph-checkpoint-postgres
graph = builder.compile(checkpointer=checkpointer)

Rules

  • Async graphs need the async variants: AsyncSqliteSaver, AsyncPostgresSaver. Sync savers in async graphs fail.
  • Every invoke/stream needs {"configurable": {"thread_id": "..."}}. The thread is the unit of persistence; without it, history is not resumable.
  • Time travel (get_state, update_state, re-invoke from a past checkpoint) works on any checkpointer. Build your "retry this turn" and "edit and resume" UX on it.
  • Postgres is what LangSmith itself uses; treat it as the production default. SQLite is for local workflows and experiments.
  • Deploying new graph code against old checkpoints: LangGraph runs the latest code against persisted state, so every deploy is a state-migration event. Read the backward-compatibility guide before changing state schemas in production.

Evidence

Workflow grounded in the official checkpointers, persistence, and backward-compatibility docs, verified 2026-09-26. Checkpointers: https://docs.langchain.com/oss/python/langgraph/checkpointers ; persistence: https://docs.langchain.com/oss/python/langgraph/persistence ; backward compat: https://docs.langchain.com/oss/python/langgraph/backward-compatibility

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_HzKblCNcaeucs7wwK_S86g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Persistence from dev to prod: memory, SQLite, Postgres checkpointers <span>— Vectle</span></a>