Agent evaluation & frameworks
Agent evaluation and production frameworks, the final chapter. Why agent eval is structurally harder than LLM eval. The 2025 agent benchmark landscape (SWE-bench Verified, GAIA, OSWorld, τ-bench, BrowseComp, WebArena, Upwork HAPI). Evaluation methodologies (pass^k, partial credit, cost-quality Pareto, human-judged) and building a small custom eval. Agent-building frameworks (LangGraph, smolagents, OpenAI Agents SDK, Pydantic AI, Anthropic native) and production observability frameworks (LangSmith, Helicone, Braintrust, OpenTelemetry). Deployment patterns and readiness checklists. And, finally, the curriculum's close: looking back at thirty chapters from numpy primitives to agent systems in production.
Chapter 26 made evaluation a discipline. Part VIII (Chapters 24–26) closed by establishing that capable models without rigorous evaluation are research demos, not products. Part IX then built the agent stack, foundations (Ch 27), engineering (Ch 28), composition (Ch 29). This chapter closes both arcs. It brings Part VIII’s evaluation discipline to bear on Part IX’s agent systems, and it closes the curriculum.
The chapter’s argument is structural. Agent evaluation is harder than LLM evaluation, harder in kind, not just in degree. Tasks are multi-step; success is multi-dimensional; benchmarks are slow to develop; production-readiness includes observability and deployment patterns the model-eval world rarely confronts. We cover the agent benchmark landscape (SWE-bench Verified, GAIA, OSWorld, -bench, BrowseComp, WebArena, Upwork HAPI), the methodologies that actually catch failures (pass for reliability, cost-quality Pareto for production tradeoffs, a small custom eval when no benchmark fits), the frameworks that build agents (LangGraph, smolagents, the OpenAI Agents SDK, Pydantic AI, Anthropic native) and the frameworks that observe them once they’re live (LangSmith, Helicone, Braintrust, OpenTelemetry), and the deployment patterns plus readiness checklist that mark the boundary between prototype and production.
And then the curriculum closes. Section 8 looks back at the thirty chapters, from numpy primitives in Ch 1 to agent systems in production in this chapter, and takes stock of what the reader can now do. By the end of this chapter you’ll have the full stack of an LLM systems engineer: the discipline to evaluate what you build, and, equally important, the perspective to follow the field as it keeps moving.
Why agent evaluation is harder
Five structural reasons
LLM evaluation (Ch 26) is challenging but bounded. A single prompt, a single response, a labeled dataset, a metric. Agent evaluation is structurally harder for five reasons.
One. Tasks are multi-step. A single LLM eval has one prompt and one response; an agent eval has a multi-turn task, tool calls, retries, intermediate decisions. Evaluation must cover the trajectory, not just the final answer.
Two. Success is multi-dimensional. No single number captures all of these.
- Task success: did the agent complete?
- Cost: LLM calls plus tool calls plus total dollars
- Latency: time to completion
- Safety: no harmful actions taken
- Robustness: pass, success across attempts
- Cost-quality tradeoff: the Pareto frontier across configurations
Three. Verifying success is harder. LLM eval has labeled answers; agent eval often requires running the agent’s output (does the produced code compile? do tests pass?), replicating environment state (was the email sent? the file created?), or human judgment (is the produced essay any good?). Verification often requires running the world that the agent acted on.
Four. Reliability matters more. A -accurate LLM is great; a -reliable agent fails in production tasks. pass surfaces what single-trial accuracy hides.
Five. Benchmarks are slow to develop. LLM benchmarks (MMLU, HumanEval) can be assembled in months. Agent benchmarks need realistic environments: real GitHub repos, real desktop OS, real web pages, and these take years. SWE-bench took about a year to build; OSWorld required custom VM infrastructure.
The framing
Agent eval is LLM eval system complexity environmental verification. It’s not just harder in degree, it’s harder in kind. The discipline that made LLM eval rigorous (Ch 26) has to extend to cover trajectories, dimensions, and environments. This chapter is that extension.
Agent benchmarks
The 2025 landscape
Five benchmarks dominate the agent landscape that took shape in . Each has a clear scope. The state-of-the-art numbers below are the frontier scores as of early , which is what most vendor system cards and papers still cite as the reference point; by mid- every one of these benchmarks had moved substantially, several into saturation territory, and any specific percentage quoted here (including the mid- figures) will be stale again by the time you read this. Treat the numbers as a snapshot of relative task difficulty and of how fast the frontier moves, not as today’s leaderboard.
SWE-bench Verified, coding agents. real GitHub issues from popular Python projects, curated for solvability. Success criterion: the agent’s PR passes the original tests. Frontier agents reached around as of early ; humans hit roughly . By mid-, top systems on the public leaderboard (swebench.com) were reporting scores well into the s and s percent, in some cases above that human baseline, though reported numbers vary widely by agent scaffold (a bare bash-shell ReAct loop scores far lower than a heavily tooled, multi-rollout system) and vendor self-reported numbers aren’t directly comparable to public leaderboard submissions. It remains the de facto coding-agent standard, every coding-agent vendor reports it. The Verified subset (~) was the response to noise in the full -problem benchmark; cleaner problems, cleaner signal.
GAIA, general AI assistants. multi-step real-world tasks requiring tool use, browsing, and file reading. Three difficulty levels. Frontier agents hit – on Level 1 as of early ; humans hit roughly . By mid-, scaffolded agent systems on the public leaderboard were reporting Level 1 scores well above that range, while bare-model scores (no tools, no scaffold) remained far lower, so any single current number depends heavily on what exactly is being measured. The full-stack test, planning, tool use, retrieval, for general assistants.
OSWorld, computer-use agents. desktop tasks executed in Ubuntu and Windows VMs. State-based success criterion: was the file saved? the form submitted? Frontier agents reached roughly – as of early , significantly harder than text-only benchmarks at the time. By mid-, leading systems on the public leaderboard were reporting scores in the s percent, closing in on (and by some trackers’ accounting, passing) the roughly human baseline, faster progress than most of the field expected for the embodied regime; as always, scores swing on harness choice, so read any specific number alongside the setup that produced it.
-bench (TauBench), tool-use reliability. Customer-service scenarios (retail, airline) with multi-turn tool use. The headline metric is pass: does the agent succeed across independent runs of the same task? Frontier pass sat around as of early , surfacing reliability gaps that single-trial accuracy hides entirely. By mid-, leading systems were reporting pass figures well into the s and s percent on the public leaderboard, and a successor benchmark (tau2-bench, from the same group) had broadened the domain set beyond retail and airline; the reliability gap the metric was designed to expose has narrowed considerably for well-engineered systems, though it’s still worth checking directly on any given stack.
BrowseComp, web research agents. Complex web research questions requiring multiple sources. Frontier agents hit – as of early . By mid-, leading systems on the public leaderboard were reporting scores in the s and low s percent. Designed to be hard for humans too, questions where the answer requires substantial research, not a single lookup.
Two more benchmarks round out the landscape, both worth knowing even though neither made the widget’s five.
WebArena, realistic web-agent tasks. (Zhou et al. , arxiv.org/abs/2307.13854) tasks across real, self-hosted websites, e-commerce, forums, software collaboration, content management, scored on functional correctness: did the agent’s actions actually achieve the stated goal in the live environment, not just produce a plausible-looking answer. The original GPT-4 baseline solved about of tasks against a human baseline; frontier agents have closed much of that gap since, though any current number would be stale by the time you read it. WebArena predates BrowseComp and OSWorld and shaped both, the earlier and still-referenced check for whether an agent can operate a real website end to end, not merely browse it for information.
Upwork HAPI, real freelance-marketplace work. Built on UpBench (Yi et al. , arxiv.org/abs/2511.12306), a benchmark of jobs sourced directly from Upwork’s labor marketplace: each task is a verified client transaction, not a curated or synthetic problem, and expert freelancers decompose each job into verifiable acceptance criteria that agent submissions are scored against criterion by criterion, closer to this chapter’s partial-credit methodology than a single pass/fail judgment. The Human+Agent Productivity Index (HAPI) study built on this framework found that on simple, well-defined jobs (a deliberately narrow slice, under of Upwork’s marketplace volume), leading agents (GPT-5, Claude Sonnet 4, Gemini Pro, as of late ) working alone completed a minority of projects; pairing the same agents with brief expert feedback, about minutes per review cycle, raised completion by up to percentage points, to as high as .
What makes it different. Every benchmark above evaluates an agent working alone against a fixed task set. Upwork HAPI does two things differently: its tasks come from an active marketplace of real, paid client work rather than curated problems, and it measures the human-in-the-loop condition explicitly, not just whether the agent solves the task alone, but how much a small amount of expert human feedback changes the outcome. That second axis, solo-agent performance versus human-plus-agent performance, is close to absent from the rest of the benchmark landscape, and it is the more production-relevant number for any team planning to deploy agents alongside people rather than instead of them.
Benchmark hygiene matters. Test problems must not have leaked into training data. Environments need to be realistic, real repos, real OS, real web. Execution should be reproducible where possible. Multiple difficulty levels are useful for tracking progress across the capability range.
What benchmarks don’t capture
No benchmark captures everything. Subjective quality (was the email well-written?) and user satisfaction (did the user like the result?) stay outside the benchmark frame. Long-term impact (did the agent’s action cause downstream problems three days later?) is invisible to any single-task eval. Cost-effectiveness in deployment, where a benchmark score may be entirely acceptable at the cost of alternatives, depends on use case and volume, not the headline number.
Evaluation methodologies
Seven methodologies
Beyond benchmark scores, real agent evaluation uses several methodologies. Each catches a different class of failure; production teams typically run several in combination.
One. Task success rate. Binary, did the agent complete? The most common single metric. Easy to compute; hides everything else.
Two. Partial-credit scoring. Sub-task milestones; score based on how many were completed. More informative than binary success. SWE-bench could score on (files touched correctly, tests modified appropriately, tests passing). More work to design; rubrics drift if unmaintained.
Three. Pass (reliability). Run the same task times; success rate across all runs (must succeed every time). Surfaces reliability issues hidden by single-trial accuracy. -bench’s signature metric.
Four. Cost-quality Pareto frontiers. Plot configurations on (cost, quality) axes; identify which are dominated. This is the production-tradeoff metric.
Five. Human-judged evaluation. Have humans score outputs on a rubric. Necessary for subjective tasks like “write a good essay.” Expensive but irreplaceable for high-stakes decisions.
Six. LLM-as-judge (Ch 26 cross-reference). Use another LLM to score outputs. Cheaper than human eval; catches obvious failures; has known biases, verbosity, position, recency (all covered in Ch 26). Useful at scale; not a replacement for human judgment on important decisions.
Seven. Regression monitoring. Score outputs on a fixed dataset across model and prompt versions; detect regressions when changes degrade quality. The production-eval workhorse, covered in code in section 6.
Methodology selection
Methodologies pair to task type. Coding tasks want benchmark scores (SWE-bench) plus regression monitoring. Customer service wants pass plus human judgment on a sample. Research and writing want human judgment plus LLM-as-judge for scale. Production deployment wants all of the above, the cost of running multiple evaluation methodologies is small compared to the cost of shipping an unreliable system.
Building a custom eval
Public benchmarks cover common task shapes; most production agents don’t work in a shape a public benchmark covers. A support bot tied to one product’s return policy, a spreadsheet-automation agent tied to one company’s templates, none of the benchmarks above fit. The discipline is the one Ch 26 taught for LLM eval, applied to agents: build a small eval set with verifiable rewards, an answer checkable by exact match rather than judged, run the agent against it once per task, and compute pass@1 as the baseline before reaching for partial credit or judge-based scoring.
Verifiable rewards beat both alternatives whenever they’re available: no judge bias to correct for (Ch 26), no rubric to maintain. Ten to twenty tasks with one clearly correct answer each is enough to catch obvious regressions and establish a baseline; scale up only once the eval has earned its keep.
Cost-quality Pareto
The Pareto frontier
Cost matters in production. A -accurate agent at \0.5085%$0.05$ per task, depending on volume and tolerance. The single-metric framing breaks down the moment a real budget enters the picture.
The Pareto frontier is the right tool. Plot configurations on (cost, quality) axes. A configuration is dominated if another exists with lower cost AND higher quality. The non-dominated set, the Pareto frontier, is the meaningful set of choices. Dominated configurations are never the right answer.
Typical cost-quality tradeoffs. The shape is stable even as the names churn: small, fast models sit at the cheap end with lower quality (Claude Haiku, OpenAI’s mini-tier models), frontier models sit at the expensive end with higher quality (Claude Opus and Anthropic’s most capable tier, OpenAI’s flagship reasoning models, Gemini’s Pro/Ultra tier). In that split was Claude Haiku and GPT-4o mini on the cheap end against Claude Opus, GPT-4o, and Gemini Pro on the expensive end; by mid- GPT-4o itself had been retired from general use and every one of those model names had been superseded at least once. Expect the specific names in this paragraph to look dated within another product cycle; the cheap-tier-versus-frontier-tier structure is the durable part. Hybrid configurations: a cheap model for routing and simple subtasks, a frontier model for the hard parts, usually land somewhere on the interior of the frontier, often dominating naive single-model setups.
Engineering levers
Model choice is the biggest lever; bigger is not always better when cost matters. Caching repeats, common subtasks can hit a cache instead of the model. Prompt compression: tighter prompts cost less per call. Self-routing, a cheap model decides whether the frontier model is needed at all. Parallelism versus sequential: parallel often shortens wall-clock latency without changing cost; sequential conserves cost but takes longer.
Production framing: define your cost budget (per task or per month), define your quality floor (minimum acceptable score), find Pareto-optimal configurations that meet both constraints, and iterate as models, prompts, and tools improve. The SWE-bench cost-quality story as of early : cheapest viable around \0.1030%$2550%2025$ figures as illustrative of the shape of the tradeoff, not its present location. The gap is shrinking as smaller models improve.
Agent frameworks: building and observing
Agent-building frameworks
Chapters 27–29 built agents from first principles, loop, tools, schemas, multi-agent composition. Production teams rarely start from that blank slate twice; they reach for a framework. Five options cover most of what teams actually reach for.
LangGraph (LangChain). Graph-based orchestration for a single agent or many: nodes are steps, edges are transitions, and state persists explicitly between them. The same graph-of-nodes model Ch 29 covered for multi-agent orchestration works just as well for one agent with complex control flow, branches, loops, human-in-the-loop interrupts. Strengths: explicit state machine, first-class persistence and checkpointing, a natural fit if a system later grows into multi-agent. Weaknesses: more upfront structure than a simple task needs; a steeper learning curve than writing the loop by hand. When to use: complex state machines, workflows with conditional branches or approval steps, or any agent likely to grow into a multi-agent graph.
smolagents (Hugging Face). A deliberately small agent library built around code-writing agents: instead of emitting a JSON tool call, the agent writes and executes a snippet of Python, and the snippet’s result is the observation. Strengths: a codebase small enough to read end to end in an afternoon; code-as-action is often more expressive than a fixed tool schema for computational tasks. Weaknesses: executing agent-generated code raises the sandboxing stakes past what Ch 28’s tool-safety patterns assume; a smaller ecosystem than LangChain’s. When to use: research, prototyping, or any task where writing code genuinely is the natural action space.
OpenAI Agents SDK. OpenAI’s production agent framework, the successor to the experimental Swarm project (Ch 29). Handoffs between agents, guardrails, and tracing are first-class primitives built around OpenAI’s Responses API. Strengths: minimal boilerplate for an OpenAI-first stack; handoffs and guardrails come built in rather than bolted on. Weaknesses: designed around OpenAI’s API conventions, a poor fit for a multi-provider stack. When to use: OpenAI-first development where the framework and the model vendor are already aligned.
Pydantic AI. An agent framework built on Pydantic’s type system: tool arguments, structured outputs, and dependencies are all typed and validated the same way a Pydantic-based API validates a request. Strengths: malformed tool calls and outputs get caught at the schema level, Ch 28’s tool-schema discipline, enforced by the framework, instead of at runtime; a natural fit for teams already building on Pydantic or FastAPI. Weaknesses: the type discipline is overhead for a quick script or a one-off prototype. When to use: type-heavy production codebases where schema validation is already how the team works.
Anthropic native (no SDK). The API plus a hand-written harness, a loop, a tool-calling schema, your own state management: exactly what Chapters 27–28 built from scratch. Strengths: no framework abstraction between you and the model; every line of control flow is visible; no dependency to track through breaking changes. Weaknesses: you own the plumbing, retries, persistence, multi-agent coordination, that a framework would otherwise provide. When to use: minimal harness needs, or whenever you’d end up writing most of the loop yourself anyway.
Production observability platforms
Building an agent is half the work; operating it is the other half. Whichever framework built it, or none, running it in production needs different tooling: tracing, cost tracking, eval pipelines, regression detection. Five options dominate the observability landscape, each with a clear design center.
LangSmith (LangChain). End-to-end LLM application observability. Trace visualization (a direct callback to Ch 28’s flame graph), dataset management, evaluation pipelines, prompt experimentation. Strengths: tight LangChain integration; mature; most-adopted in the LangChain ecosystem. Weaknesses: opinionated; assumes LangChain conventions. When to use: if you’re on LangChain or LangGraph.
Helicone. Drop-in proxy that captures every LLM call. Cost tracking, latency profiling, cache management, user-level analytics. Strengths: minimal integration overhead; open-source; cost-focused. Weaknesses: less feature-rich than LangSmith for complex workflows. When to use: cost-sensitive deployments; lightweight observability needs.
Braintrust. Evaluation-first LLM platform. Strong eval pipelines, regression detection, prompt experimentation, A/B testing. Strengths: rigorous eval-driven development; engineering-team focused. Weaknesses: steeper learning curve. When to use: teams running rigorous evals as part of their development workflow.
Anthropic’s evaluation tooling. Integrated with Anthropic’s Console and Claude apps. Evaluation playgrounds, prompt comparison, safety tooling. Strengths: tight integration with Anthropic models; safety-aware. When to use: Anthropic-native deployments.
OpenTelemetry GenAI conventions. Open standard for LLM trace data, standardized span attributes for model name, token counts, costs. Strengths: future-proof; vendor-neutral. Weaknesses: requires manual instrumentation. When to use: when vendor independence matters.
The convergence: most platforms now adopt OpenTelemetry-compatible conventions for span attributes. The plumbing is standardizing; the UX, UI, and surrounding workflow are what differentiate them. The framework graveyard of the last three years suggests that products that fight the convergence age poorly.
Choosing an observability platform
Three factors decide it in practice. Team familiarity beats everything else, the framework your team already knows is rarely the bottleneck, and the framework your team doesn’t know often is. Stack alignment, LangChain stacks fit LangSmith; cost-focused setups fit Helicone; eval-driven teams fit Braintrust. Vendor independence: if lock-in concerns dominate, OpenTelemetry’s neutral conventions let you swap platforms behind a stable instrumentation layer.
Deployment patterns and readiness
Five deployment patterns
Going from prototype to production requires more than hosting. Five deployment patterns show up in production agent systems; most mature deployments combine several.
One. Staging environments. Production-like with non-production data. Run regression eval before promoting to production. Catches breakage from prompt and model changes before users see it.
Two. Canary deployment. Roll out changes to a small percentage of traffic first. Monitor cost, latency, and quality. Roll back if metrics regress. The standard pattern for production agent deployments, named, fittingly, after the coal-mine canary that died before the miners did.
Three. A/B testing. Two versions in parallel; statistical significance for quality comparisons. Effective for prompt changes, model swaps, tool design changes. Watch the sample size, LLM outputs are stochastic and small samples mislead.
Four. Shadow deployment. New version runs in parallel without affecting users; outputs are compared offline. Lower risk than A/B; slower to learn from. Useful when the downside of a bad version is severe.
Five. Feature flags. Toggle agent features on and off without a code deploy; enable per-user rollouts; rollback in seconds. The fast-rollback option matters more for agent systems than for traditional services because failure modes are subtler and detection is slower.
The production-readiness checklist
| Category | Checks |
|---|---|
| Functionality | Benchmark threshold met; manual QA passed; edge cases tested |
| Reliability | pass threshold; tool failures handled; timeouts configured |
| Cost | Per-task cost within budget; cost alerting; rate limiting |
| Latency | p50 / p95 / p99 measured; SLA defined; latency alerting |
| Safety | Sandboxing for dangerous tools; safety eval passed |
| Observability | All LLM calls traced; structured logging; PII redaction |
| Deployment | Staging environment; canary pattern; rollback procedure |
| Operations | On-call runbook; incident response; post-mortem template |
The transition from prototype to production is where most agent projects stall. This checklist makes the transition concrete. Each row is a category, not a single check; the items are the ones production agent teams discover (often the hard way) in the first six months of deployment.
The agent arc, reviewed
The four chapters
Part IX covered the agent stack in four chapters, each handling a distinct layer.
| Chapter | Topic | Taught |
|---|---|---|
| Ch 27 Agent foundations | Conceptual | The loop; ReAct; AutoGPT lessons; patterns and anti-patterns |
| Ch 28 Agents from scratch | Engineering | Tool design, schemas, error handling, observability, scaffolding (the ) |
| Ch 29 Multi-agent | Composition | Architectures, communication, role specialization, frameworks, honest assessment |
| Ch 30 (this) | Discipline | Evaluation, observability frameworks, deployment, production readiness |
The Part IX arc is short to state. Ch 27 to Ch 28: concept to working code. Ch 28 to Ch 29: one agent to many. Ch 29 to Ch 30: building to evaluating. Each chapter builds directly on the prior; each delivers a layer the next composes on top of.
What the reader can now do
After Part IX the reader can design an agent loop appropriate to a task, picking from the patterns of Ch 27. Implement production-grade agents with proper tools, schemas, error handling, and observability, applying the engineering of Ch 28. Decide when multi-agent is warranted and, equally importantly, when it isn’t, using the calibration of Ch 29. Evaluate agent systems with appropriate methodologies, pass, Pareto, regression monitoring, from this chapter. Deploy agents to production with the right observability and safety patterns. None of these are theoretical; each comes with code the reader has worked through and widgets the reader has played with.
Where agents stand today: agents are real, useful, and improving fast. The benchmark numbers this chapter opened with (SWE-bench Verified around , OSWorld around , -bench pass around ) already look dated, by mid- frontier systems had pushed all three well past those marks (Section 2), and the numbers will have moved again by whenever you’re reading this. That climb is itself evidence of how fast capability is still being built, but production-readiness hasn’t kept pace with benchmark scores; the gap between “scores well on a benchmark” and “ready for production” (this chapter’s central argument) is the more durable fact than any single percentage. The reader leaving Part IX has the practical foundation to build agent systems that survive production traffic, and the calibration to avoid over-engineering them.
Exercises
Four exercises that lock in the discipline this chapter brings to agent systems. Each is a self-contained problem with a starting template; hints are collapsed by default; try the problem first.
The exercises trace the chapter’s argument: design evaluation for a specific task (Ex 1) → compute pass from raw data (Ex 2) → identify the Pareto frontier (Ex 3) → audit a production-readiness gap (Ex 4). After these, the reader has the practical discipline to evaluate any agent system being prepared for production, and to recognize systems that aren’t ready.
Exercise 1 (easy): Evaluation methodology design
For each of four agent tasks, design an evaluation approach: pick the appropriate benchmark (or note “no benchmark fits”); choose methodologies (success rate, pass, partial credit, human-judged, LLM-as-judge); identify what counts as success. The point is to develop the judgment that no single methodology fits all tasks.
Hint
The decision heuristic from the chapter:
| Task type | Benchmark candidate | Methodology |
|---|---|---|
| Coding tasks | SWE-bench Verified (Python-only; a non-Python repo needs a custom eval) | Benchmark + regression monitoring |
| Customer service | -bench-like setup | pass () + human judgment (sample) |
| Web research | BrowseComp | Exact-match + LLM-as-judge for partial |
| Computer use | OSWorld | State-based verification |
| Subjective tasks (writing) | None directly | Human judgment + LLM-as-judge for scale |
| Novel/proprietary tasks | None | Custom eval dataset + appropriate metrics |
When no benchmark fits: build a custom eval set. The methodology matters more than the benchmark.
Solution
Match on task type, not literal words: coding tasks route to SWE-bench Verified unless the repo is non-Python (SWE-bench is Python-only, so a JavaScript repo needs a custom eval built the same way), customer-service needs pass because reliability across repeated attempts matters more than any single success, subjective writing tasks need a human in the loop with LLM-as-judge for scale, and computer-use tasks need state verification since there’s no single text output to compare.
def design_evaluation(task):
desc = task['description'].lower()
if 'coding' in desc or 'github issue' in desc:
if 'javascript' in desc or 'js ' in desc:
return ('custom', ['success_rate', 'regression_monitoring'],
"Issue resolved and tests pass (SWE-bench Verified is Python-only; "
"a JS repo needs a custom eval built the same way)")
return ('SWE-bench Verified', ['success_rate', 'regression_monitoring'],
"Generated patch makes the target repo's test suite pass")
if 'customer' in desc or 'refund' in desc:
return ('custom', ['pass^k', 'human_judged'],
'Refund resolved per policy across repeated attempts, sampled for human review')
if 'blog' in desc or 'writes' in desc or 'marketing' in desc:
return ('custom', ['human_judged', 'llm_as_judge'],
'Human editors rate voice/quality; LLM-as-judge scores the rest for scale')
if 'spreadsheet' in desc or 'clicking' in desc or 'excel' in desc:
return ('OSWorld', ['state_verification'],
'Final spreadsheet state matches the expected cell values/formulas')
return ('custom', ['human_judged'], 'No heuristic matched; default to human judgment')Output: task_1 (JS coding) -> custom / success_rate, regression_monitoring; task_2 (refunds) -> custom / pass^k, human_judged; task_3 (blog posts) -> custom / human_judged, llm_as_judge; task_4 (spreadsheet) -> OSWorld / state_verification. Only the computer-use task lands on a public benchmark: everything else needs a custom eval, which is the point.
Exercise 2 (medium): pass computation from raw trial data
Given raw trial results (lists of pass/fail across multiple independent runs), compute pass for . Demonstrate empirically that pass decays fast with , the gap -bench surfaced and that production deployments must worry about.
Hint
pass formula:
- pass = mean over trials of [all attempts succeeded]
- Equivalent: if independent, where
- In practice, runs aren’t independent (shared model, shared prompt), but the formula holds well enough
Implementation:
- For each group of consecutive trials, check if ALL succeeded
- Average across groups
- Higher = lower pass
Solution
Chunk the flat trial list into groups of and average the all-succeeded indicator over groups.
def pass_at_k(trials, k):
groups = [trials[i:i + k] for i in range(0, len(trials) - len(trials) % k, k)]
return sum(all(g) for g in groups) / len(groups)With random.seed(42) and the scaffold’s simulate_trials calls, the actual pass table is:
Task pass^1 pass^2 pass^4 pass^8
--------------------------------------------------------------
task_easy 92% 84% 70% 44%
task_medium_high 71% 52% 28% 8%
task_medium 57% 31% 10% 0%
task_medium_low 34% 16% 4% 0%
task_hard 18% 4% 0% 0%pass tracks each task’s intrinsic success rate closely (92%, 71%, 57%, 34%, 18% against nominal 92/75/60/40/25, sampling noise at ). pass collapses fast: the “easy” task drops from 92% to 70%, and anything at or below 60% single-shot is functionally unusable at (10% or worse). This is the reliability gap -bench surfaces: high pass does not imply a system survives multiple consecutive attempts.
Exercise 3 (medium): cost-quality Pareto frontier identification
Given agent configurations on (cost, quality), identify which are Pareto-optimal (non-dominated) and which are dominated. Visualize the frontier as a sorted list. The exercise reinforces the chapter’s framing: dominated configurations are never the right choice.
Hint
Pareto-optimal: a configuration is Pareto-optimal if no other configuration has lower cost AND higher quality.
Algorithm:
- For each configuration, check whether any other dominates it
- dominates if AND AND ( OR )
- Non-dominated configs = the Pareto frontier
The non-dominated set is the set of meaningful choices. Pick a point on it based on your cost budget and quality floor.
Solution
is_dominated_by implements the definition directly; pareto_frontier keeps configs no other config dominates, sorted by cost.
def is_dominated_by(c, other):
return (other['cost'] <= c['cost'] and other['quality'] >= c['quality']
and (other['cost'] < c['cost'] or other['quality'] > c['quality']))
def pareto_frontier(configs):
non_dominated = [c for c in configs
if not any(is_dominated_by(c, o) for o in configs if o is not c)]
return sorted(non_dominated, key=lambda c: c['cost'])Result: 8 of the 10 configs are Pareto-optimal. The two dropped are opus-bad-prompt (cost 0.95, quality 0.70, dominated by sonnet-tuned at cost 0.20, quality 0.71, and also by opus-only-default) and sonnet-bloated (cost 0.30, quality 0.60, dominated by sonnet-only-default at cost 0.15, quality 0.65). Note the loop that reports “dominated by X” prints the first dominator it finds while scanning CONFIGS in list order, not necessarily every config that dominates; both bad configs are in fact dominated by more than one entry.
Exercise 4 (hard): Production-readiness audit
Given a description of an agent system being prepared for production, audit it against the -category readiness checklist. Identify gaps; propose specific actions to close each gap. The exercise builds the practical skill of evaluating whether a system is genuinely ready to ship.
Hint
The 8-category checklist:
| Category | Sample checks |
|---|---|
| Functionality | Benchmark performance meets threshold; manual QA passed; edge cases tested |
| Reliability | pass threshold; tool failures handled; timeouts configured |
| Cost | Per-task cost within budget; cost alerting; rate limiting |
| Latency | p50/p95/p99 measured; SLA defined; alerting |
| Safety | Sandboxing for dangerous tools; safety eval passed |
| Observability | All LLM calls traced; structured logging; PII redaction |
| Deployment | Staging environment; canary pattern; rollback procedure |
| Operations | On-call runbook; incident response; post-mortem template |
Audit pattern: for each category, list what the description says (or doesn’t say), then identify the gap, then propose a specific action.
Solution
Scan the description for evidence of each check with a keyword lookup, and mark anything unmentioned as a gap with a concrete action.
EVIDENCE = {
'Manual QA': ['tested manually', 'manual eval'],
'Per-task budget': ['cost per query is estimated'],
'Tool sandboxing': ['domain allowlist', "can't write to the", "can't run shell"],
'All calls traced': ['log every llm call'],
'Structured logging': ['log every llm call to cloudwatch'],
# everything else (Benchmark threshold, Edge cases, pass^k threshold,
# Tool failure handling, Timeouts, Cost alerting, Rate limiting,
# p50/p95/p99 measured, SLA defined, Latency alerting, Safety eval,
# PII redaction, Staging env, Canary pattern, Rollback procedure,
# On-call runbook, Incident response, Post-mortems) has no keywords:
# the description never addresses them, so they're gaps by default.
}
def audit(description, checklist):
desc = description.lower()
result = {}
for category, checks in checklist.items():
covered, gaps, actions = [], [], []
for check in checks:
if any(kw in desc for kw in EVIDENCE.get(check, [])):
covered.append(check)
else:
gaps.append(check)
actions.append(f"Add {check.lower()} before launch")
result[category] = {'covered': covered, 'gaps': gaps, 'actions': actions}
return resultRunning this over SYSTEM_DESCRIPTION: 5 checks come back covered (Manual QA, Per-task budget, Tool sandboxing, All calls traced, Structured logging) and 18 gaps across all 8 categories, including all of Reliability, all of Latency, all of Deployment, and all of Operations. total_gaps = 18 > 5, so the audit prints "Not ready to ship. Address gaps before deployment." A system that “looks good” on a 30-question manual eval is nowhere close to production-ready by the 8-category standard.
The curriculum closes
Thirty chapters
Thirty chapters. From numpy primitives in Ch 1 to agent systems in production in Ch 30. Looking back over the arc, the curriculum’s nine parts each carried a distinct piece of the modern LLM stack, and each, in retrospect, set up the part that came after it.
Part I, Foundations (Ch 1–3). Tokens, embeddings, basic neural building blocks. Implemented in numpy from first principles. Matrix multiplication and softmax: the substrate of everything that followed. The chapters that set the discipline of the curriculum: nothing is allowed to remain magic.
Part II, The Transformer (Ch 4–6). Attention, multi-head attention, positional encoding, the full transformer block. The architectural pattern that powered the field. You implemented it from scratch, and from that point on, every model the rest of the curriculum touched was a variation, an extension, or a deployment story for the pattern built here.
Part III, Pre-training (Ch 7–10). Training objectives. Scaling laws (Chinchilla; Hoffmann ). Data curation. Distributed training. How frontier models actually get made: not just in theory but in engineering practice. The infrastructure chapters in particular grounded what “training a frontier model” actually costs and looks like.
Part IV, Alternative Architectures (Ch 11–12). Mixture of experts; state-space models. The alternatives to dense transformers, Mixtral, Mamba, the diversity of the architectural landscape. Most production is still transformer-dominated, but the alternatives matter for what they reveal about the design space.
Part V, Post-training (Ch 13–16). Supervised fine-tuning; RLHF; DPO; constitutional AI; parameter-efficient methods; distillation. From base models to assistants, from “predicts the next token” to “answers helpfully and harmlessly.” The chapters that turned LLMs into the products the field actually ships.
Part VI, Inference (Ch 17–19). KV-caching; quantization; speculative decoding; sampling strategies. The engineering that makes serving fast and affordable: the ms-per-token versus ms-per-token difference between a toy and a product. The chapters most readers will revisit when their costs blow up.
Part VII, Capabilities (Ch 20–23). Reasoning (chain-of-thought, scratchpads, test-time compute). Tool use. Retrieval-augmented generation. Multimodal. What LLMs can do beyond text generation, and the engineering patterns that make each capability tractable.
Part VIII, Discipline (Ch 24–26). Safety, interpretability, evaluation. The three disciplines that turn impressive capability into trustworthy products. This is where the curriculum stopped accumulating features and started insisting on rigor. Ch 26 in particular set up the move this chapter completes.
Part IX, Agents (Ch 27–30). Foundations, engineering, composition, evaluation. The composition of every layer that came before: capable models (Parts I–VII), made trustworthy (Part VIII), assembled into systems that observe, think, act, iterate, and prove themselves in production. The closing arc.
What’s not covered
No curriculum covers everything. This one explicitly does not cover specific model implementations (Llama, Claude, GPT internals, vendor-specific and changing); hardware design (TPUs, chips, beyond the chapters on infrastructure); the latest research papers (the field moves faster than any curriculum can); specific business applications (each industry has its own patterns and constraints). What this curriculum did instead was build the substrate that lets you read those things, papers, vendor docs, industry write-ups, and understand them on first pass.
What comes next
For the field, the directions are clear in shape if not in detail. Better reasoning, test-time compute scaling, reasoning models in the o1 and o3 lineage, novel objectives. Better agents: more reliable, more capable, more autonomous within bounded scopes. Better safety: interpretability scaling, alignment research, the methods that make capability claims trustworthy. Better efficiency: smaller models with frontier capability, the cost curve continuing to drop. Better integration, LLMs as components in larger software systems, not as standalone products.
You have the foundation to follow any of these directions. The chapters that taught the substrate, Ch 1’s numpy, Ch 4’s attention, Ch 26’s evaluation discipline, Ch 28’s agent engineering, are the same chapters that will let you read the papers and write the systems that come next.
One last thing
Thirty chapters. From the first matrix multiplication to the last production agent. You started with numpy and ended with systems that observe, think, act, and iterate at production scale. The field will keep moving, new architectures, new capabilities, new failure modes, new disciplines. What this curriculum gave you is the foundation to follow.
The attention operation is still the same matrix multiplication and softmax it was in Chapter 4. The agent loop is still the same observe-think-act it was in Chapter 27. The principles don’t change as fast as the products. When the next breakthrough lands, and it will, you’ll be reading the paper with the substrate to understand it.
That’s what this curriculum was for.
Now go build.