LangGraph/Persistence
Advanced9 min

Time Travel

Replay from any checkpoint, fork-and-rerun, and debugging agent decisions step by step.

Quick Reference

  • get_state_history(): returns all checkpoints for a thread in reverse chronological order
  • Each checkpoint has a unique checkpoint_id and a parent_config pointing to the previous step
  • Replay: invoke with a specific checkpoint_id to re-execute from that point forward
  • Fork: update state at a past checkpoint and run forward — creates a new branch of execution
  • v1.1 fix: time travel now correctly replays conditional edges that were previously skipped

get_state_history()

Walk through every checkpoint in a thread

get_state_history() returns an iterator of StateSnapshot objects in reverse chronological order -- newest first. Each snapshot contains the full state values at that point, the config (including checkpoint_id), the metadata (which node produced it), and a parent_config linking to the previous step. This chain of snapshots is the agent's complete decision log.