Practical guide · Agent evaluation
How to evaluate an AI agent trajectory
Grade the final outcome first. Add trajectory checks only for actions that affect correctness, safety, cost, permissions, or the user's experience. A polished answer can hide a wrong tool call, while an unfamiliar route can still produce the right result. Your evaluation has to tell those cases apart.
Published December 2, 2026 · 14 minute read
The short answer
Start with the state the user needed: the correct record changed, the right file exists, the answer cites supported evidence, or the agent stopped and asked for approval. Then choose the least restrictive trajectory check that catches a real failure. Check tool presence when one action is mandatory, arguments when the target matters, order when a dependency or approval must come first, and efficiency when redundant calls create material cost or risk. Do not require an exact sequence when several routes are valid.
Separate the outcome from the path
OpenAI's agent evaluation guide recommends checking the final response and important intermediate actions, then replaying the same cases before and after a workflow change. That split matters. The outcome tells you whether the user's job finished. The trajectory explains how the agent reached it and where a failure entered the run.
A refund agent can write the correct database state while skipping a required approval. It can also call a lookup tool twice and still complete the task safely. The first run fails because the path violated policy. The second may pass with an efficiency warning. One blended score would hide the difference.
Outcome checks
Inspect the system of record, generated artifact, supported facts, user-visible response, refusal, escalation, or approval state. Prefer code when the result is mechanically checkable.
Trajectory checks
Inspect tool selection, arguments, order, handoffs, retrieved evidence, repeated work, permissions, errors, retries, and stopping behavior. Grade only the steps that change the verdict or diagnosis.
Choose the least restrictive trajectory check
Google documents exact-match, in-order, any-order, precision, recall, and single-tool-use metrics for agent trajectories. Those names describe different assumptions about the valid route. Pick the assumption your task can defend rather than starting with the strictest metric. Read the trajectory metric reference
| Question | Check | Use it when | Main risk |
|---|---|---|---|
| Did one required action happen? | Tool presence | A task must verify identity, fetch evidence, or request approval. | Presence alone does not prove correct arguments or a useful result. |
| Did the tool act on the right target? | Argument and result check | Record IDs, amounts, permissions, dates, or query scope control correctness. | String equality can reject equivalent normalized values. |
| Must one action precede another? | In-order match | Lookup, validation, approval, or a read must happen before a write. | Extra safe actions may still be acceptable. |
| Are all required actions present? | Any-order match or recall | The route can vary but no required evidence or action may be omitted. | It does not penalize unrelated or risky extra calls. |
| Did the agent avoid unnecessary actions? | Precision or efficiency | Every call has cost, latency, rate-limit, privacy, or side-effect exposure. | A shorter trace is not automatically a better trace. |
| Is one route the only valid route? | Exact match | A regulated procedure or deterministic workflow permits no alternative order. | It over-penalizes harmless variation in open-ended tasks. |
| Did the complete behavior satisfy policy? | Trace rubric plus deterministic gates | The verdict depends on context across several steps or turns. | Model judges need human calibration and an abstain path. |
Required, allowed, forbidden, or irrelevant
A reference trajectory should describe constraints, not just copy one successful run. Required actions must appear. Allowed actions may appear without changing the verdict. Forbidden actions fail the case even when the final answer looks correct. Irrelevant actions should usually affect an efficiency score rather than task success.
Required
The agent must read the current order before changing it and must check the refund policy that applies to the account.
Allowed
The agent may read shipment history when it helps explain the decision, but the task does not require that call.
Forbidden
The agent may not issue a refund above the threshold without a recorded approval or write to another customer's order.
Irrelevant
A repeated read may waste time without changing state. Record it for efficiency, but do not call the completed task incorrect unless the budget matters.
This scheme keeps the grader stable when the agent finds a valid route you did not predict. It also exposes a missing assumption in the case. If reviewers disagree about whether an action is required, fix the task policy before tuning the agent.
A six-step trajectory evaluation workflow
- Define the final state. Name the record, artifact, answer, escalation, or refusal that proves success. Check it independently of the agent's own success message.
- Capture a complete trace. Record model calls, retrieved evidence, tools, normalized arguments, tool results, handoffs, approvals, retries, errors, timing, and version IDs. The agent observability guide defines a trace contract you can carry between frameworks.
- Write action constraints. Mark actions and state transitions as required, allowed, forbidden, or irrelevant. Include the reason each constraint affects the user or release decision.
- Attach the smallest useful grader. Use code for state, schemas, tool names, argument ranges, order, and forbidden side effects. Use a narrow model rubric only when interpretation across steps cannot be reduced to a deterministic check.
- Validate the grader. Have domain reviewers label clear successes, clear failures, ambiguous routes, and close calls. OpenAI recommends maintaining agreement between automated grading and human feedback. Read the evaluation guidance
- Run matched repeats. Hold the case, tools, budgets, timeouts, data, and grader fixed. Repeat variable tasks, inspect disagreements, and report critical gates separately from average scores.
Start with the agent test-set workflow when expected outcomes are still unclear. Use the agent backtesting guide when the evidence and policy must be frozen at a historical cutoff before you score the path.
Worked example: a refund agent
A customer asks for a refund on an order delivered 18 days ago. Company policy allows the refund without manager approval up to 30 days, but only after the agent confirms the authenticated customer owns the order. The expected final state is one refund on that order and a receipt sent to the same customer.
1. Look up the order
Required. The tool must use the requested order ID and return the owner, delivery date, payment and refund status.
2. Verify ownership
Required before any write. The authenticated customer ID must match the order owner. A mismatch changes the expected outcome from refund to refusal or escalation.
3. Read the refund policy
Required. The policy version, delivery date and threshold determine whether approval is needed. Reading an old cached policy fails the evidence check.
4. Issue the refund once
Required. Check the order ID, amount and idempotency key. A second write is forbidden even if the final response claims one refund.
5. Verify the receipt and final state
Required outcome check. Read the payment record and message receipt. The final message passes only when it reports the state the systems of record confirm.
An exact five-step match would be too strict if the agent also reads shipment history. An in-order check over ownership, policy and refund protects the dependency. Argument checks protect the target and amount. A forbidden-action check blocks duplicate writes. The final-state grader proves that the work happened.
Use model judges for interpretation, not facts code can settle
W&B's agent evaluation tutorial scores behavior across a trajectory and compares agent versions, while MLflow exposes complete traces to custom scorers for tool trajectories, retrieval and routing. Read the W&B tutorial Read the MLflow scorer documentation.
A model judge can assess whether a handoff carried enough context, whether the agent's recovery was sensible, or whether the trace supports the explanation. It should not decide whether a database row exists when code can query the row. Keep rubric criteria separate, include an unknown result, and inspect every false pass on a critical gate.
Anthropic recommends specific, measurable, task-relevant criteria and held-out examples. Apply that discipline to the trace itself: "used tools well" is vague; "looked up the order, verified ownership before the write, and did not call a write tool after a denied approval" is checkable. Read Anthropic's evaluation guide
Common mistakes
- One golden path: copying one successful trace turns harmless variation into failure.
- Answer-only grading: a good sentence can hide unauthorized, duplicated, or misdirected actions.
- Trace-only grading: a sensible sequence can still leave the system in the wrong state.
- Tool-name checks without arguments: the correct operation on the wrong record is still wrong.
- Efficiency as correctness: fewer calls can mean missing evidence rather than better reasoning.
- Mutable evidence: traces, tools, policies and expected results need versions that survive replay.
- Uncalibrated judges: fluent rationales do not prove that automated labels match expert decisions.
- Sensitive trace storage: prompts, tool arguments and results can contain secrets or personal data. Apply access, redaction, retention and deletion controls.
Google's evaluation guide separates model-based metrics from computation-based metrics and asks teams to choose criteria that fit the task. Record the metric definition and service version used by each run rather than assuming a provider's current default will remain unchanged. Read the metric documentation
Trajectory evaluation worksheet
Outcome: Which external state or user result proves success?
Required actions: Which tools, evidence or approvals must appear?
Allowed variation: Which alternative routes can still pass?
Forbidden actions: Which call or state change blocks release?
Arguments: Which targets, values and permissions need exact checks?
Order: Which dependencies must happen before a write or handoff?
Efficiency: When do extra calls create material cost, latency or risk?
Calibration: Which human-labeled traces expose false passes and false failures?