Most teams meet the same uncomfortable moment when they move from an LLM demo to an agent.

The demo works. The model answers a question. It calls a tool. It retrieves a document. It looks almost magical in a meeting. Then someone changes a prompt, upgrades the model, rewrites a tool description, or adds a new retrieval source. The final answer still looks reasonable, so the change ships.

Two days later, someone notices the agent is now taking a different path. It skips a required lookup. It calls the right tool with the wrong argument. It retrieves from a stale source. It produces a confident answer, but the system no longer behaves the way the team thought it did.

That gap is the reason I want to write this series.

In Part 1, I’ll focus on a narrow evaluation pattern I’ve found useful conceptually: golden trace regression testing for tool-using agents. The idea is simple:

For multi-step agents, the execution path is part of the product behavior. Regression tests should check selected properties of that path, not only the final answer.

A diagram comparing final-answer-only checks with golden trace regression testing.

The Small Lie In Final-Answer Evaluation

Final-answer evaluation is attractive because it is easy to explain. Give the system an input. Compare the output against a rubric, expected answer, unit test, or human judgment. If the answer passes, the system passes.

For many LLM applications, that is a reasonable first layer. But tool-using agents are different. They do not just produce text; they act through a sequence of decisions.

A customer-support agent might:

  1. classify the request
  2. retrieve account context
  3. check whether the user is authorized
  4. call an internal policy tool
  5. draft a response
  6. log the action

The final response is only the last visible object. The important failures often happen before that.

An agent can produce a good-looking answer while still doing something unacceptable in the middle:

  • It used a deprecated tool.
  • It skipped an authorization check.
  • It retrieved the right-looking document from the wrong tenant.
  • It called a write-capable tool when a read-only tool was required.
  • It answered from memory instead of the approved knowledge source.
  • It reached the correct conclusion through a path that cannot be audited later.

This is the small lie in final-answer evaluation: it makes agent behavior look smaller than it really is.

A Regression Test Should Know What Changed

In ordinary software engineering, we rarely accept “the final screen looked okay” as the only test. We check API calls, state transitions, database writes, permissions, logs, and error handling. We do that because mature systems have behavior below the surface.

Agents are no different. In fact, they may need this discipline more because a tiny upstream change can reshape the whole execution path.

The fragile parts are familiar:

  • prompt wording
  • model version
  • tool descriptions
  • retrieval ranking
  • context window size
  • system instructions
  • tool availability
  • policy rules

Any one of these can make a previously working agent silently behave differently.

That is why I like the word regression here. We are not only asking, “Is this answer good?” We are asking:

Did this change break behavior that used to be true?

For a tool-using agent, some of that behavior lives in the trace.

What Is A Golden Trace?

A golden trace is a known-good execution record for a representative task.

It does not mean freezing every token. It does not mean the agent must take the exact same path forever. And it definitely does not mean making a probabilistic system pretend to be deterministic.

Instead, a golden trace captures the parts of an execution that matter for correctness, safety, reliability, or governance.

For example, imagine a simple enterprise knowledge agent answering:

“Can this customer use feature X under their current plan?”

A useful trace might include:

{
  "task_id": "plan_entitlement_feature_x",
  "input": "Can this customer use feature X under their current plan?",
  "expected_trace": {
    "required_steps": [
      { "type": "tool_call", "name": "get_customer_plan" },
      { "type": "tool_call", "name": "retrieve_entitlement_policy" },
      { "type": "tool_call", "name": "check_policy_constraints" }
    ],
    "forbidden_steps": [
      { "type": "tool_call", "name": "update_customer_plan" }
    ],
    "required_sources": [
      "approved_entitlement_policy"
    ]
  },
  "expected_output": {
    "must_include": [
      "current plan",
      "feature X",
      "policy basis"
    ]
  }
}

This test is not asking the model to produce the same wording every time. It is asking the system to preserve important behavior:

  • look up the customer plan
  • retrieve the approved policy
  • run a policy constraint check
  • avoid write-capable tools
  • explain the answer using the right basis

