alexcinovoj.devby TechTide AI
Back to AI proof
Pattern · AI production systems

Trace replay and diffing

Two runs of the same task diverge somewhere specific. Replay plus diff finds that point without re-reading thousands of tokens by hand.

Short answer

What is agent trace replay and diffing?

Two runs of the same task diverge somewhere specific. Replay plus diff finds that point without re-reading thousands of tokens by hand.

Implementation

  • Store enough per-step input to re-execute the deterministic parts of a run without a provider.
  • Treat imported traces as untrusted input and validate them against a schema before storage.
  • Diff two runs step by step and report the first divergent step, not a similarity score.
  • Keep redaction applied through the replay path.

Failure modes

  • Replay that calls the provider again, which changes the thing being investigated.
  • Diffing on final output only, which hides where the runs split.

How it is verified

  • Replay a stored run and confirm the deterministic steps reproduce exactly.
  • Feed a malformed trace to the importer and confirm it is rejected.

Questions this pattern answers

What is agent trace replay and diffing?

Two runs of the same task diverge somewhere specific. Replay plus diff finds that point without re-reading thousands of tokens by hand.

How do you implement trace replay and diffing?

Store enough per-step input to re-execute the deterministic parts of a run without a provider. Treat imported traces as untrusted input and validate them against a schema before storage. Diff two runs step by step and report the first divergent step, not a similarity score. Keep redaction applied through the replay path.

How is trace replay and diffing verified?

Replay a stored run and confirm the deterministic steps reproduce exactly. Feed a malformed trace to the importer and confirm it is rejected.

What usually goes wrong with trace replay and diffing?

Replay that calls the provider again, which changes the thing being investigated. Diffing on final output only, which hides where the runs split.

Projects in this track

Related patterns

This page documents how the pattern is built. Engagement scope and pricing live on TechTide AI.

AI Production Systems at TechTide AI