By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Without a checkpointer, a graph run exists only in memory and disappears when invoke() returns. With one, the runtime saves a snapshot after every superstep, keyed by a `thread_id` you pass in the run config. That single feature enables everything the rest of the path relies on: resume after a crash, human-in-the-loop pauses, inspection of a finished run, and time travel back to an earlier checkpoint.
langgraph-checkpoint-sqlite, langgraph-checkpoint-postgres) persist across restarts and are what a customer-facing approval workflow needs.thread_id, same conversation and state; a different thread is an independent run.from typing import TypedDict
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import END, START, StateGraph
class TicketState(TypedDict):
ticket_id: str
step: int
def classify(state: TicketState) -> dict:
return {"step": state["step"] + 1}
def reply(state: TicketState) -> dict:
return {"step": state["step"] + 1}
builder = StateGraph(TicketState)
builder.add_node("classify", classify)
builder.add_node("reply", reply)
builder.add_edge(START, "classify")
builder.add_edge("classify", "reply")
builder.add_edge("reply", END)
graph = builder.compile(checkpointer=InMemorySaver())
config = {"configurable": {"thread_id": "ticket-4521"}}
graph.invoke({"ticket_id": "4521", "step": 0}, config)
current = graph.get_state(config)
history = list(graph.get_state_history(config))
print(current.values)
print(current.next)
print(len(history) > 1)
print(history[0].values["step"])checkpoint_id that time travel needs.input, loop, update) and the writes that produced this checkpoint.Because checkpoints form a history, you can replay from any of them. Find the snapshot you want with get_state_history, then resume the graph with that snapshot's full config and no new input: graph.invoke(None, snapshot.config). That re-runs the nodes scheduled after the checkpoint, under the same thread_id. To branch instead of replay, call graph.update_state(...) on the snapshot's config first, then resume — this forks a new history from the edited point without rewriting the original.
# Structural example: assumes the checkpointed graph and `config` from above.
for snapshot in graph.get_state_history(config):
checkpoint_id = snapshot.config["configurable"]["checkpoint_id"]
print(snapshot.metadata.get("step"), snapshot.next, checkpoint_id)
# Replay from the first snapshot of the thread (the original input).
oldest = list(graph.get_state_history(config))[-1]
graph.invoke(None, oldest.config)
# Fork from that point instead: edit the state, then continue.
graph.update_state(oldest.config, {"step": 10})
graph.invoke(None, oldest.config)The config decides which conversation a run belongs to. In a support system, one ticket gets one thread_id — usually a stable id such as ticket-4521, never a random value per request, or the agent will forget everything between turns. Never share a thread id between customers: the state contains the previous customer's messages and tool results. Plan for retention too: checkpoints accumulate, so delete or expire finished threads according to your privacy policy.
Key takeaways
A checkpointer saves state after every superstep, keyed by the config's thread_id.
get_state returns the latest values and next nodes; get_state_history walks every checkpoint.
invoke(None, snapshot.config) replays from a checkpoint; update_state forks the history from that point.
One thread per conversation, never shared between customers, and a database saver for production.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.