LevelUpWith

Explore / AI Engineering

AI Evals as Infrastructure: LLM Apps and Agents

Build evals that tell you when an LLM app or agent has really improved: start from trace-led error analysis, build golden datasets, write code checks, calibrate LLM judges against human labels, gate releases in CI and monitor in production.

Read lesson 1 free →

Levels 1 and 2 are free to read, no account needed. Levels 3 and 4 are free with a free account, and so are 20 answers from the AI tutor.

Photographic 3D course artwork for AI Evals as Infrastructure: LLM Apps and Agents

Expert · 40 levels · 4 free · Created Nov 2026 · Professionally curated by levelupwith.com

What's inside

  1. Level 1: Why Vibes Fail: What an Eval Actually AnswersFree
    Learn why trying a few prompts by hand stops working once an LLM app ships, and how to turn vague doubts into specific questions an eval can answer, such as 'did this prompt change break refund handling?'
    • Explain three ways that hand-testing a few prompts misleads you: too few cases, results you remember selectively, and model output that varies from run to run
    • Rewrite a vague quality worry about an LLM feature as a specific question an eval can answer, with a clear yes or no outcome
    • Tell apart the questions an eval answers (is it good enough to ship, did it get worse, which version is better) from questions it cannot answer
  2. Level 2: Anatomy of an Eval: Evals as InfrastructureFree
    Break an eval into its parts (input, the system under test, output, check, score and aggregate) and see how it differs from a unit test when the system's output varies from run to run.
    • Write a minimal eval loop in Python or TypeScript that runs a list of inputs through a model API and records a pass or fail for each one
    • Explain why an eval reports a pass rate across many cases, not one green or red result, and why you run cases more than once when output varies
    • Name the parts of an eval that must be versioned and kept, as you would any other infrastructure: dataset, prompt, model ID, checks and results
  3. Level 3: Traces: Recording What Your App Actually Did
    Add tracing to a small LLM app so every request records its inputs, prompts, model calls, tool calls, outputs, token counts and timing, which is the raw material for all later analysis.
    • Add tracing to a small LLM app in Python or TypeScript so each request produces one trace, with a nested span for each model call and tool call
    • Choose which fields to capture in every trace (model ID, prompt version, tokens, latency, errors) and which to leave out for privacy reasons
    • Export traces in a format you can read and query later, such as JSONL or OpenTelemetry-style spans
  4. Level 4: Error Analysis: Reading Traces Like a Reviewer
    Learn a repeatable way to read a sample of traces, find the first thing that went wrong in each one, and avoid only looking at the cases you happen to remember.
    • Pick a sample of traces to review (random plus targeted) and decide when you have read enough
    • Find the first point of failure in a multi-step trace, separating it from later errors that it caused
    • Set up a simple review tool (a notebook, spreadsheet or small web page) so you can read and annotate traces quickly
  5. Level 5: Open Coding: Naming Failures in Your Own Words
    Write short free-text notes on each failing trace, describing what went wrong before any categories exist, so the categories come from your data and not from guesses made in advance.
    • Write specific open-coding notes, such as 'quoted last year's price', and avoid vague ones such as 'bad answer'
    • Explain why fixed categories decided in advance hide the failures that actually matter
    • Open-code a batch of traces and keep the notes linked to their trace IDs
  6. Level 6: Axial Coding: Building a Failure Taxonomy
    Group your open-coding notes into a small set of distinct failure categories (a failure taxonomy), refine the categories as you review more traces, and count how often each one occurs.
    • Group open-coding notes into failure categories that do not overlap and that someone else could apply the same way, each with a definition and examples
    • Use an LLM to suggest groupings for your notes, then check and correct its suggestions yourself
    • Produce a table of how often each failure category occurs and spot when the categories need splitting or merging
  7. Level 7: From Taxonomy to Action: Fix It or Eval It
    Decide, for each failure category, whether to just fix it (for example a missing instruction in the prompt or a bug in your code) or to build an ongoing eval for it, based on how often it happens, how much it costs and how hard it is to fix.
    • Separate failures caused by unclear instructions, which you fix directly, from failures the model makes even with clear instructions, which need ongoing evals
    • Rank failure categories by how often they happen and how much harm they do, to choose the first few evals worth building
    • Write a one-page eval plan that links each chosen failure category to a dataset need and a check type
  8. Level 8: Golden Datasets: Structure and Schema
    Design a golden dataset (a fixed set of example inputs with known-good answers or criteria) as typed, versioned data, with inputs, reference outputs or criteria, metadata and tags that link each example to a failure category.
    • Define a schema for golden examples in Python (Pydantic) and TypeScript (Zod), stored as JSONL
    • Tag each example with its failure category, source and difficulty so results can be broken down by tag
    • Load the dataset and validate every example against the schema before an eval run starts
  9. Level 9: Seeding Goldens from Production and Your Taxonomy
    Fill a golden dataset with real traffic and reviewed traces, sampled by category (stratified) so every failure category and important user group is covered, not only the common happy paths.
    • Convert reviewed production traces into golden examples, removing or anonymising personal data
    • Sample by failure category and user segment so rare but costly cases are included
    • Measure the dataset's coverage against the failure taxonomy and list the gaps
  10. Level 10: Writing References, Rubrics and Labeling Guides
    Write reference answers and pass/fail criteria (rubrics) that a second person would apply the same way, and record the decisions in a labeling guide so labels stay consistent over time.
    • Decide for each example whether to store an exact reference answer, a set of acceptable answers, or criteria the output must meet
    • Write a labeling guide with clear pass and fail examples for each criterion
    • Run a small labeling round with two people and settle disagreements by updating the guide
  11. Level 11: Adversarial Datasets: Edge Cases and Attacks
    Build a separate set of adversarial examples: edge cases, unclear requests, prompt injection, requests the app should refuse, and attempts to misuse its tools, to test robustness and safety on purpose.
    • Write adversarial cases for one app, covering edge cases, prompt injection and inputs that tempt the model to use its tools wrongly
    • Keep adversarial examples separate from typical ones and report their pass rates separately
    • Explain why adversarial pass rates should not be averaged into overall quality scores
  12. Level 12: Synthetic Data: Generating Varied Test Inputs
    Use LLMs to generate test inputs by first listing dimensions such as user type, intent and complexity, then combining them, instead of asking a model for '50 test questions'.
    • Define the dimensions and their values for a use case, then sample combinations of them before generating any text
    • Generate realistic inputs from those combinations with two different model providers in Python or TypeScript
    • Read through and filter the generated inputs by hand before any of them reach the dataset
  13. Level 13: Synthetic Data Traps: Sameness, Leakage, Self-Grading
    Spot and avoid the main problems with synthetic data: inputs that all look alike, eval examples that also appear in your prompt's examples, and a model generating and grading cases in its own style so it scores well on them.
    • Measure how varied a synthetic set is, using near-duplicate checks and comparing its spread across the dimensions with real traffic
    • Find leakage between the eval set and the few-shot examples in your prompt or other prompt material
    • Explain the risk of generating, answering and grading with the same model family, and reduce it by mixing providers and checking a sample against human labels
  14. Level 14: Dataset Hygiene: Versioning, Splits and Upkeep
    Keep datasets in good working order: versioned and deduplicated, split into a development set and a held-out set, and updated on a regular schedule as the product and its traffic change.
    • Version datasets alongside code and record which dataset version produced each eval result
    • Keep a held-out set that is never used while tuning prompts, so you can spot overfitting to the development set
    • Set up a regular routine for adding new failures, retiring outdated examples and removing duplicates
  15. Level 15: Exact and Programmatic Checks
    Start with the cheapest checks that give the same answer every time: exact match, normalised match, JSON schema validation, regular expressions, numeric tolerances, and running generated code or SQL to see if it works.
    • Write reusable check functions in Python and TypeScript for exact match, normalised match, schema validity and numeric tolerance
    • Check generated code or SQL by running it in a sandbox and comparing the results, not the text
    • Identify which failure categories in your taxonomy can be fully covered by code alone
  16. Level 16: Binary Criteria: Pass/Fail Beats 1-to-5 Scales
    Learn why pass/fail checks on one specific criterion each are easier to label, automate and act on than 1-to-5 quality scores, and how to split a fuzzy quality goal into binary criteria.
    • Split a fuzzy goal such as 'helpful answer' into several specific pass/fail criteria
    • Explain the downsides of 1-to-5 scales: labelers disagree on them, the scores shift over time, and they don't tell you what to fix
    • Map each binary criterion to the cheapest check that can decide it: code or a model judge
  17. Level 17: LLM-as-Judge: Building Your First Judge
    Build an LLM judge (a model prompted to grade outputs) for one binary criterion, with a narrow prompt, a clear pass/fail definition, examples, and a short written reason before the verdict, and run it across Claude, OpenAI, Gemini and an open-weight model.
    • Write a judge prompt for one criterion that returns structured output: a short reason followed by a pass or fail verdict
    • Run the same judge through several providers' APIs behind one shared interface in Python or TypeScript
    • Explain why one judge per criterion is easier to fix and trust than one judge that grades everything
  18. Level 18: Calibrating Judges Against Human Labels
    Treat the judge as a classifier to be measured: collect human labels, split them into tuning and test sets, and adjust the judge prompt until it matches people on both the passes and the failures.
    • Build a set of human-labeled outputs and split it into training, development and test sets for the judge
    • Measure how often the judge catches real passes and how often it catches real failures (true positive and true negative rates), instead of overall accuracy alone
    • Improve the judge prompt using the development set only, and report final performance on the untouched test set
  19. Level 19: Measuring Agreement and Correcting Pass Rates
    Measure how often the judge agrees with human labels, and how often two humans agree with each other, using agreement beyond chance (Cohen's kappa) and confidence intervals, then correct the judge's raw pass rate for its known errors.
    • Compute raw agreement and Cohen's kappa between a judge and human labels, and between two human labelers, in code
    • Put a confidence interval on a pass rate using bootstrap resampling, and explain what sample size the interval requires
    • Adjust a judge's raw pass rate using its measured true positive and true negative rates to estimate the real pass rate
  20. Level 20: Pairwise Comparison and Judge Biases
    Compare two versions of a system by asking a judge which of two outputs is better, and control for the judge's known biases toward the first-listed answer, longer answers and its own model family's style.
    • Build a pairwise judge that grades each pair twice with the order swapped and records ties and inconsistent verdicts
    • Measure the judge's bias toward first position and toward longer answers on your own data
    • Decide when pairwise comparison is the right tool (choosing between prompt or model versions) and when to use single-output pass/fail checks
  21. Level 21: Pairwise Comparison: A/B Judging Without Bias
    Learn when it works better to ask a judge which of two outputs is better than to score each one on its own, and how to control the position, length and self-preference biases that make pairwise results unreliable.
    • Build a pairwise judge in Python or TypeScript that runs every comparison in both orders and counts any disagreement between the two orders as a tie or an inconsistency
    • Turn a set of pairwise verdicts into win rates with confidence intervals, and decide whether the gap between two prompt or model versions is real
    • Check a pairwise judge against human preference labels and report how often they agree, and how often the judge is consistent with itself
  22. Level 22: Judges Hallucinate Too: Cheap Second Checks
    Catch judge mistakes with cheap, independent safeguards: code checks on the judge's cited evidence, a quote-must-exist rule, a second judge from a different model family, and human review of a sample where verdicts disagree.
    • Make judges return structured verdicts with quoted evidence, and use string matching to confirm each quote really appears in the output being graded
    • Run a small model from a different family as a second judge, and send only the cases where the two judges disagree to human review
    • Estimate how much of the judge's error the second checks catch, and what they cost per 1,000 graded examples
  23. Level 23: Agent Trajectory Evals: Grading the Path
    Move from grading a single output to grading an agent's whole trajectory. Score the end state, the steps taken and wasted effort separately, and know when the path matters and when only the outcome does.
    • Turn an agent trace into a list of steps you can assert against, and write outcome checks that inspect the final environment state rather than the agent's own claims
    • Write trajectory checks for forbidden actions, step budgets and loops, and use a judge only where intent cannot be checked in code
    • Explain why grading against one 'correct' trajectory punishes valid alternative solutions, and choose between outcome, process and hybrid scoring
  24. Level 24: Tool-Call Correctness Across Model APIs
    Evaluate whether an agent picks the right tool, passes valid arguments and handles tool errors, using fixtures you can replay against Claude, OpenAI, Gemini and open-weight models through their different tool-calling formats.
    • Normalise tool calls from different provider APIs into one shared schema so the same checks run against every model
    • Write checks for tool selection, argument validity against a JSON Schema, and argument meaning, such as correct IDs and correct units
    • Inject tool failures and timeouts with mocked tools, and measure whether the agent recovers, retries sensibly or reports the failure honestly
  25. Level 25: Multi-Turn Evals and Simulated Users
    Evaluate conversations instead of single turns. Drive the agent with scripted or LLM-simulated users, then grade context retention, clarifying questions and whether the user's goal was met by the end.
    • Build a simulated user from a persona, a goal and a hidden-information spec, and keep it from drifting off-script or solving the task itself
    • Grade a conversation on goal completion, turn count and specific failures such as forgotten constraints or contradicting earlier turns
    • Spot where simulated users mislead you, and sample real multi-turn sessions to check that the simulator behaves like real users
  26. Level 26: Non-Determinism: pass@k, pass^k and Repeated Trials
    Treat agent results as random variables. Run each task several times, report pass@k and pass^k (pass at k vs. pass on all k tries), and size the trial count so a comparison across models means something.
    • Run each eval task several times and report per-task success rates instead of a single pass or fail
    • Explain when pass@k (success in at least one of k tries) and when pass^k (success in all k tries) matches what the product needs, and compute both from repeated runs
    • Estimate how many tasks and trials you need before a difference between two models or prompts stands out from the noise
  27. Level 27: Public Benchmarks: SWE-bench and Terminal-Bench
    Learn what public agent benchmarks actually measure, how SWE-bench and Terminal-Bench 2.0 grade tasks, and why a leaderboard score is a weak predictor of how a model will do on your own workload.
    • Describe how SWE-bench variants grade with repository tests and how Terminal-Bench 2.0 grades containerised terminal tasks through its Harbor harness
    • Run a small slice of a public benchmark locally and inspect individual failures, not just the aggregate score
    • Explain how scaffolding, the harness and broken tasks change the scores, using the 2026 disputes over SWE-bench Verified and SWE-Bench Pro as case studies
  28. Level 28: Contamination and Private Held-Out Evals
    Understand how benchmark data leaks into training, how to look for signs of memorisation, and how to protect your own evals from the same fate with private, refreshed held-out sets.
    • Look for signs of contamination by comparing performance on public tasks with performance on fresh, structurally similar tasks you write yourself
    • Set up a policy for keeping golden and held-out sets private, out of prompts and few-shot examples, and away from coding agents' context
    • Plan a refresh schedule for your eval sets, and explain why the field's practice for handling contaminated benchmarks is still unsettled
  29. Level 29: Regression Suites in CI
    Package datasets, checks and judges into a regression suite that runs automatically on every prompt, model or code change, with caching, tiered suites and results you can reproduce.
    • Wire an eval suite into a CI pipeline (for example, GitHub Actions) that runs a fast smoke tier on every pull request and a full tier on merge or nightly
    • Pin model versions, seeds, dataset versions and judge prompts so a failure can be reproduced and traced to a specific change
    • Cache model responses and judge verdicts to keep CI cost and runtime within budget without hiding real regressions
  30. Level 30: Release Gates: Thresholds That Survive Noise
    Turn eval results into release decisions. Set per-metric thresholds, block on regressions of critical slices, and use statistical comparison instead of raw score differences so gates neither cry wolf nor wave real regressions through.
    • Define gate rules with hard floors for safety-critical checks and tolerance bands for noisy quality metrics
    • Compare a candidate against a baseline with paired, per-example tests and confidence intervals, and fail the gate only when a drop is significant
    • Set up an override and review process for gate failures that leaves an audit trail
  31. Level 31: Online Evaluation: Sampling Production Traffic
    Extend evaluation into production by sampling live traces, running async checks and judges on them, collecting user feedback signals, and feeding the failures back into your datasets.
    • Design a sampling strategy (uniform, stratified and error-weighted) that covers rare but important slices at a fixed judging budget
    • Run reference-free checks and judges asynchronously on sampled traces without adding latency to user requests
    • Close the loop by routing flagged production failures into error analysis and then into new golden or regression examples
  32. Level 32: Guardrail Metrics and Drift Detection
    Track the production signals that tell you something has broken (refusal rates, error rates, tool failure rates, output length and judge scores) and detect drift in inputs or behaviour before users report it.
    • Choose a small set of guardrail metrics with alert thresholds, and separate them from the quality metrics you optimise
    • Detect input drift by comparing the distribution of production queries with your eval set's coverage, and spot behaviour drift after a provider updates a model
    • Explain why drift detection for LLM outputs is still an immature practice, and which simple baselines work in the meantime
  33. Level 33: Cost and Latency as Eval Dimensions
    Measure tokens, dollars, time to first token, end-to-end latency and agent step counts alongside quality, and make trade-off decisions across Claude, OpenAI, Gemini and open-weight models with all of them in view.
    • Record cost and latency per eval example, and report percentiles (p50, p95) instead of averages
    • Plot quality against cost and latency for several models or configurations, and pick the options that no other option beats on every axis
    • Add cost and latency budgets to the CI gate so a quality gain cannot quietly double the bill or the response time
  34. Level 34: Tooling Compared: promptfoo, Inspect, OpenAI Evals
    Compare code-first eval frameworks by building the same small eval in each. Look at how they define datasets, scorers and agent tasks, what they run locally, and where each one fits.
    • Implement the same eval in promptfoo and Inspect, and describe the trade-offs in configuration style, extensibility and agent support
    • Explain what OpenAI Evals offers today, and the lock-in you take on by using a provider-hosted eval service
    • Write down selection criteria based on your own constraints, not on feature lists
  35. Level 35: Tooling Compared: Braintrust, Langfuse, Phoenix, LangSmith
    Compare tracing and eval platforms on tracing, OpenTelemetry support, datasets, online evaluation, human annotation, self-hosting and pricing models, without favouring any one of them, and plan an exit path from whichever you choose.
    • Send the same instrumented agent's traces to at least two platforms, and compare how each supports error analysis and annotation
    • Assess the platforms on self-hosting, data residency, OpenTelemetry compatibility and how easily you can export your data
    • Keep datasets, checks and judge prompts in your own repository so switching platforms costs days, not months
  36. Level 36: Capstone 1: The Agent, Traces and Failure Taxonomy
    Start the capstone by instrumenting a small tool-using agent, collecting traces, running open and axial coding on its failures, and producing the failure taxonomy that will drive the suite.
    • Instrument a small tool-using agent in Python or TypeScript with tracing that works against at least two model providers
    • Read and code at least 50 traces, and group the failures into a ranked taxonomy
    • Write an eval plan that maps each failure category to the dataset slice and check type that will cover it
  37. Level 37: Capstone 2: Dataset and Code-Based Checks
    Build the capstone's versioned golden, adversarial and synthetic datasets, and cover as many failure categories as possible with exact, programmatic, tool-call and trajectory checks before reaching for a judge.
    • Assemble a versioned dataset with golden, adversarial and carefully filtered synthetic slices, each traced back to a taxonomy category
    • Implement deterministic checks for output format, tool-call correctness, end-state outcomes and trajectory constraints
    • Report pass rates per slice over repeated trials, and identify which categories still need a judge
  38. Level 38: Capstone 3: A Calibrated Judge with Second Checks
    Build the capstone's LLM judge for the categories code cannot check, calibrate it against your own human labels with measured agreement, and harden it with cheap second checks.
    • Hand-label a calibration set, then iterate on a binary judge until it reaches agreement with human labels that you measure and report
    • Report the judge's true positive and true negative rates on a held-out split, and correct the aggregate pass rate for known judge error
    • Add evidence verification and a cross-family second judge, and record judge cost per run
  39. Level 39: Capstone 4: CI Gate and Production Loop
    Wire the capstone suite into CI as a release gate with cost and latency budgets, then add sampled online evaluation and guardrail metrics that feed new failures back into the dataset.
    • Run the full suite in CI with tiered runs, pinned versions, caching and a noise-aware gate that blocks a deliberately introduced regression
    • Add online sampling with async checks and guardrail alerts on simulated production traffic
    • Show the full loop: a production failure becomes a new regression example that the gate then enforces
  40. Level 40: Final Challenge: Defend Your Eval Suite Exam
    A comprehensive review of the whole course. Diagnose a broken eval setup end to end, from vibes-based claims and a poor taxonomy to leaky data, an uncalibrated judge, contaminated benchmarks and a noisy gate, and defend your fixes.
    • Audit an unfamiliar eval suite and find flaws in its error analysis, datasets, checks, judge calibration, agent evals, CI gate and production monitoring
    • Prioritise and implement fixes, and justify each one with measured evidence rather than intuition
    • Write an eval design review that states what the suite can and cannot tell you, including where industry practice is still unsettled

Access

Levels 1 and 2 are free to read, no account needed. Levels 3 and 4 are free with a free account, and so are 20 answers from the AI tutor. Every level, the podcast edition and the AI tutor come with All Access at £4.99/month or any Creator plan — see pricing.

Read lesson 1 free →

More like this