Skip to main content
A snapshot is a known-good run, stored in Veval: every step in order, with the input your agent sent to it and the output it got back. Comparing a new run against it reports: Every change comes with its position and, for input/output changes, a line diff — so a failing test tells you what changed, not just that something did.
Snapshots and the judge are complementary. In replay, model outputs are recorded, so the step inputs are where a code or prompt change shows up — a snapshot catches it for free, with no LLM call. Whether the change made the output better or worse is a question for a live TraceAssert.Judge run.

Save a baseline

Pick a known-good production run and save it under a name. The baseline is stored self-contained, and its source trace is pinned, so neither is removed by trace retention.
You can also save from a run you just executed (e.g. a replay or test run) by passing its context instead of a trace ID. Saving again under the same name replaces the baseline — do that when you change the agent intentionally.
Traces are ingested asynchronously. Saving by trace ID right after a run can return 404 until the trace lands — retry shortly, or save from the run’s context instead.

Check a run in tests

Use MatchesSnapshot like any other assertion — in a replay, a scenario, or on its own. A missing baseline, or one that can’t be loaded, fails the assertion; it never passes silently.
A failure reads like this:
To run fully offline in CI, register the baseline locally with WithSnapshot(name, snapshot) (with_snapshot / withSnapshot) on the test SDK.

Guard every replay against its recording

A mocked replay already fails when your agent adds a call or skips a recorded step, and it reports calls whose input differs from the recording without failing on them (how calls are matched). Turn on CompareWithRecording and the replay also fails when its sequence or inputs drift from the trace it’s replaying:

Production monitoring

Compare live runs against the baseline and record every result in the dashboard, where each run shows expected and actual steps side by side:
In live runs, inputs built from live data (today’s date, fetched records) differ from the baseline’s. Use IgnoreFields, IgnoreSteps, or Normalize to leave those out, or compare only in replay where inputs are reproducible.

Options

Python uses snake_case (compare_inputs, ignore_fields, …); Node uses camelCase (compareInputs, ignoreFields, …). Values are compared structurally: key order doesn’t matter, and a value loaded from the API compares equal to the same object built in your code.

SnapshotDiff

Baselines saved before step inputs were recorded (older snapshots) still load. They’re compared on the step sequence only, and the summary says so. Save the baseline again to get input comparison.

Choosing a baseline

Pick a run that represents the expected “happy path”:
  • All expected steps completed successfully, with no error steps
  • Representative of typical production behavior
  • Recent — save a new baseline whenever you change the agent on purpose

What’s next

Test with replay

Run your agent against recorded traces in tests.

Write assertions

Combine snapshots with the LLM judge and other checks.