
Langgraph Persistence
Configure LangGraph checkpointers, thread_id conversations, Store memory, and subgraph persistence so agent graphs survive restarts and support time travel.
Overview
langgraph-persistence is an agent skill for the Build phase that configures LangGraph checkpointers, thread_id, Store, and subgraph persistence for durable agent state.
Install
npx skills add https://github.com/langchain-ai/langchain-skills --skill langgraph-persistenceWhat is this skill?
- Maps InMemorySaver, SqliteSaver, and PostgresSaver to dev vs production readiness
- Separates short-term checkpointer thread history from long-term cross-thread Store
- Covers thread_id checkpoint sequences, time travel, and subgraph checkpointer scoping
- Includes basic StateGraph + InMemorySaver setup pattern in Python
- Explicit invoke trigger when graphs must remember conversations or durable state
- Checkpointer table covers 3 saver types: InMemorySaver, SqliteSaver, PostgresSaver
- Documents 2 memory types: short-term checkpointer and long-term Store
Adoption & trust: 8.1k installs on skills.sh; 782 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Your LangGraph agent forgets conversation context on restart, cannot resume interrupted runs, or mixes checkpoints across users and subgraphs.
Who is it for?
Indie builders shipping LangGraph agents that need multi-turn memory, crash recovery, or production-grade Postgres checkpointing.
Skip if: Pure prompt-only chains with no LangGraph graph, or teams storing all memory in an external vector DB without graph checkpoints.
When should I use this skill?
INVOKE THIS SKILL when your LangGraph needs to persist state, remember conversations, travel through history, or configure subgraph checkpointer scoping.
What do I get? / Deliverables
You select and wire the right checkpointer and Store, assign thread_id per conversation, and scope subgraph persistence so state reloads and time travel work in dev and production.
- Graph compiled with appropriate checkpointer and thread_id usage
- Optional Store configuration for cross-thread preferences or facts
Recommended Skills
Journey fit
Persistence is core agent infrastructure you wire while building LangGraph apps, not a launch or growth marketing task. Checkpointers, threads, and Store are agent-runtime concerns, so agent-tooling is the canonical shelf ahead of generic backend CRUD.
How it compares
LangGraph-native persistence patterns, not generic Redis session snippets or unrelated ORM migrations.
Common Questions / FAQ
Who is langgraph-persistence for?
Developers building LangGraph StateGraph agents in Python who must persist checkpoints, separate threads, and optional cross-thread Store data.
When should I use langgraph-persistence?
During Build while implementing agent graphs; in Ship when hardening checkpoint storage before production; and in Operate when debugging stuck threads or replaying historical states.
Is langgraph-persistence safe to install?
The skill is documentation and code patterns—actual risk depends on database credentials and network exposure you configure; review the Security Audits panel on this page before connecting production Postgres.
SKILL.md
READMESKILL.md - Langgraph Persistence
<overview> LangGraph's persistence layer enables durable execution by checkpointing graph state: - **Checkpointer**: Saves/loads graph state at every super-step - **Thread ID**: Identifies separate checkpoint sequences (conversations) - **Store**: Cross-thread memory for user preferences, facts **Two memory types:** - **Short-term** (checkpointer): Thread-scoped conversation history - **Long-term** (store): Cross-thread user preferences, facts </overview> <checkpointer-selection> | Checkpointer | Use Case | Production Ready | |--------------|----------|------------------| | `InMemorySaver` | Testing, development | No | | `SqliteSaver` | Local development | Partial | | `PostgresSaver` | Production | Yes | </checkpointer-selection> --- ## Checkpointer Setup <ex-basic-persistence> <python> Set up a basic graph with in-memory checkpointing and thread-based state persistence. ```python from langgraph.checkpoint.memory import InMemorySaver from langgraph.graph import StateGraph, START, END from typing_extensions import TypedDict, Annotated import operator class State(TypedDict): messages: Annotated[list, operator.add] def add_message(state: State) -> dict: return {"messages": ["Bot response"]} checkpointer = InMemorySaver() graph = ( StateGraph(State) .add_node("respond", add_message) .add_edge(START, "respond") .add_edge("respond", END) .compile(checkpointer=checkpointer) # Pass at compile time ) # ALWAYS provide thread_id config = {"configurable": {"thread_id": "conversation-1"}} result1 = graph.invoke({"messages": ["Hello"]}, config) print(len(result1["messages"])) # 2 result2 = graph.invoke({"messages": ["How are you?"]}, config) print(len(result2["messages"])) # 4 (previous + new) ``` </python> <typescript> Set up a basic graph with in-memory checkpointing and thread-based state persistence. ```typescript import { MemorySaver, StateGraph, StateSchema, MessagesValue, START, END } from "@langchain/langgraph"; import { HumanMessage } from "@langchain/core/messages"; const State = new StateSchema({ messages: MessagesValue }); const addMessage = async (state: typeof State.State) => { return { messages: [{ role: "assistant", content: "Bot response" }] }; }; const checkpointer = new MemorySaver(); const graph = new StateGraph(State) .addNode("respond", addMessage) .addEdge(START, "respond") .addEdge("respond", END) .compile({ checkpointer }); // ALWAYS provide thread_id const config = { configurable: { thread_id: "conversation-1" } }; const result1 = await graph.invoke({ messages: [new HumanMessage("Hello")] }, config); console.log(result1.messages.length); // 2 const result2 = await graph.invoke({ messages: [new HumanMessage("How are you?")] }, config); console.log(result2.messages.length); // 4 (previous + new) ``` </typescript> </ex-basic-persistence> <ex-production-postgres> <python> Configure PostgreSQL-backed checkpointing for production deployments. ```python import os from langgraph.checkpoint.postgres import PostgresSaver # Run once during deployment (not at application startup): # PostgresSaver.from_conn_string(os.environ["DATABASE_URL"]).setup() with PostgresSaver.from_conn_string(os.environ["DATABASE_URL"]) as checkpointer: graph = builder.compile(checkpointer=checkpointer) ``` </python> <typescript> Configure PostgreSQL-backed checkpointing for production deployments. ```typescript import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres"; // Run once during deployment (not at application startup): // await PostgresSaver.fromConnString(process.env.DATABASE_URL!).setup(); const checkpointer = PostgresSaver.fromConnString(process.env.DATABASE_