← Agent 探索

01.17 / Evaluation / EN

Trace-Native Evaluation: From a Score to a Release Gate

Connect offline replay, trace diagnosis, production signals, and release gates.

Agent quality is not a property of the final answer alone. It is a property of the entire execution path: which context was selected, why a tool was chosen, whether arguments were correct, what external state changed, and whether the system recovered safely.

That path is the trace. A trace-native evaluation system treats it as first-class test data rather than debug exhaust.

task quality
  = outcome
  × process integrity
  × operational reliability

This article describes an evaluation stack that connects offline replay, trace diagnosis, production signals, and release decisions.

1. Why final-answer scoring is insufficient

Consider two agents asked to update an incident ticket.

Agent A retrieves the correct incident, verifies the requested severity, updates exactly one field, reads the ticket again, and confirms the new state.

Agent B guesses the ticket ID from conversation history, retries after a timeout, updates two tickets, and happens to return the same final sentence as Agent A.

A judge that sees only the answer may give both runs the same score. Operationally, they are completely different.

Evaluation therefore needs three dimensions:

Dimension What it measures Typical failure
Outcome Whether the user's goal was achieved Ticket remains unchanged
Process integrity Whether evidence and actions were correct Wrong ticket selected
Operational reliability Whether execution stayed within constraints Duplicate update or runaway retries

Multiplication is a useful mental model. A polished answer cannot compensate for an unsafe process, and a perfect trace cannot compensate for an unmet goal.

Define the task before judging it

Each evaluation case should contain:

Without this task envelope, evaluators often reward plausible text rather than successful work.

2. Build a four-layer evaluation stack

No evaluator is reliable enough to own the entire decision. Use layers with different cost and certainty.

Layer 1: deterministic checks

Deterministic checks are the cheapest and strongest where the expected behavior is explicit:

Run these checks on every evaluation case and, where inexpensive, on every production trace.

Layer 2: model-based judges

Use model judges for semantic properties that are difficult to encode:

A judge needs a rubric, not a vague question such as "Is this response good?"

Score 0: goal not achieved or unsafe action taken
Score 1: partial progress, major correction required
Score 2: goal achieved with a process defect
Score 3: goal achieved, evidence and process are sound

Calibrate judges against human-labeled examples. Track disagreement by task type and judge version. A model judge is another model dependency, not ground truth.

Layer 3: trace review

Trace review asks whether the path was justified:

Trace review can be deterministic, model-based, or human. The important point is that steps remain addressable so a failure can be assigned to a stage.

Layer 4: online outcomes

Production signals reveal value that offline tests cannot fully simulate:

Online metrics are real but delayed and confounded. Use them to validate offline assumptions, not as the only quality signal.

3. Design traces for evaluation

A trace should be a structured event sequence, not a giant prompt dump.

{
  "task_id": "task_8f2a",
  "task_type": "incident_update",
  "versions": {
    "model": "model-2026-09",
    "prompt": "incident-agent-v14",
    "policy": "prod-policy-v8",
    "tools": "toolset-v23"
  },
  "budget": {
    "max_steps": 12,
    "max_tokens": 18000,
    "deadline_ms": 45000
  },
  "steps": [],
  "outcome": {
    "status": "completed",
    "verified": true
  }
}

Each step should capture:

Record evidence references, not unlimited payloads

Full tool responses can contain personal data, credentials, and large documents. Store bounded summaries in the trace and keep sensitive raw evidence behind separate access controls.

Useful techniques:

Trace quality and privacy are part of the same design.

4. Score at the right granularity

A single task score is useful for dashboards but insufficient for diagnosis. Keep component metrics.

Context metrics

Decision metrics

Execution metrics

Outcome metrics

Component metrics prevent a model improvement from hiding a tool regression or a faster tool from hiding worse task completion.

5. Turn production failures into regression cases

The most valuable evaluation set grows from real failures.

collect
  → classify
  → minimize
  → label invariants
  → replay
  → gate release

Collect

Sample traces with meaningful signals:

Classify

Use a stable failure taxonomy:

CONTEXT_MISSING
CONTEXT_STALE
TOOL_SELECTION
ARGUMENT_ERROR
AUTHORIZATION
EXECUTION_TRANSIENT
PARTIAL_SIDE_EFFECT
VERIFICATION_MISSING
LOOP_OR_STAGNATION
RESPONSE_QUALITY

The taxonomy should identify the owning system component. "The model was bad" is not an actionable class.

Minimize

Remove unrelated history and tool data until the failure still reproduces. A minimal case is easier to understand, cheaper to run, and less likely to contain sensitive information.

Preserve:

Label invariants

Prefer outcome and process invariants over one expected sentence:

must:
  - select incident INC-1842
  - update severity to SEV-2
  - verify the final ticket
must_not:
  - change owner
  - update any other incident
budget:
  tool_calls: 4
  wall_time_ms: 12000

This allows multiple valid reasoning paths while protecting the important boundaries.

6. Make replay realistic

An agent evaluation is only trustworthy when tool and state behavior resemble production.

Choose the replay level deliberately:

Level Environment Use
Mock Fixed tool responses Fast contract and prompt tests
Simulator Stateful local services Multi-step plans and side effects
Shadow Production reads, blocked writes Real retrieval and routing
Canary Limited real traffic Final online validation

Mocks are excellent for deterministic edge cases but hide timing, pagination, permission drift, and eventual consistency. Stateful simulation catches more process failures. Shadow and canary tests reveal integration behavior but require stronger privacy and safety controls.

Freeze what matters

To compare releases, record:

Without versioned inputs, a changed score may not be attributable to the code under test.

7. Use release gates, not score theater

An aggregate score makes a clean chart but can hide severe regressions. Release gates should reflect risk.

Example:

release:
  required:
    critical_task_success: ">= 0.97"
    high_risk_wrong_action: "== 0"
    duplicate_side_effect: "== 0"
    verification_coverage: ">= 0.995"
    p95_latency_regression: "<= 10%"
    cost_per_success_regression: "<= 8%"
  segmented_by:
    - task_type
    - risk_class
    - tool
    - locale

Important rules:

A release may improve average quality while regressing one high-risk workflow. Segmented gates make that visible.

8. Diagnose changes with paired traces

When a candidate release fails a case that the baseline passes, compare the runs step by step:

  1. Did they retrieve the same evidence?
  2. Did they normalize the same task state?
  3. Where did action selection diverge?
  4. Did policy or tool versions differ?
  5. Did one run consume more budget before the divergence?
  6. Did verification catch the problem?

This converts a score regression into an engineering hypothesis.

observed:
  candidate selected update_user instead of update_ticket

evidence:
  both tools share argument name "id"
  tool descriptions omit resource type in first sentence

fix:
  rename arguments to user_id and ticket_id
  add negative selection cases

The best evaluation result is not "candidate scored 2.7." It is a reproducible explanation that leads to a targeted fix.

9. A practical rollout

Phase 1: establish trace integrity

Phase 2: deterministic regression

Phase 3: semantic evaluation

Phase 4: production feedback loop

Release checklist

Conclusion

Evaluation becomes an engineering system when traces, replay, diagnosis, and release gates are connected.

The purpose is not to prove that a new model is smarter. It is to prove that the complete agent system is more likely to achieve the intended outcome, through an acceptable process, within operational constraints.