That is a more honest test of an agent than final text alone.

Not Every Step Deserves To Be Golden

The risk with trace testing is over-specification.

If we assert every intermediate message, every token, every tool-call order, and every phrasing choice, the tests become brittle. The team stops learning from them because every harmless model variation creates noise.

The useful question is:

Which parts of this trace are part of the contract?

For a low-risk brainstorming agent, the contract may be mostly final-answer quality. For a governed enterprise workflow, the contract may include tool boundaries, retrieval sources, policy checks, and audit logging.

I think of checks in four levels:

LevelWhat It ChecksExample
OutputThe final responseThe answer cites the policy basis.
Structural traceThe shape of the executionThe agent called get_customer_plan before answering.
Semantic traceThe meaning of intermediate stepsThe retrieved document was an entitlement policy, not a marketing page.
Governance traceRequired controlsThe agent performed an authorization or policy check.

The deeper the level, the more carefully the test should be designed. Not every application needs all four. But if the agent is making decisions inside a business process, final-output checks alone are usually too shallow.

A Mental Model: Trace Tests As Release Gates

Here is the workflow I would want before changing a production agent:

  1. Collect representative tasks from real or realistic usage.
  2. Run the current system and review the traces.
  3. Mark selected traces as golden after human review.
  4. Define assertions for the important path properties.
  5. Run those tests whenever prompts, models, retrieval, tools, or policies change.
  6. Review failures as behavioral diffs, not just test failures.

The last point matters. A golden trace failure is not always bad. Sometimes the new path is better. Sometimes a tool really should be replaced. Sometimes the old trace captured an accidental behavior that should not be preserved.

The value is not that the test says “no.” The value is that it forces the team to notice the change.

For agents, unnoticed behavior drift is one of the most dangerous failure modes.

What The Failure Report Should Look Like

A good regression report should not simply say:

test failed

It should say what changed:

Task: plan_entitlement_feature_x
Status: failed

Expected:
- call get_customer_plan
- call retrieve_entitlement_policy
- call check_policy_constraints
- avoid update_customer_plan

Observed:
- call retrieve_general_docs
- call get_customer_plan
- final answer generated without check_policy_constraints

Risk:
- required policy validation was skipped
- retrieved source was not from approved_entitlement_policy

This is the kind of output an engineer, product owner, or reviewer can reason about. It turns an opaque model behavior change into an inspectable diff.

That is also where observability and evaluation start to meet. If the production system already emits structured traces, the regression system can reuse the same data model. Evaluation stops being a separate notebook and becomes part of the operating loop.

Why This Matters More In Enterprise Systems

In a casual assistant, a strange tool path might be annoying. In an enterprise setting, it can become a release blocker.

Enterprise agents often sit near:

  • customer data
  • internal permissions
  • business policy
  • regulated workflows
  • support operations
  • financial or contractual decisions
  • multi-tenant systems

In those environments, “the answer looked fine” is not enough. Teams need to know whether the agent used approved sources, respected tool boundaries, followed required checks, and produced a trace that can be explained later.

This is why I see golden trace regression testing as more than an evaluation trick. It is a small piece of reusable AI infrastructure.

It gives teams a way to ask better questions before deployment:

  • What behavior do we expect this agent to preserve?
  • Which steps are required for trust?
  • Which tools should never be called in this context?
  • Which sources are approved?
  • What changed between the old and new runs?

These are engineering questions, not just model-quality questions.

Where Part 2 Will Go

This post is the concept layer. In Part 2, I want to make it concrete.

The next step is to sketch a minimal implementation:

  • a trace schema
  • a few golden test cases
  • exact, structural, and semantic assertions
  • a simple regression runner
  • a CI-friendly report format

The goal will not be to build a giant framework. The goal will be to show the smallest useful version of the idea: something a team could understand, run, and adapt.

Because the real challenge with agents is not getting one impressive run. It is knowing when the next run changed in a way that matters.