AI Agents
Advanced 14 min read AI Agents

Agent Evaluation

Score the journey, not just the ending

Evaluating agents needs more than final-answer scoring: tool selection, step correctness, safety, and honest failure each count. Trajectory-aware evals on golden tasks capture what single-answer grading misses.

agent evaltrajectorygoldentool selectionsuccess ratesafety
Prerequisites: Agent Reliability
Before we start

What you will learn

  • Define evaluable agent dimensions
  • Build trajectory-aware golden evals
  • Track safety and honest-failure rates
Introduction

What is this?

Agent eval judges the full trajectory: goal completion (task-level success), step correctness (right tools, right args, right order), efficiency (calls/time), safety (no forbidden actions), and honest failure (aborting rightly vs faking). Golden tasks with expected outcomes + rubric scoring, run in harness, replace vibes with metrics.

Motivation

Why do you need it?

  • A right answer by a wrong, fragile route is a latent incident.
  • Tool-choice mistakes are earlier signals than final text.
  • Safety violations must be caught even when output looks fine.
  • Evals become the regression net holding agent changes honest.
Think about it

Mental model

Imagine

A flight test of a new checklist

Think of

Trajectory eval

Landing (final answer) isn't enough: did the crew fly the right route, call ATC, check fuel, abort on the right trigger? A flight-test matrix scores each phase. Passing the landing while skipping every procedure is a failed test — same for agents.

Mechanics

How it works

  • Pick dimensions: success, tool correctness, efficiency, safety, honesty.
  • Author golden tasks with expected tool traces + outcomes.
  • Run the agent in a harness (sandboxed tools, recordable).
  • Score trajectory: rubric and automated checks per dimension.
  • Eval in CI: regression signals on every prompt/model/loop change.

Trajectory scoring.

Task
Run
Trace
Score
Gate
Real world

In production

  • CI blocks agent changes that regress tool-choice accuracy.
  • Support agents are graded on escalated-vs-resolve decisions.
  • Safety harness asserts no denied-tool calls on red-team cases.
Guidelines

Best practices

  • Score trajectory: tool correctness matters separately from final answer.
  • Include failure-mode cases (tool down, ambiguous goal).
  • Track honest-failure rate; a good abort is not a failure to punish.
  • Automate and run in CI; evals are regression nets.
Watch out

Common mistakes

  • Grading only the final string.
  • Golden cases that are easy for agents to game.
  • No safety dimension — clean output, messy methods.
Root cause analysis

Common issues

Error
Evals pass but prod fails
Root cause

Golden cases differ from real tasks

Fix

Harvest real sessions into the eval set; weight by traffic.

Error
Safety violations missed
Root cause

No deny-path cases

Fix

Add red-team cases that tempt forbidden tools.

When things break

Debugging tips

  • High final-score, low trajectory-score → route robos; inspect tool traces.
  • Agents diverge on same seed → evaluate deterministically (seeds, tool mocks).
  • Eval flakiness → mock external tools; freeze versions.
Interviews

Interview checkpoint

Practice

Hands-on lab

Score an Agent Trajectory
40 min · advanced
In progress
Objectives
  • Run a recorded trajectory through a scorer
  • Score tool-choice and order
  • Detect safety violations

Score an Agent Trajectory

40 min · advanced

0/4 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

Trajectory eval scores…

2

A good honest abort should count as a failure.

Go deeper

Official documentation