Time Travel with LangGraph: Rewind and Re-execute Checkpointed State
Advanced · 30 minutes · 4 tasks, checked automatically · 100 points
In this advanced lab you will build a multi-step LangGraph pipeline that persists every execution step to an in-memory checkpointer. You will then use LangGraph's time-travel API to list historical checkpoints, rewind the graph to an earlier state snapshot, mutate that snapshot, and re-execute the graph from that point forward — all without re-running steps that do not need to change. This is the foundational pattern for debugging, branching, and human-in-the-loop correction in production agent systems.
What you’ll learn
- Install LangGraph and its dependencies inside the toolbox container
- Build a three-node StateGraph that accumulates a running log and persists every step via MemorySaver
- Use get_state_history to enumerate all checkpoints for a completed run
- Rewind the graph to the checkpoint produced after the first node, patch the state, and re-execute the remaining nodes to produce a new divergent history
How this lab works
- Start the lab: One click starts a sandbox with a local model and the agent’s toolbox: no API key and no token bill.
- Work through 4 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work inspects the agent, its config and its output, and says what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Runs: Locally, against a model on your computer: no API key, no tokens
- Model: qwen2.5:3b
- Open source: github.com/langchain-ai/langgraph
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop (or Podman / Rancher Desktop) installed and running
- A model sandbox started in the Agent Playground
Topics: langgraph, time-travel, checkpointing, MemorySaver, get_state_history, update_state, state-management, agents, ollama, qwen2.5
Create a free account to start this lab.
Keep going
- Compose Subgraphs: Parent Graph Orchestrating a Self-Contained Child Graph
- Wire an MCP Server into an Agent Loop with a Local Model
- Human-in-the-Loop LangGraph: Interrupt, Approve, and Resume
- Install, Inspect, and Disable an OpenClaw Plugin from ClawHub
- OpenClaw Message Queue Channel: Agent-Powered Request/Reply
- Shape Agent Behaviour with SOUL.md, USER.md and AGENTS.md