Skip to main content
A checkpoint is a saved snapshot of a LangGraph agent’s state. Time travel lets you inspect a checkpoint and continue execution from that saved state to explore alternative paths.
This feature requires the LangGraph Agent Server. Run your agent locally with langgraph dev or deploy it to LangSmith to use this pattern.

How checkpoints work

LangGraph persists agent state at super-step boundaries. Nodes that run in parallel in the same super-step share a checkpoint boundary. Each persisted state is a ThreadState object that captures:
  • checkpoint: The checkpoint identifier, including its ID and namespace.
  • created_at: The snapshot creation time.
  • parent_checkpoint: The previous checkpoint in this path.
  • values: The full agent state at this point (messages, custom keys).
  • tasks: The graph nodes that were scheduled to run next.
  • next: The names of upcoming nodes in the execution plan.
History can contain multiple execution paths, not one linear conversation. getHistory() returns checkpoints newest first, with a default limit of 10. Use parent_checkpoint to follow ancestry rather than treating adjacent entries as parent and child. The examples below display the returned page of history.

Setting up useStream

Create the stream for your agent, then fetch checkpoint history explicitly from the LangGraph client for the active thread. Resuming from a checkpoint uses forkFrom: checkpointId.
The code examples use useStream<typeof myAgent> for type-safe stream state. See Type inference for Python or JavaScript backends.

Building a checkpoint timeline

The timeline sidebar shows every checkpoint as a clickable entry. Each entry displays the scheduled nodes and how many messages existed at that point. tasks describes work for the next step, not the nodes that produced the checkpoint. Use next to label all scheduled nodes, including parallel work:

Inspecting checkpoint state

Clicking a checkpoint should show the full state at that point. A JSON viewer gives developers complete visibility into what the agent knew and decided:
For production UIs, consider using a proper JSON viewer component with collapsible nodes instead of raw JSON.stringify. Libraries like react-json-view or react-json-tree give users a much better exploration experience.

Resuming from a checkpoint

The core of time travel is the ability to resume execution from any prior checkpoint. When a user selects a checkpoint, call submit with undefined input and pass the checkpoint ID as forkFrom:
The SDK sends undefined or null input as null, which continues from the selected checkpoint without supplying new input. An empty object ({}) is new input, not the same continuation signal. If the checkpoint has no next nodes, there is no pending work to replay. The new run creates another path in the same thread. The UI displays that path; the original checkpoints remain available in history.
Replaying a checkpoint can execute downstream tools and API calls again. It does not reverse earlier external effects, such as sent messages or database writes. Check those effects before replaying a run.

The SplitView layout

Time travel works best with a split layout, with the main chat on the left and the timeline on the right:

Extracting checkpoint metadata

Transform raw checkpoint data into display-friendly entries for your timeline:
This makes it easy to render timeline entries with meaningful labels instead of raw IDs.

Use cases

Time travel is invaluable across many scenarios:
  • Debugging agent behavior: step through the agent’s decisions to understand why it chose a particular path
  • Trying another path: continue from an earlier saved state without deleting the original checkpoints
  • Exploring alternatives: fork from a mid-conversation checkpoint to see how different inputs change the outcome
  • Auditing: review the complete history of an agent’s actions for compliance, quality assurance, or post-incident analysis
  • Teaching: walk through an agent’s execution step by step to explain how multi-step reasoning works
Time travel is especially powerful when combined with human-in-the-loop patterns. If a human reviewer rejects an agent’s action at an interrupt, they can resume from the checkpoint before the action was taken and provide corrective input.

Handling interrupts in the timeline

Checkpoints that contain interrupts (human-in-the-loop pauses) deserve special visual treatment. They represent moments where the agent stopped and waited for human input:

Best practices

  • Load history lazily: for threads with hundreds of checkpoints, paginate or load only the most recent N entries to keep the UI responsive.
  • Show meaningful labels: display scheduled next nodes and message counts instead of raw checkpoint IDs. Users need context, not UUIDs.
  • Confirm before resuming: show a confirmation dialog before starting another path, especially when downstream nodes have external effects.
  • Highlight the current checkpoint: make it visually obvious which checkpoint corresponds to the current state of the conversation.
  • Support keyboard navigation: power users will want to step through checkpoints with arrow keys. Add keyboard handlers to the timeline for a smooth debugging experience.
  • Diff state between checkpoints: for advanced users, showing what changed between two consecutive checkpoints can reveal exactly how the agent’s state evolved at each step.