State History
Every checkpoint.
A checkpointer doesn't just keep the latest state. It keeps a checkpoint after every step. Get state history lets you walk back through all of them, newest first.

- Every step saved
- Not just the latest
- Walk back through them
Walking the history
We run the three step order pipeline. Get state history returns every checkpoint. For each one, we print the step number, what would run next, and the total at that moment. Run it. Reading from the bottom up, we see the input arrive, then clean, price, and receipt run, one by one.
from order_graph import graph
config = {"configurable": {"thread_id": "order-3"}}
graph.invoke({"title": "dune", "quantity": 2}, config)
for snap in graph.get_state_history(config):
step = snap.metadata["step"]
print(f"step {step:>2} next={snap.next} total={snap.values.get('total')}")step 3 next=() total=19.98
step 2 next=('receipt',) total=19.98
step 1 next=('price',) total=None
step 0 next=('clean',) total=None
step -1 next=('__start__',) total=NoneAlso uses order_graph.py
from typing import TypedDict
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import StateGraph, START, END
PRICES = {"Dune": 9.99, "Circe": 10.99}
class Order(TypedDict):
title: str
quantity: int
total: float
receipt: str
def clean(s):
return {"title": s["title"].strip().title()}
def price(s):
return {"total": round(PRICES[s["title"]] * s["quantity"], 2)}
def receipt(s):
return {"receipt": f"{s['quantity']} x {s['title']} = £{s['total']}"}
b = StateGraph(Order)
b.add_sequence([clean, price, receipt])
b.add_edge(START, "clean"); b.add_edge("receipt", END)
graph = b.compile(checkpointer=InMemorySaver())Why history matters
History shows exactly how a result came about, step by step, which is gold for debugging. And every checkpoint has its own config, so you can go back to it, and run again from there. That's time travel, coming next.
| key | value |
|---|---|
| Debug | see every step |
| Audit | how a result came about |
| Configs | one per checkpoint |
| Next | time travel |
Summary
Get state history lists every checkpoint of a thread, newest first. Each one can be revisited. Next, time travel.
Key takeaways- get_state_history
- Newest first
- A config per checkpoint