Agentic AI Notebook
LangGraph
Phase 10Module 9 of 12

Time Travel & Replay

Graphs fail in the middle. Time travel lets you see the state at that node, patch a field, and replay — the production debugger.

CCTV plus a rewind button. You do not rebuild the store. You scrub to 14:02 and watch the door.

Visual Workflows

Start here — scroll inside each diagram frame to explore, then use + / to zoom up to 200% if needed.

Overview

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Debug a bad route

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

If classify tagged tech instead of billing, fork from that checkpoint with the right label and replay.

What you do not time-travel

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Do not rewind a refund that already hit the bank. Time travel is for state, not for undoing the world.

Key Takeaways

  • 1.Time travel reads checkpoint history for a thread: every super-step is a frame you can inspect. get_state shows now. get_state_history lists the past. update_state writes a fork and continues from there.
  • 2.This is how you debug 'why did it refund' without re-running the whole ticket from scratch. It is not git. It is an audit log of state. Treat it as sensitive — it contains user messages.
  • 3.graph.get_state(config) returns the current snapshot. get_state_history(config) walks checkpoints. update_state(config, values, as_node=...) creates a new checkpoint as if that node had returned those values. Replay by invoking with the checkpoint's id.
  • 4.Needs the same checkpointer you used to run.

Learn elsewhere

  • Checkpoints
  • Eval engineering — Phase 19

Real Example

Scenario

Thread ticket-4411 classified as tech. You inspect history, set ticket_type to billing, resume. The billing subgraph runs. The user is still on the same ticket id.

What you would do

In the last module you will print get_state after a pause. Get used to reading the snapshot before you ever fork production threads.

Commands

Commands to Remember

  • graph.get_state(config) # now
  • graph.get_state_history(config) # frames
  • graph.update_state(config, values) # fork
  • Do not rewind side effects that already happened

Cheat Sheet

Quick recap

quick ref
  • History is checkpoints
  • get_state / history
  • update_state forks
  • Not an undo for money

Common Mistakes

  • Trying time travel without a checkpointer
  • Forking production threads as a habit instead of fixing the route function
  • Logging full history (PII) to a shared Slack channel