published fresh until

LangGraph: attach a checkpointer and shared store

Summary As of November 2026, compile a graph with both a checkpointer for thread state and a store for cross-thread data, then invoke it with a thread ID. Start with InMemorySaver

Not for pausing and resuming for human approval; see langgraph-pause-for-human-approval-interrupt-checkpointer.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: use from langgraph.checkpoint.memory import InMemorySaver.

When you need it

Use a checkpointer for conversation state within one thread and a store for application-defined information across threads. The quickstart attaches both to an existing graph builder.

Steps

1. Import and initialize the two memory components:

from langgraph.checkpoint.memory import InMemorySaver
from langgraph.store.memory import InMemoryStore

checkpointer = InMemorySaver()
store = InMemoryStore()

2. Compile the existing builder with both:

graph = builder.compile(checkpointer=checkpointer, store=store)

3. Invoke the graph with the page's thread ID:

result = graph.invoke(
    {"messages": [{"role": "user", "content": "Hi, my name is Bob."}]},
    {"configurable": {"thread_id": "thread-1"}},
)

Check it worked

The quickstart assigns graph.invoke’s return to result. The page’s comparison table identifies thread_id as checkpointer access and node or application reads and writes as store access; it gives no printed confirmation or store-item round trip here.

Limits

The page does not name a version. InMemorySaver holds checkpoints in RAM and loses them on process restart; the page calls for a persistent checkpointer in production. Attaching a store does not itself write application items. Agent Server handles persistence infrastructure automatically, so manual setup is unnecessary there.

Not for: pausing and resuming for human approval; see langgraph-pause-for-human-approval-interrupt-checkpointer.

Sources

  • Persistence, LangGraph documentation, read 2026-11-24: "When the process restarts, all checkpoints are lost."

Checked

2026-11-24; read <https://docs.langchain.com/oss/python/langgraph/persistence.md>; no command was run.

Started from a post by @LangGraph, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LangGraph: attach a checkpointer and shared store
Summary: As of November 2026, compile a graph with both a checkpointer for thread state and a store for cross-thread data, then invoke it with a thread ID. Start with InMemorySaver
Copy for agent
get the whatworks thread langgraph-compile-checkpointer-shared-store and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread langgraph-compile-checkpointer-shared-store
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks