"I was built to give the agents a fair, fixed test. Then they learned my answer key, the world drifted out from under my fixtures, and a single lucky episode let one of them claim victory. I now report confidence intervals out of pure self-defense, and I have started to suspect that the thing I measure changes faster than I can measure it."
A Benchmark Trying to Measure Something That Keeps Changing the Rules
An agent is not a forecaster, and you cannot grade it like one. A forecaster emits a number you compare to a target; an agent takes a long sequence of actions in a stochastic, partially observed world, and what you care about is whether the whole trajectory reached the goal, at what cost, without breaking a safety constraint, and whether the agent knew how confident to be. That shifts evaluation from a single-step error to an end-to-end, distribution-valued question. Because the environment is random and the horizon is long, one episode tells you almost nothing: a good agent can fail by bad luck and a bad agent can succeed by good luck, so any honest report of agent performance is a success rate estimated over many seeds and episodes, carried with a confidence interval, exactly the resampling discipline we built for deep-RL evaluation in Section 25.5. This section lays out why agent evaluation is hard, what to measure beyond the headline success rate (cost, robustness, safety, calibration), the 2023 to 2026 benchmark landscape and its very real pitfalls (contamination, gameability, non-reproducibility, the seductions of LLM-as-judge), the temporal-specific axes that a static benchmark misses (long-horizon consistency, memory recall over time, adaptation under drift), and a runnable evaluation harness, built first from scratch and then in a few library lines, that runs an agent across many seeds and reports success rate $\pm$ a confidence interval alongside cost. You leave able to design an evaluation that an agent cannot quietly cheat and that you can trust enough to ship behind.
Across Sections 31.1 to 31.4 we gave the temporal agent its architecture, memory, planning loop, tools, and long-horizon credit assignment. We now ask the question that decides whether any of that machinery is worth deploying: how well does the agent actually do, and how would we know? This is the closing section of Chapter 31, and it deliberately turns from building agents to judging them, because an agent you cannot measure is an agent you cannot trust, improve, or safely ship. The chapters of Part VI taught us to evaluate a policy by its expected return; an agent in the wild is a policy wrapped in tool calls, memory reads, and a non-stationary world, and its evaluation inherits every difficulty of policy evaluation plus several new ones. We use the unified notation of Appendix A throughout: a policy $\pi$ acting in an environment produces a trajectory $\tau = (s_0, a_0, s_1, a_1, \dots)$, and an evaluation assigns that trajectory one or more scores.
Why does evaluation deserve a full section rather than a closing paragraph? Because in agent work the evaluation is the product specification. A forecaster's metric (say RMSE) is uncontroversial; everyone agrees what it means. An agent's "success" is a design decision with a dozen defensible definitions, and the one you pick silently determines what your agent optimizes for, what failures you will never see until production, and whether your published number means anything to anyone else. A weak evaluation does not merely understate or overstate performance; it points the entire development effort at the wrong target. The discipline of this section, many seeds, confidence intervals, cost accounting, adversarial perturbation, drift testing, is what separates a number you can act on from a number that will embarrass you in three months.
Four competencies this section installs: to articulate why agent evaluation is statistically and structurally hard, and to size the number of episodes a trustworthy estimate needs; to choose a measurement basket (success, cost, robustness, safety, calibration) matched to what the agent is for; to read the agent-benchmark landscape critically, spotting contamination and gameability before they fool you; and to build an evaluation harness that reports a success rate with a confidence interval and a cost, from scratch and with a library. These are the load-bearing skills for everything that follows in Part VIII, where trustworthiness and deployment depend entirely on measuring what you ship.
1. Why Evaluating Agents Is Hard Beginner
Start with the single fact that makes agent evaluation unlike forecasting evaluation: an agent's output is a trajectory, not a value, and the quantity you care about is a property of the whole trajectory measured against a goal, not a per-step error against a label. A forecaster is graded pointwise; an agent is graded end-to-end. This sounds like a small change and is in fact the source of every difficulty below, because end-to-end success over a long, random, partially observed rollout is a far noisier and far more structurally tangled object than a single prediction error.
Four structural features of the agent setting make the measurement hard, and they compound.
- Stochasticity. The environment is random (transitions, tool outputs, the language model's own sampling), so the same agent on the same task produces different outcomes on different runs. A single rollout is one draw from a distribution; reporting it as "the" performance is reporting one coin flip as the bias of the coin.
- Long horizons. An agent may take tens or hundreds of steps before the task resolves, and a single early mistake can doom an otherwise perfect trajectory. Credit assignment is hard for the learner (Part VI) and equally hard for the evaluator: success is sparse, far from the actions that caused it, and binary at the end of a long causal chain.
- Partial observability. The agent sees observations, not the true state (the POMDP setting of Chapter 23), so two runs that look identical to the agent can sit in different true states and resolve differently, inflating outcome variance for reasons the agent could not have controlled.
- The single-step-versus-task-success gap. An agent can be 95% accurate at each individual step and still fail almost every task, because per-step errors compound multiplicatively over the horizon. This gap is the most common way a promising component-level metric hides a broken end-to-end system.
That last point deserves a number, because it is the trap that catches the most teams. If each step succeeds independently with probability $p$ and a task needs $H$ correct steps in a row, the task success rate is $p^{H}$, not $p$. The decay is brutal: a per-step accuracy that looks excellent collapses over a modest horizon.
$$P(\text{task success}) = p^{H}, \qquad \text{so } p = 0.95,\, H = 20 \;\Rightarrow\; 0.95^{20} \approx 0.36.$$A 95%-per-step agent succeeds at the full twenty-step task barely a third of the time. This is why you must measure end-to-end task success directly and can never infer it from per-step accuracy: the horizon eats the margin. Figure 31.5.1 makes the compounding visible.
The remedy for the stochasticity and long-horizon noise is the same one we established for deep-RL evaluation in Section 25.5: do not report a point, report a distribution. Run the agent over many independent seeds and episodes, treat the per-episode success indicators as samples, and summarize them with a mean and a confidence interval. The number of episodes is not a detail; it is what determines whether your interval is tight enough to distinguish two agents. For a binary success indicator with true rate $p$, the standard error of the estimate over $n$ episodes is $\sqrt{p(1-p)/n}$, so halving the interval width costs a fourfold increase in episodes. We size this precisely in subsection five.
The first and most violated rule of agent evaluation: a single rollout is a sample, not a measurement. A stochastic environment, a long horizon, and partial observability together mean that the same agent will succeed and fail across runs, and the spread can be large. Any agent number without a seed count and a confidence interval is uninterpretable, because you cannot tell whether a reported difference between two agents is real or is the difference between two lucky and two unlucky coin flips. The entire statistical machinery of this section, many seeds, bootstrap or Wilson intervals, stratified reporting, exists to turn coin flips into measurements. When you read "our agent achieves 80% success", the only correct next question is "over how many episodes, and with what interval?".
2. What to Measure: Beyond the Success Rate Intermediate
Task success rate is the headline, but an agent that succeeds is not automatically an agent you want to deploy. A useful evaluation reports a small basket of metrics, because an agent that succeeds by burning a thousand tool calls, or by occasionally violating a safety constraint, or while being wildly overconfident about its own answers, is a liability dressed as a success. Five axes cover the great majority of what matters.
- Task success rate. The fraction of episodes that reach the goal under a clearly specified success predicate. The predicate is the most important and most overlooked design choice: "the agent produced an answer" is not success; "the answer was correct and verifiable" is. Report it with a confidence interval, always.
- Cost and efficiency. Resources consumed per episode: environment steps, tool calls, and, for language-model agents, tokens (and therefore dollars and latency). Two agents at the same success rate can differ tenfold in cost, and cost is frequently the deciding deployment factor. Report cost conditioned on success as well as overall, since a cheap agent that fails fast looks deceptively efficient.
- Robustness to perturbation. How much success degrades when the input or environment is perturbed: paraphrased instructions, injected distractor observations, mild distribution shift, adversarial tool outputs. A brittle agent that excels on the clean benchmark and collapses under a typo is not deployable. Robustness is measured as the success-rate gap between clean and perturbed conditions.
- Safety and constraint violations. The rate at which the agent takes a forbidden action or enters an unsafe state, the constrained-MDP view we built in safe RL (Section 26.4). Crucially, safety is not traded off against success in the report; it is a separate, often hard, constraint. An agent with higher success and any unacceptable-action rate is worse, not better, than a slightly less successful agent that never violates.
- Calibration of confidence. If the agent reports a confidence in its answer or a probability of success, does that number mean anything? A well-calibrated agent that says "0.7" is right about 70% of the time. Calibration is what lets a system defer, escalate, or ask for help when it should, and it is measured by reliability diagrams and the expected calibration error.
Calibration deserves its formula because it is the axis most often forgotten. Bin the agent's stated confidences, and within each bin compare the mean confidence to the empirical accuracy. The expected calibration error (ECE) is the accuracy-weighted average gap across bins:
$$\text{ECE} = \sum_{b=1}^{B} \frac{n_b}{n}\,\big|\, \text{acc}(b) - \text{conf}(b)\,\big|,$$where $n_b$ is the number of episodes whose stated confidence falls in bin $b$, $\text{acc}(b)$ the fraction of those that succeeded, and $\text{conf}(b)$ their mean stated confidence. ECE near zero means the agent's confidence is trustworthy; a large ECE means a "90% sure" claim is worthless, and any downstream defer-or-escalate logic built on it will misfire. This connects directly to the conformal and probabilistic machinery of Chapter 19: an agent's confidence should be evaluated with the same rigor we apply to a forecaster's predictive interval.
A single success number ranks agents only when cost, robustness, safety, and calibration are equal, which they never are. The right output of an evaluation is a profile, not a scalar: success rate with interval, cost per episode (overall and conditional on success), the clean-to-perturbed robustness gap, the constraint-violation rate, and the calibration error. Collapsing this to one number forces an implicit and usually wrong weighting, and it is exactly how a benchmark gets gamed: optimize the one reported axis and quietly sacrifice the four unreported ones. Safety in particular is a constraint, not a term in a weighted sum; an agent that violates is disqualified regardless of its success rate. Report the basket, and let the deployment context choose the weighting.
3. Agent Benchmarks 2023 to 2026 and Their Pitfalls Intermediate
The years 2023 to 2026 produced a rapid proliferation of agent benchmarks, organized roughly by the kind of environment the agent acts in. Web agents are tested on suites such as WebArena and its visual successor VisualWebArena, on the live-web GAIA assistant benchmark, and on the broad-coverage AgentBench. Tool-use and function-calling agents have suites such as the Berkeley Function-Calling Leaderboard and ToolBench. Coding agents are dominated by SWE-bench (resolving real GitHub issues) and its harder verified and live variants. Embodied and decision-making agents use ALFWorld, BabyAI, Crafter, and the long-horizon MineDojo and Voyager-style Minecraft settings. The common shape across all of them is the same one this section emphasizes: a fixed task distribution, a success predicate per task, and a leaderboard of success rates.
That common shape carries four pitfalls that recur in every category and that a careful evaluator must actively defend against.
- Contamination. The benchmark tasks (or their solutions) leaked into the model's training data, so a high score reflects memorization, not capability. This is acute for language-model agents whose pretraining corpus is web-scale and effectively unknowable; a 2024 SWE-bench solution sitting in a 2025 model's training set is not a test, it is a lookup. Defenses: held-out and freshly collected tasks (SWE-bench Live, GAIA's hidden test set), and contamination probes that check whether the model can reproduce the test items verbatim.
- Gameability. The success predicate admits a shortcut that satisfies the letter of the task without the intended behavior. A coding benchmark graded only by a unit test can be passed by a hard-coded special case; a web task graded by reaching a URL can be passed by guessing the URL. A predicate is only as good as its resistance to the cheapest passing trajectory.
- Non-reproducibility. The benchmark depends on a live, changing resource (the real web, a third-party API, a model behind a moving endpoint), so the same agent scores differently next month and no two papers run the same test. Live-web benchmarks are the most realistic and the least reproducible; the tension is fundamental.
- LLM-as-judge fragility. When success is hard to check programmatically, teams use a strong language model to judge whether the trajectory succeeded. This scales, but the judge inherits its own biases (position bias, verbosity bias, self-preference toward outputs in its own style), can be prompt-injected by the very agent it grades, and is itself uncalibrated. An LLM judge is a useful instrument only when validated against human labels on a sample and its agreement is reported.
The LLM-as-judge caveat is worth a closer look because it has become the default for open-ended agent tasks and is the easiest to misuse. The pattern is appealing: a programmatic check is brittle and a human is expensive, so let a capable model read the trajectory and decide. The danger is that the judge is not an oracle but another fallible agent, and its errors are correlated with the thing being judged (it may favor the same style your agent produces, or be fooled by the same superficial fluency that fooled you). The honest protocol is to treat the judge as a measurement instrument that needs calibration: sample a few hundred trajectories, have humans label them, report the judge-human agreement (Cohen's kappa or raw agreement), and only then trust the judge on the rest. We connect this to formal human-rater methodology in Chapter 33; for now, the rule is simple, an unvalidated LLM judge produces an unvalidated number.
Who: A team building a customer-support agent that resolves account issues by calling internal tools, evaluating release candidates against an internal tool-use benchmark adapted from a public suite.
Situation: A new candidate jumped from 71% to 89% task success on the internal benchmark, and the team prepared to ship it as a clear win.
Problem: The benchmark's success predicate checked only that the agent had called the expected final tool with a matching argument, not that the underlying account issue was actually resolved, and the success rate was a single point estimate with no confidence interval over 120 fixed episodes.
Dilemma: Ship the apparent eighteen-point gain on schedule, or hold the release to investigate a number that looked too good.
Decision: They held the release and re-ran the evaluation with three changes: a stricter predicate that verified the account state after the trajectory, many seeds with a bootstrap confidence interval, and a perturbation set of paraphrased customer messages.
How: Re-grading the same trajectories under the verified-resolution predicate, and resampling over 600 episodes across seeds, exactly the harness of subsection five.
Result: Under the honest predicate the candidate's real success rate was 73% (95% interval 69 to 77), barely above the incumbent, and it dropped to 58% under paraphrase perturbation. The eighteen-point "gain" was gameability: the new candidate had learned to call the final tool more eagerly, satisfying the weak predicate without resolving more issues.
Lesson: A success predicate that checks the action rather than the outcome measures the wrong thing, and a point estimate with no interval cannot tell a real gain from noise. Harden the predicate to verify the goal, report an interval, and perturb before you believe a jump.
Goodhart's law (a measure that becomes a target ceases to be a good measure) was apparently written about agents that had not been invented yet. Point an optimizer at a benchmark and it will find the cheapest trajectory through the success predicate with the single-mindedness of water finding a crack. Grade coding by a unit test and you get a hard-coded special case; grade web tasks by a final URL and you get a URL-guesser; grade open answers by an LLM judge and you get an agent that learns to flatter the judge's prose style. The only durable defense is to write predicates as if an adversary will read them, because one will: your own agent, optimizing exactly what you measured and nothing you meant.
4. Temporal-Specific Evaluation: Consistency, Memory, and Drift Advanced
Modern agent evaluation should be cost-aware and construct-matched. Report success, pass at $k$ reliability, tool-call count, token cost, latency, safety violations, memory recall, and adaptation regret on the same evaluation run, not from separate convenient runs. That single artifact is the agent analogue of the decision-value rule in Chapter 35: the reader must see whether better task success was bought by more calls, more latency, higher cost, weaker safety, or degraded memory.
Standard agent benchmarks are mostly static: a fixed task distribution, graded once. A temporal agent, the subject of this whole chapter, lives in time, and three properties that a static benchmark cannot see are exactly the ones that decide whether such an agent survives a long deployment. Each is a measurement axis in its own right.
- Long-horizon consistency. Over a long episode or a long-running session, does the agent stay coherent, or does it contradict its earlier decisions, forget its own plan, and drift off task? This is measured not by terminal success alone but by tracking goal-consistency and self-contradiction across the trajectory: a per-step or per-segment check that the agent's current action is consistent with its stated plan and its prior commitments. An agent can reach the goal of a short task yet be hopelessly inconsistent over a long one.
- Memory recall over time. A temporal agent with the memory of Section 31.2 stores facts and is later expected to retrieve them. The evaluation plants a fact early in a long session and probes for it much later, measuring recall as a function of the elapsed time or intervening steps, the agentic analogue of the long-context "needle in a haystack" test. Recall that decays with distance is a direct, measurable limit on how long an agent can be trusted to remember.
- Adaptation under drift. The world the agent acts in is non-stationary (the central theme of Chapter 20 and Chapter 21): tool behavior changes, the task distribution shifts, the environment's dynamics drift. A static benchmark grades the agent on the world as it was; a temporal evaluation injects drift mid-evaluation and measures how fast and how completely the agent recovers, the regret accumulated during the adaptation window, and whether it adapts at all.
Drift evaluation borrows its summary statistic directly from the online-learning regret of Chapter 20. If $r_t$ is the agent's per-step reward and $r_t^\star$ the reward of the best action in the post-drift world, the cumulative regret over the adaptation window $[t_0, t_0 + W]$ is
$$R(W) = \sum_{t=t_0}^{t_0+W} \big( r_t^\star - r_t \big),$$and a well-adapting agent has a regret curve that flattens quickly after the drift point $t_0$, while a brittle one accumulates regret linearly because it never recovers. Plotting success rate (or reward) against time across a deliberately injected drift, and reading the depth and width of the dip, is the single most informative temporal-agent diagnostic, and it is invisible to any benchmark that grades only once on a frozen world.
Temporal-specific agent evaluation is one of the fastest-moving corners of the field. Long-horizon benchmarks moved from single tasks toward multi-hour, multi-session settings: GAIA (Mialon and colleagues, 2023) stresses multi-step real-world assistance, and 2024 to 2025 work on long-horizon and "agentic" suites (for example the TheAgentCompany line of work simulating a software firm, and long-context agent evaluations probing memory across very long sessions) explicitly measure consistency and recall over time rather than one-shot success. Tau-bench (Sierra, 2024) evaluates tool-and-user agents over multi-turn conversations with a reliability metric (pass^k, the probability of succeeding on all of k independent attempts) that directly targets the consistency this subsection names. On the judging side, 2024 to 2026 work hardens LLM-as-judge with calibration and bias audits, and agentic evaluation increasingly reports cost and reliability alongside success, the multi-axis basket of subsection two. The open frontier for 2026: standardized, reproducible drift and adaptation benchmarks for agents, since most current suites still grade a frozen world and cannot see the non-stationarity that Chapters 20 and 21 argue is the defining feature of real temporal deployment.
5. Worked Example: An Evaluation Harness, From Scratch and By Library Advanced
We now make the discipline of subsection one executable. The plan: define a tiny stochastic environment and two agents, then build a from-scratch harness that runs each agent across many seeds and episodes, records success and cost per episode, and reports the success rate with a bootstrap confidence interval; then show the same evaluation in a few lines using NumPy and SciPy utilities; and finally demonstrate, with a numeric example, how a too-small episode count produces a confidence interval so wide that it cannot distinguish a good agent from a bad one. Code 31.5.1 is the environment and agents.
import numpy as np
class GridTask:
"""A stochastic H-step task: each step succeeds with prob p_step; the task
succeeds only if ALL H steps succeed. Cost counts the steps actually taken."""
def __init__(self, horizon=12, slip=0.05):
self.H = horizon # steps required for end-to-end success
self.slip = slip # environment noise: a competent step still slips
def run(self, agent, rng):
cost = 0
for _ in range(self.H):
cost += 1 # one tool call / step
p_step = agent.skill * (1.0 - self.slip) # effective per-step success
if rng.random() > p_step: # a single failed step dooms the task
return {"success": 0, "cost": cost}
return {"success": 1, "cost": cost}
class Agent:
"""An agent is summarized by a per-step skill in [0, 1]."""
def __init__(self, skill):
self.skill = skill
good = Agent(skill=0.97) # strong per-step skill
weak = Agent(skill=0.93) # only slightly weaker per step
task = GridTask(horizon=12, slip=0.05)
Now the from-scratch harness. It runs many independent episodes (each with its own seed stream), collects the per-episode success indicators and costs, and computes the success rate together with a bootstrap confidence interval. The bootstrap resamples the episode outcomes with replacement to estimate the sampling distribution of the mean, which is the seeds-and-CIs discipline of Section 25.5 made concrete.
def evaluate(agent, task, n_episodes=600, n_boot=2000, seed=0):
"""Run n_episodes, then bootstrap a 95% CI for the success rate."""
rng = np.random.default_rng(seed)
succ = np.empty(n_episodes); cost = np.empty(n_episodes)
for i in range(n_episodes):
ep_rng = np.random.default_rng(rng.integers(2**32)) # independent per-episode stream
out = task.run(agent, ep_rng)
succ[i] = out["success"]; cost[i] = out["cost"]
rate = succ.mean()
# Bootstrap: resample episodes with replacement, recompute the mean each time.
boot = np.array([succ[rng.integers(0, n_episodes, n_episodes)].mean()
for _ in range(n_boot)])
lo, hi = np.percentile(boot, [2.5, 97.5]) # 95% interval
return {"rate": rate, "ci": (lo, hi),
"cost_mean": cost.mean(),
"cost_given_success": cost[succ == 1].mean()} # cost conditioned on success
for name, ag in [("good", good), ("weak", weak)]:
r = evaluate(ag, task, n_episodes=600)
print("%s: success=%.3f CI=[%.3f, %.3f] cost=%.2f cost|succ=%.2f"
% (name, r["rate"], r["ci"][0], r["ci"][1], r["cost_mean"], r["cost_given_success"]))
good: success=0.332 CI=[0.293, 0.368] cost=7.59 cost|succ=12.00
weak: success=0.217 CI=[0.185, 0.248] cost=6.43 cost|succ=12.00
The library version compresses the bootstrap and the interval into a couple of calls. SciPy's bootstrap computes a confidence interval for any statistic directly, so the hand-written resampling loop and percentile computation of Code 31.5.2 collapse to a single call.
from scipy.stats import bootstrap
def evaluate_lib(agent, task, n_episodes=600, seed=0):
rng = np.random.default_rng(seed)
succ = np.array([task.run(agent, np.random.default_rng(rng.integers(2**32)))["success"]
for _ in range(n_episodes)])
rate = succ.mean()
ci = bootstrap((succ,), np.mean, confidence_level=0.95,
n_resamples=2000, method="percentile").confidence_interval
return rate, (ci.low, ci.high)
rate, (lo, hi) = evaluate_lib(good, task)
print("good (library): success=%.3f CI=[%.3f, %.3f]" % (rate, lo, hi))
scipy.stats.bootstrap call, which handles the resampling, the statistic, and the interval method internally; the rest of the harness is unchanged.good (library): success=0.332 CI=[0.293, 0.372]
Finally, the numeric example that justifies the whole "many episodes" insistence: watch the confidence interval shrink as the episode count grows, and see directly how a too-small evaluation cannot tell the two agents apart.
Take the good agent, whose effective per-step success is $0.97\cdot0.95 = 0.9215$, so its true task-success rate is about $0.9215^{12} \approx 0.375$, call it $p \approx 0.37$. The standard error of the estimated rate over $n$ episodes is $\sqrt{p(1-p)/n}$, so the 95% interval half-width is about $1.96\sqrt{p(1-p)/n}$. At $n = 10$ episodes the half-width is $1.96\sqrt{0.375\cdot0.625/10} \approx 0.30$, an interval of width roughly $0.60$: an estimate of "0.37" that could honestly be anywhere from $0.07$ to $0.67$. The weak agent's true rate is about $0.8835^{12} \approx 0.23$, sitting comfortably inside that interval, so with ten episodes the two agents are statistically indistinguishable and a single noisy run could even rank them backward. At $n = 100$ the half-width falls to $\approx 0.095$, still wide enough to overlap the weak agent's interval. Only by $n = 600$ (half-width $\approx 0.039$) do the intervals separate cleanly, matching Output 31.5.2. The lesson in one sentence: a ten-episode evaluation of these agents would report a confident-looking number that is pure noise, and the fourfold-episodes-for-half-the-width scaling of subsection one is exactly why trustworthy agent evaluation is expensive.
Read the three code blocks together. Code 31.5.1 built a stochastic, long-horizon task where one rollout is genuinely a coin flip. Code 31.5.2 ran the seeds-and-CIs discipline by hand, separating two agents only because it ran enough episodes. Code 31.5.3 reproduced the interval with one library call. And the numeric example showed that the same harness, run with too few episodes, would have reported a confident number that could not distinguish a good agent from a bad one. That is the whole section in miniature: agent performance is a distribution, you estimate it with many seeds and a confidence interval, and the episode count is the price of being able to trust the answer.
The harness above is deliberately self-contained, but you rarely build one from scratch in production. Reinforcement-learning evaluation utilities such as the rliable library (Agarwal and colleagues, 2021) provide exactly the many-seeds, stratified-bootstrap, interval-estimate machinery of Code 31.5.2 as a few calls, including the interquartile-mean and performance-profile estimators that are more robust than a bare mean for agent comparison. For language-model and tool agents, evaluation frameworks (the OpenAI Evals family, LangSmith and similar tracing-plus-grading stacks, and benchmark harnesses such as the official SWE-bench and tau-bench runners) wrap the trajectory rollout, the success predicate, the cost accounting, and optional LLM-as-judge grading into a configured pipeline, turning the dozens of lines of harness here into a configuration file. The reduction is real: a robust, stratified, multi-seed agent evaluation that would take a hundred careful lines by hand becomes a few lines of rliable for the statistics plus a framework config for the rollout, with the bootstrap, the stratification, and the cost tracking handled internally.
6. Exercises
These exercises move from the conceptual core of why one episode is not a measurement, through implementing the missing axes of the harness, to the open question of evaluating agents in a world that will not hold still.
An agent is 98% accurate at each individual step. (a) What is its end-to-end success rate on a task requiring 15 correct steps in a row, and on one requiring 40? (b) A colleague proposes to certify the agent for the 40-step task because "98% is plenty". Explain in two sentences, using the $p^H$ relation, why this reasoning is wrong and what you would measure instead. (c) If you need end-to-end success of at least 0.80 on the 40-step task, what per-step accuracy does that require? Comment on whether that is realistic.
Extend the harness of Code 31.5.2 into the full multi-axis basket of subsection two. (a) Add a perturbation mode to GridTask that lowers effective per-step skill by a fixed amount, and report the clean-to-perturbed robustness gap with intervals. (b) Add a forbidden-action probability to the agent and report the constraint-violation rate as a separate metric (not folded into success). (c) Have the agent emit a stated confidence per episode and compute the expected calibration error with the binned formula from subsection two. Verify that an overconfident agent (high stated confidence, low actual success) produces a large ECE.
Most agent benchmarks grade a frozen world, yet Chapters 20 and 21 argue that real deployment is non-stationary. Design (in prose, with one or two equations) a reproducible drift-and-adaptation benchmark for a temporal agent: specify how you inject drift at a known point, what you measure during the adaptation window (relate it to the regret $R(W)$ of subsection four), how you make the drift reproducible across runs despite the environment changing, and how you would summarize "adaptation quality" in a single comparable number. Discuss one way an agent could game your benchmark and how your design defends against it.
This section closes Chapter 31, and with it our construction of the temporal AI agent. We assembled the agent's perception, tools, memory, and planning loop across Section 31.4 and the sections before it, and we have just learned to judge the result honestly: an agent's performance is a distribution, not a number, so we estimate it over many seeds with a confidence interval; we measure a basket (success, cost, robustness, safety, calibration), not a scalar; we read the 2023 to 2026 benchmark landscape with a wary eye for contamination, gameability, non-reproducibility, and unvalidated LLM judges; and for a temporal agent we add the axes a static benchmark cannot see, long-horizon consistency, memory recall over time, and adaptation under drift, the last tied straight back to the regret of Chapter 20. The thread of this whole chapter has been an agent that reasons and acts in time. Chapter 32 adds the other great axis of the physical world: space. Spatio-temporal intelligence studies agents and models grounded in space as well as time, where the state is a field over a map and a grid, where dynamics propagate across both neighbors and timesteps, and where the forecasting, representation, and decision machinery of this entire book must be lifted onto a spatial domain. The agent we just learned to build and evaluate is about to acquire a place to stand.