P522 min

Evaluation

Tests prove the code runs. Evals prove the agent behaves. This lesson covers the eval loop — the closed cycle of dataset, metric, harness, and iteration that lets you measure agent quality with the same rigor you measure latency or test coverage.

SDK FocusoutputFormathooks.PostToolUseresult.subtypefallbackModelmodel routing

Evals vs Tests

Both check correctness and can overlap; the useful distinction is what signal they optimize for:

TestsEvals
Question"Does the code run?""Does the agent behave?"
Typical truthDeterministic assertionsRubrics or statistical aggregates
Typical outputPer-case pass/failRates, distributions, and segments
InputsFixturesDatasets that approximate reality
Failure shapeStack traceBehavior drift, regression on subgroup

A unit test on file_read_tool proves the tool works. An eval on the agent proves it picks the right tool, calls it with sane arguments, and recovers when it doesn't. You need both.

The Eval Loop

A useful eval system is a closed loop, not a one-time test suite. Each cycle improves either the agent or the eval itself:

The eval loop: dataset, harness, metrics, analysis, iterationEval Looploop1. Dataset2. Harness3. Metrics4. Analysis5. Iterate

Each step is a discipline of its own. We'll walk through them in order.

Premium lesson preview

Continue with full access

This lesson stays here for preview. Full access unlocks the complete lesson, flashcards, and related practice.

Sign In to Unlock

One purchase unlocks advanced lessons, practice, and future updates.