Skip to main content

Overview

Golden baselines are snapshot tests for agent behavior. Record a known-good trace, then assert future runs match — catching behavioral regressions from prompt tweaks, model upgrades, or code changes.

Recording a baseline

Set golden=True to save the trace as the expected behavior:
The golden trace is saved at .reagent/golden/refund-flow.trace.json.

Asserting against a baseline

If the agent’s behavior changed — different tools called, different arguments, different results — the assertion fails with a diff showing exactly what changed.

Ignoring noisy fields

Some fields change between runs without indicating a regression (timestamps, request IDs, etc.). Use ignore_fields to skip them:

Supported ignore patterns

Storage layout

Updating baselines

When behavior should change (new feature, improved prompt), re-record the golden:
The --reagent-update flag re-records all golden baselines in a single test run.

How the diff works

The diff engine compares traces positionally — turn 0 vs turn 0, turn 1 vs turn 1:
  • All tool calls in each turn are compared (not just the first)
  • Tool results are compared by position in the results list
  • call_id is ignored (it’s a random UUID that changes every run)
  • ignore_fields is applied to every comparison
Golden baseline diffs are designed for deterministic test fixtures, not live LLM output. Use ignore_fields to handle expected variation.