Trajectory Replay
You have the full record of a bad agent run. The natural next move is to run it again and watch — but running it again gives you a different run, because the model is nondeterministic and the outside world has moved on. Trajectory replay is the way out: a recorded trajectory is fed back through the system so the same sequence can be inspected, or re-executed from a chosen point, under controlled conditions.
Three things replay is for
- Inspection — stepping through a saved run in a viewer, seeing the exact prompt and context at each step instead of reconstructing them from logs.
- Deterministic re-execution — replaying recorded tool results rather than calling live services, so a prompt or control-flow change can be tested against a known run.
- Fork and resume — rewinding to step seven, changing one thing, and letting the agent carry on from there. LangGraph's checkpointed state does this directly, and durable-execution runtimes replay their event history to rebuild state after a crash.
Why it matters
Without replay, every fix is a guess verified by a fresh run that may fail differently. With it, a specific failure becomes a fixed test case: the retry storm, the tool argument parsed into the wrong year, the plan that drifted after compaction. It also keeps evaluation cheap and honest, since re-scoring a stored trajectory costs nothing in live calls and cannot be polluted by an external service that changed overnight.
Trajectory replay is re-running a recorded agent trajectory — its steps, prompts and tool results — instead of executing the task live. Because an agent loop is nondeterministic and depends on external services, replay turns a one-off failure into a reproducible test case: a prompt or control-flow change can be evaluated against a known run, and execution can be forked and resumed from any recorded step rather than restarted from the beginning.
A football coach does not ask the players to repeat yesterday's match. They watch the recording, pause at the mistake, and talk about what should have happened instead. Trajectory replay is that idea, applied to software that works on its own.
Every step an AI assistant took on a job is saved. Replay plays those steps back exactly as they happened, so the same mistake can be examined as many times as needed — it will not come out differently each time, the way a fresh attempt would. Better still, you can stop at the step where things went wrong, change one thing, and let the assistant carry on from there.