Agent Evaluation Systems: From Trajectory Benchmarks and Stateful Tool Sandboxes to Human-Calibrated LLM-as-Judge and Paired Significance Testing
Why static single-turn benchmarks fail on multi-step tool-calling agents, how to architect a four-layer evaluation harness from scratch (deterministic AST guards, stateful mock-database sandboxes, $\text{Pass}^k$ reliability, and CI/CD regression ratchets), and how to calibrate an LLM-as-judge against human annotations with paired hypothesis tests ($p$-values) in production.
Evaluating a multi-step agent is fundamentally different from evaluating a single-turn text classifier or static QA model. An agent interacts with external state: it decomposes an ambiguous user goal, selects tools from a schema registry, serializes JSON arguments, interprets noisy or empty API payloads, and mutates backend databases. A single prompt edit or base-model swap can leave final-answer fluency unchanged while silently breaking tool parameter formatting, skipping an authorization check, or inflating tail latency by $3\times$.
Two chapters covering the full evaluation stack
Architect the 4-layer evaluation pyramid, contrast outcome-level state assertions ($\Delta S_{\text{db}}$) against trajectory-level tool F1 across the $2\times 2$ failure matrix, derive why customer-facing agents must optimize $\text{Pass}^k = p^k$ rather than $\text{Pass}@k$, and build a deterministic SQLite tool-fixture replay harness that gates every prompt or model pull request.
Calibrate an automated LLM judge against human expert labels using Cohen’s $\kappa$, Krippendorff’s $\alpha$, and the Rogan–Gladen prevalence correction ($\hat{p} = \frac{\hat{p}_{\text{raw}} + q_0 - 1}{q_1 + q_0 - 1}$), then run paired $t$-tests, Wilcoxon signed-rank tests, and Holm–Bonferroni corrections on the 800-dealership AutoPulse CRM platform to prove +21% semantic similarity and +35% context relevance.
Summary of the Four Evaluation Layers
| Layer | What It Verifies | Core Mathematical Metric | Execution Cost | Chapter |
|---|---|---|---|---|
| L1 · Deterministic Schema & Policy | JSON AST validity, Pydantic types, enum bounds, forbidden tool combinations | $\mathbb{I}[\text{AST\_valid}] \land \mathbb{I}[\text{policy\_safe}] = 1$ | $< 2\text{ ms}$ / step | Ch. 01 |
| L2 · Trajectory & Sandbox State Diff | Tool sequence recall/precision, argument similarity, exact mock DB mutation $\Delta S_{\text{db}}$ | $\operatorname{F1}_{\text{tool}}(\tau)$, $\text{Pass}^k = \hat{p}^k$, $\mathbb{I}[S_T = S_T^*]$ | $\sim 15\text{ ms}$ / trace | Ch. 01 |
| L3 · Calibrated LLM-as-Judge | Semantic similarity, context relevance, groundedness (faithfulness), tone rubric | Rogan–Gladen $\hat{\theta}_{\text{RG}}$, Paired $t$ / Wilcoxon $p$-value | $\sim 600\text{ ms}$ / trace | Ch. 02 |
| L4 · Online Shadow & Canary Gate | User re-query rate, human escalation rate, P99 latency, distribution drift | Sequential mSPRT / CUPED-adjusted $\Delta\mu$ | Real-time stream | Ch. 01–02 |