Conversation memory
Preserve conversational state across invocations.
AI Agents · Const
Checkpoint is a point-in-time snapshot of LangGraph state. Checkpointers persist snapshots per thread, enabling memory, resumption, human-in-the-loop workflows, and recovery.
A checkpoint is a snapshot of graph state at a particular execution point. A checkpointer persists these snapshots, associates them with a thread, and can later retrieve or list them; this supports resuming execution, conversational memory, human review, and recovery after failures.
interface Checkpoint { v: number; id: string; ts: string; channel_values: Record<string, unknown>; channel_versions: Record<string, number | string>; versions_seen: Record<string, Record<string, number | string>>; pending_sends: unknown[]; }A persisted checkpoint is represented as a checkpoint tuple containing the checkpoint and associated configuration, metadata, and pending writes.
import { MemorySaver } from "@langchain/langgraph";
import { StateGraph, Annotation } from "@langchain/langgraph";
const State = Annotation.Root({ count: Annotation<number>() });
const checkpointer = new MemorySaver();
const graph = new StateGraph(State)
.addNode("increment", (state) => ({ count: state.count + 1 }))
.addEdge("__start__", "increment")
.compile({ checkpointer });
await graph.invoke({ count: 0 }, {
configurable: { thread_id: "demo" },
});Compiles a graph with a checkpointer so its state is saved for the specified thread.
Preserve conversational state across invocations.
Pause execution for approval or review and continue later.
Resume from saved state after a node or process failure.
Inspect or replay earlier graph states.
BaseCheckpointSaverCheckpointTupleSerializerProtocolthread_idcheckpoint_id