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