New Tool Radar

AI Agents & Automation

How to Replay an Agent Run From Its Transcript to Debug It

Replay an agent run from its transcript to reproduce a failure without re-running live tools.

Schematic with three steps: Save the transcript with every run; Replay with recorded results standing in for; Find the step where the replay diverges.

When an agent run fails in production, re-running it live is the worst way to debug it: the tools run again, the writes happen twice, and the conditions that caused the failure may have changed. A transcript replay is the better way: the run’s recorded steps, tool calls, and tool results are fed back through the same logic, with the recorded results standing in for live tool calls. LangSmith traces are the record that makes this possible, since they capture what the agent did step by step. Save the transcript with every run, replay the failing one offline, and fix the cause where it actually happened.

What you need

  • A saved transcript of the failing run: steps, tool calls, and tool results
  • A replay mode that substitutes recorded results for live tool calls
  • The failing run’s input, so the replay starts from the same place

Step 1: Save the transcript with every run

Record each run’s steps, tool calls, tool arguments, and tool results in order, with the run id attached. A run with no transcript cannot be replayed.

Step 2: Replay with recorded results standing in for live tools

Feed the transcript back through the run logic, returning the recorded result for each tool call instead of calling the tool. No live tool should run during a replay.

Step 3: Find the step where the replay diverges from the good path

Compare the replay with a known good run and find the first step where they differ. That step is where the failure started; fix it there, not at the end where the error surfaced.

Worked example: synthetic transcript replay check

The table below is a synthetic example. It shows the expected result of a transcript replay; no live tool ran.

Check Expected Result
Replay uses recorded results only 0 live calls Pass
Failure reproduces at step 3 Yes Pass
Good run matches until step 3 Yes Pass
Cause found at step 3 Yes Pass

Expected result (UNTESTED). the replay reproduces the failure at step 3 with no live tool calls, and the cause is found at that step. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A replay reproduces the recorded run, not the live conditions that caused it.
  • A transcript missing a tool result cannot be replayed past that step.
  • Replayed results can be stale: the live tool may return something different now.
  • A replay proves where the failure happened, not why the tool returned what it did.

Sources

See all