| name | langgraph-checkpoints |
| description | LangGraph checkpointing and persistence. Use when implementing fault-tolerant workflows, resuming interrupted executions, debugging with state history, or avoiding re-running expensive operations. |
| context | fork |
| agent | workflow-architect |
| version | 1.0.0 |
| author | SkillForge |
| user-invocable | false |
LangGraph Checkpointing
Persist workflow state for recovery and debugging.
Checkpointer Options
from langgraph.checkpoint import MemorySaver
from langgraph.checkpoint.sqlite import SqliteSaver
from langgraph.checkpoint.postgres import PostgresSaver
memory = MemorySaver()
app = workflow.compile(checkpointer=memory)
checkpointer = SqliteSaver.from_conn_string("checkpoints.db")
app = workflow.compile(checkpointer=checkpointer)
checkpointer = PostgresSaver.from_conn_string("postgresql://...")
app = workflow.compile(checkpointer=checkpointer)
Using Thread IDs
config = {"configurable": {"thread_id": "analysis-123"}}
result = app.invoke(initial_state, config=config)
config = {"configurable": {"thread_id": "analysis-123"}}
result = app.invoke(None, config=config)
PostgreSQL Setup
def create_checkpointer():
"""Create PostgreSQL checkpointer for production."""
return PostgresSaver.from_conn_string(
settings.DATABASE_URL,
save_every=1
)
app = workflow.compile(
checkpointer=create_checkpointer(),
interrupt_before=["quality_gate"]
)
Inspecting Checkpoints
checkpoints = app.get_state_history(config)
for checkpoint in checkpoints:
print(f"Step: {checkpoint.metadata['step']}")
print(f"Node: {checkpoint.metadata['source']}")
print(f"State: {checkpoint.values}")
current = app.get_state(config)
print(current.values)
Resuming After Crash
import logging
async def run_with_recovery(workflow_id: str, initial_state: dict):
"""Run workflow with automatic recovery."""
config = {"configurable": {"thread_id": workflow_id}}
try:
state = app.get_state(config)
if state.values:
logging.info(f"Resuming workflow {workflow_id}")
return app.invoke(None, config=config)
except Exception:
pass
logging.info(f"Starting new workflow {workflow_id}")
return app.invoke(initial_state, config=config)
Step-by-Step Debugging
for step in app.stream(initial_state, config):
print(f"After {step['node']}: {step['state']}")
input("Press Enter to continue...")
history = list(app.get_state_history(config))
previous_state = history[1]
app.update_state(config, previous_state.values)
Store vs Checkpointer (2026 Best Practice)
from langgraph.checkpoint.postgres import PostgresSaver
from langgraph.store.postgres import PostgresStore
checkpointer = PostgresSaver.from_conn_string(DATABASE_URL)
store = PostgresStore.from_conn_string(DATABASE_URL)
app = workflow.compile(
checkpointer=checkpointer,
store=store
)
Using Store for Cross-Thread Memory
from langgraph.store.base import BaseStore
async def agent_with_memory(state: AgentState, *, store: BaseStore):
"""Agent that remembers across conversations."""
user_id = state["user_id"]
memories = await store.aget(namespace=("users", user_id), key="preferences")
if memories and memories.value.get("prefers_concise"):
state["system_prompt"] += "\nBe concise in responses."
await store.aput(
namespace=("users", user_id),
key="last_topic",
value={"topic": state["current_topic"], "timestamp": datetime.now().isoformat()}
)
return state
workflow.add_node("agent", agent_with_memory)
Memory Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ User: alice โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Thread 1 (chat-001) โ Thread 2 (chat-002) โ
โ โโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโ โ
โ โ Checkpointer โ โ โ Checkpointer โ โ
โ โ - msg history โ โ โ - msg history โ โ
โ โ - workflow pos โ โ โ - workflow pos โ โ
โ โโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Store (cross-thread) โ
โ namespace=("users", "alice") โ
โ - preferences: {prefers_concise: true} โ
โ - last_topic: {topic: "langgraph", timestamp: "..."} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Decisions
| Decision | Recommendation |
|---|
| Development | MemorySaver (fast, no setup) |
| Production | PostgresSaver (shared, durable) |
| save_every | 1 for expensive nodes, 5 for cheap |
| Thread ID | Use deterministic ID (workflow_id) |
| Short-term memory | Checkpointer (thread-scoped) |
| Long-term memory | Store (cross-thread, namespaced) |
Common Mistakes
- No checkpointer in production (lose progress)
- Random thread IDs (can't resume)
- Not handling missing checkpoints
- Saving too frequently (overhead)
- Using only checkpointer for user preferences (lost across threads)
- Not using namespaces in Store (data collisions)
Related Skills
langgraph-state - State design for checkpointing
langgraph-human-in-loop - Interrupt patterns
database-schema-designer - PostgreSQL setup
Capability Details
checkpoint-saving
Keywords: save checkpoint, checkpoint, persist state, save state
Solves:
- Save workflow state at key points
- Implement checkpoint strategies
- Handle checkpoint serialization
checkpoint-loading
Keywords: load checkpoint, restore, resume, recovery
Solves:
- Resume workflows from checkpoints
- Implement state recovery
- Handle checkpoint versioning
memory-backends
Keywords: memory backend, MemorySaver, SqliteSaver, PostgresSaver
Solves:
- Configure checkpoint storage backends
- Choose between memory/SQLite/Postgres
- Implement custom checkpoint storage
async-checkpoints
Keywords: async checkpoint, AsyncSqliteSaver, async persistence
Solves:
- Implement async checkpoint operations
- Handle concurrent checkpoint access
- Optimize checkpoint performance
conversation-history
Keywords: conversation, history, message history, thread
Solves:
- Persist conversation history
- Implement thread-based checkpoints
- Manage conversation state