Skip to main content
LangGraph provides the time travel functionality to resume execution from a prior checkpoint, either replaying the same state or modifying it to explore alternatives. In all cases, resuming past execution produces a new fork in the history. To time travel using the LangSmith Deployment API (via the LangGraph SDK):
  1. Run the graph with initial inputs using LangGraph SDK’s client.runs.wait or client.runs.stream APIs.
  2. Identify a checkpoint in an existing thread: Use client.threads.get_history method to retrieve the execution history for a specific thread_id and locate the desired checkpoint_id. Alternatively, set a breakpoint before the node(s) where you want execution to pause. You can then find the most recent checkpoint recorded up to that breakpoint.
  3. (Optional) modify the graph state: Use the client.threads.update_state method to modify the graph’s state at the checkpoint and resume execution from alternative state.
  4. Resume execution from the checkpoint: Use the client.runs.wait or client.runs.stream APIs with an input of None and the appropriate thread_id and checkpoint_id.

Use time travel in a workflow

1. Run the graph

2. Identify a checkpoint

3. Update the state

update_state will create a new checkpoint. The new checkpoint will be associated with the same thread, but a new checkpoint ID.

4. Resume execution from the checkpoint

Learn more