Time-Travel
Debugging & Replay LangGraph-inspiredReplay agent execution from any checkpoint, modify state, and re-run from that point to explore alternative paths and debug issues.
Overview
The Time-Travel Agent implements execution replay capabilities inspired by LangGraph's time-travel debugging. It enables:
- Execution Replay: Step through past agent runs
- State Modification: Change variables at any checkpoint
- Branch Exploration: Fork from checkpoint with different inputs
- Comparative Analysis: Compare outcomes of different paths
- Root Cause Discovery: Trace issues back to originating state
Timeline Visualization
PAST ◀════════════════════════════════════════════▶ PRESENT
┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐
│ CP1 │──▶│ CP2 │──▶│ CP3 │──▶│ CP4 │──▶│ CP5 │
└─────┘ └─────┘ └──┬──┘ └─────┘ └─────┘
│
│ [MODIFY STATE]
▼
┌─────┐ ┌─────┐ ┌─────┐
│CP3' │──▶│CP4' │──▶│CP5' │
└─────┘ └─────┘ └─────┘
(Branch) (New) (New)
Commands
/timetravel list
/timetravel list Execution Timeline: wf_conductor_auth Total Checkpoints: 12 | Duration: 45 min Step | Checkpoint | Agent | Action | Time -----|------------|-----------|------------------|------- 1 | cp_001 | architect | design_start | 20:00 2 | cp_002 | architect | design_complete | 20:15 3 | cp_003 | auto-code | impl_start | 20:16 4 | cp_004 | auto-code | impl_50% | 20:25 5 | cp_005 | auto-code | impl_complete | 20:35 ← ERROR ...
/timetravel goto
/timetravel goto cp_004 Jumped to cp_004 Agent: auto-code Action: Implementation 50% complete Timestamp: 20:25 (20 min ago) State at this point: - Files created: 2 (/src/auth/jwt.ts, /src/auth/types.ts) - Tests: 0 - Decisions: JWT, bcrypt, refresh tokens Available: replay | modify | inspect | compare
/timetravel modify
/timetravel modify cp_004 > Change decision from JWT to Sessions Branch Created: br_002 Original: decisions.auth_method = "JWT" Modified: decisions.auth_method = "Sessions" Replaying from cp_004 with Sessions auth... [New execution with modified state]
/timetravel compare
/timetravel compare cp_012 br_002_cp_012 Comparison: Original vs Sessions Branch Aspect | Original (JWT) | Branch (Sessions) -------------|----------------|------------------ Status | ✓ Complete | ✓ Complete Duration | 45 min | 52 min Files | 8 | 10 Tests | 6 pass | 8 pass Coverage | 85% | 92%
Use Cases
- Debugging Failed Execution: Jump to just before failure, inspect state, identify cause
- Exploring Alternatives: "What if we had chosen OAuth instead of JWT?"
- Understanding Decisions: Trace back through checkpoint history to see why choices were made
- A/B Testing Approaches: Run same task with different strategies, compare outcomes
Integration Points
| System | Integration |
|---|---|
| Checkpoint | Uses checkpoints as replay starting points |
| Episode | Records full execution context for replay |
| Memory | Stores timeline and branch data |
| Tracing | Visualizes execution paths |