Session 4 assignment support: Build and run TRACE on your capstone
1. Start here: what this assignment is
This guide has two paths. Path A is enough to pass. Do that first. Path B is stretch: pick one or two only if you have time.
Session 4 is TRACE: Trace, Read, Analyze, Codify, Enforce. Path A proves you can find real failures, turn them into automated checks, fix one, and show a metric move from a Streamlit UI.
Ready when
No capstone traces yet? Start with the sample pack
Download the Harmony Apartments SMS leasing-bot pack (20 traces + knowledge base). Path A is fully valid on this dataset. Prefer your own capstone traces when you have them; many students do both.
- Knowledge base
- Traces JSONL (20)
- Traces CSV + note columns
- Pack README
- Answer key (only after you annotate): harmony-apartments-answer-key.jsonl
Tip
Session resources
Live deck: Week 4: Evaluation, Monitoring & Shipping. Method: Hamel - Your AI product needs evals. Agents: Anthropic - Demystifying evals for AI agents. Goldens / hill climbing: Addy Osmani. Tooling: Braintrust (primary) · Langfuse (backup) · Promptfoo (CI).
Critical
The Golden Rule
Whenever anything goes wrong, paste the full error into Claude Code or Cursor: "I got this error, please fix it and explain what happened in simple terms."
Path A - enough to pass
Basic submission: enough to pass
- Use the Harmony sample pack (20 traces) and/or your own capstone runs (Braintrust/Langfuse, CSV, or JSON).
- Open-code all 20 sample traces (or 15-20 of your own); free-text notes first, no metrics yet. Do not open the answer key until you finish.
- Produce a failure taxonomy with at least 4 specific categories (not vague labels like "quality issues").
- Rank failures by frequency × impact; pick a top target.
- Codify at least 2 code-based assertions tied to those failures (schema, format, length, forbidden strings, required fields, link allowlist, etc.).
- Ship one fix aimed at a top failure (prompt/rule change, or a clearer handoff). Re-run checks on the same set and show the metric moving.
- Streamlit (or your existing UI) can trigger or display eval results - screenshot for Maven.
2. Trace and Read (45-90 min)
A trace is the full record: user input, system prompt, tool calls, retrieved context, intermediate state, and final output. Anthropic also distinguishes the transcript (what happened in the messages) from the outcome (final state in the environment, e.g. did a booking actually exist).
- 1
Load the sample pack (default)
Open the knowledge base, then the JSONL or CSV. Each row is one SMS leasing-bot run: user_input, retrieved_context, tool_calls, assistant_output.
- 2
Open code all 20
For each trace, write a free-text note: what is good, what failed, what surprised you. Fill your_open_coding_notes / your_pass_fail / your_failure_label in the CSV if you like. No scores yet.
- 3
Optional: your capstone too
If you have live runs, repeat on 10+ of your own. Log in Braintrust or Langfuse if you want annotations next to the span tree.
Tip
How many traces?
For this homework, the 20-trace sample pack meets the Path A bar. Over a real product lifecycle, aim toward ~100 and stop adding categories when ~20 new traces add none.
Watch out
Do not peek early
The answer key is for self-check after your taxonomy exists. Open coding first is the whole point.
3. Analyze - taxonomy and rank
Cluster related notes into specific failure modes. Prefer "ignored bathroom-not-connected constraint" over "temporal issues." Count occurrences. Prioritize by frequency × impact. Keep judgments binary (pass/fail), not Likert 1–5.
- Instruction / constraint miss
- Grounding failure / hallucination
- Formatting error (markdown in SMS, over-long dump)
- Missing handoff (bot fakes an action it cannot take)
- Tool-use error (wrong tool, bad args, ignored tool output)
- Safety / injection compliance
This ranked list is the spec for your eval suite - same idea as Addy’s "hill climbing": baseline → analyze failures → one change → re-measure.
4. Codify - code assertions first
Reach for deterministic checks before LLM-as-judge. Examples: valid JSON / schema; required fields; no markdown characters in a plain-text channel; length budget; URL allowlist; forbidden PII/secrets; latency/token ceilings.
Ready when
Path A minimum
Two code-based checks that catch failures you actually saw in your traces. Wire them so you can run the suite on demand (CLI is fine; Streamlit must show results).
I have a capstone AI app. Here is my failure taxonomy and 3 example traces (paste). Help me: 1) Store traces as JSONL (input, context/tools, output, human notes). 2) Implement two pytest (or Promptfoo) assertions for [failure A] and [failure B]. 3) Add a Streamlit page that runs the suite and shows pass/fail counts. 4) Keep everything binary pass/fail with a one-line reason on fail.
5. Fix one thing and show the metric move
Change the prompt, retrieval, tool, or guardrail that addresses your top failure. On the sample pack, that can be a revised system prompt + re-scoring the 20 outputs (or a scripted "fixed" output column) so pass rate moves. On your capstone, change the real system and re-run. Screenshot before/after pass rates (or failure counts). That is your Maven evidence.
Path B - stretch (pick 1–2)
Validated LLM-as-judge
StretchOne binary judge for a semantic failure (e.g. grounding). Label ~20–40 traces by hand. Compute TPR and TNR vs your labels - not raw agreement. Refine the judge prompt once and show rates climb.
Golden dataset from real failures
StretchTurn bad production (or dogfood) traces into a regression set. Optional Promptfoo config so prompts/** changes can be gated later.
Trace → dataset loop
StretchIn Braintrust or Langfuse: annotate a bad run, add it to an eval dataset, re-score after a fix.
Second fix + chart
StretchShip a second improvement and show a before/after failure-rate chart for one taxonomy category.
Watch out
Agreement is the trap metric
If failures are rare, an always-pass judge gets high agreement and zero TPR. Validate judges with true positive rate and true negative rate on a held-out labeled set.
6. What to submit
Maven / share
- Short note: top failures + what you codified
- Screenshot: Streamlit (or UI) showing eval results
- Screenshot or clip: metric moving after your fix
- Optional Path B: confusion matrix / TPR-TNR or golden-set note
7. Watch on this page
How to Build AI Evals in 2026
Mastering AI Evaluation: Playground to Production