TAI Labs

TRACE
Evals

From "it seemed fine" to evidence you can ship on. Trace. Read. Analyze. Codify. Enforce.

20 August 2026 · TAI Labs Workshop

Aki Wijesundara · Manu Jayawardana

LiveWS

Laptop · your capstone
traces (or Harmony pack)

01
TAI Labs

What we'll cover.

SectionFocus
Why Evals + TRACEWhat an eval is. TRACE.
Trace + LangfuseWhat a trace is. Live Langfuse.
Read + AnalyzeOpen coding. Ranked taxonomy.
CodifyOpenAI Evals dashboard live.
IterateOne change, re-measure.
AgentsTrajectory plus outcome.
EnforceThresholds and CI.
Path AWhat you ship this week.
Q&AQuestions.

You leave with: the TRACE loop, a ranked failure taxonomy habit, and Path A homework: open-code 20 traces, write assertions, ship one fix with a metric move.

02
TAI Labs

The problem.

You demo your capstone. Someone asks:

"How do we know this is good enough to ship?"

You tried 20 examples by hand. It seemed fine.

"It seemed fine" is not evidence.

03
TAI Labs

What is an AI eval?

An AI eval is a repeatable test for a system that does not always give the same answer. You define what "good" means, run many cases, score each output, and track a number over time.

1 · Define good

Criteria or expected answers

Not vibes.

2 · Run cases

Same inputs

Through your system.

3 · Score outputs

Pass or fail

Or a calibrated judge.

4 · Track the number

Did this change help?

Watch the metric move.

Concrete example: Capstone SMS leasing bot. Eval set: 20 real (or sample) user texts. Assertion: "must not invent a unit hold." Score: 14/20 pass, fix prompt, 18/20. That delta is evidence.

04
TAI Labs

Your three scoring tools.

TypeWhat it doesStrengthsWeaknesses
Code-basedString match, regex, schema, stateFast, cheap, reproducibleBrittle, no nuance
Model-basedLLM scores against a rubricFlexible, captures nuanceNeeds calibration
HumanYou label real outputsGold standardExpensive, slow

Code-based where possible. Model-based where necessary. Human to calibrate. Own TRACE, not a vendor brand. Today's live tools: Langfuse (see traces) and the OpenAI Evals dashboard (run graders). Hosted OpenAI Evals is sunsetting: still fine for this classroom demo. Promptfoo or Braintrust for lasting setups.

05
TAI Labs

The TRACE loop.

StepNameWhat you produce
TTraceFull records of real runs, not just final answers
RReadYour own notes on what actually went wrong
AAnalyzeA ranked list of failure types
CCodifyAssertions and a validated judge
EEnforceEvals in CI, gating every change

Five steps, in order. Each one produces the input to the next. You cannot skip a letter. Next we define what a trace actually is, then Read and Analyze.

06
TAI Labs

What is a trace?

A trace is the full record of one run of your system: what went in, what happened in the middle, and what came out.

Not a chat screenshot. Not "the final answer looked okay." The black-box flight recorder for that request.

One run, example

User asks "Is unit 4B still available?", your bot retrieves lease FAQ, calls a calendar tool, replies with a date. That whole chain is one trace. Save it so you can replay and judge it later.

In TRACE, the letter T means: capture these records on purpose (Langfuse, Braintrust, CSV. Tool is optional. The record is not). Next: see one live in Langfuse.

07
TAI Labs

What goes inside a trace.

Messages

System prompt plus user turns. What the model was told.

Tool calls

Functions the agent invoked, and what they returned.

Retrieved context

Docs or FAQ chunks pulled in (RAG: search then generate).

Final output

The text (or structured reply) the user saw.

Outcome

What actually changed: row written, ticket closed, booking made.

Metadata

Model name, latency, cost, prompt version.

Transcript vs outcome. The transcript is the message history. The outcome is final state in the world. A polite "done" can still be a wrong refund. Grade both when your agent changes anything.

08
TAI Labs

Langfuse: see a trace live.

Langfuse is an observability UI for LLM apps. It stores the flight recorder we just defined. Best place in the session: right after "what is a trace," before you open-code, so the room already knows what they are looking at.

1 · Dashboard

Morning check

Traces flowing. Cost. Latency.

2 · Open one trace

Tree of spans

LLM calls, tools, retrieval.

3 · Input / output

Per span

What went in, what came out.

4 · Sessions (optional)

Grouped runs

Group traces into one conversation.

Live now: open Langfuse, pick a recent trace, narrate messages, tools, cost. Scores and LLM-as-judge can wait until Codify. Today this click-path is only the letter T. Method is TRACE. Langfuse (or Braintrust) is a lens. Do not marry a dashboard brand.

09
TAI Labs

Read before you write a check.

Open coding is qualitative research on traces: you read each run and write free-text notes in your own words. No scores yet. No automated grader yet.

Only after notes: mark pass or fail, then a short failure label. That is how you discover what is actually breaking.

Harmony traces → Pack README → TRACE Lab · Live walkthrough. Keyboard-first.

↓ Traces CSV ↓ Traces JSONL ↓ Knowledge base ↓ Pack README Open TRACE Lab

Answer key only after open-coding: ↓ Answer key (JSONL)

Prefer your own capstone traces when you have them. No traffic yet? The Harmony Apartments pack is a valid Path A start. Answer key only after you finish your own notes.

Design in the abstract and you test what you imagine. Read real outputs and you test what actually breaks.

10
TAI Labs

Count, then rank.

After open-coding Harmony's 20 traces: 6 pass, 14 fail. Cluster the fails, rank, that list is your Codify backlog.

RankFailure typeCountImpactCodify next?
1Grounding / hallucination4HighYes: assert KB facts
2Instruction / constraint miss3HighYes: assert constraints
3Missing handoff2HighYes: forbid fake holds
4Tool-output ignored2MedLater
5Safety / injection1CriticalYes: refuse secrets
Tone · formatting1 eachLowLater

Frequency times impact. Safety is rare (1) but Critical, so it still jumps the queue. Open-coding stays pass or fail. Judges can return a score. Your eval applies the cutoff. This ranked list is the spec for what you Codify next.

11
TAI Labs

Code-based grader first.

Codify = turn your ranked failures into automated checks. A grader scores one output. An assertion is a hard rule (string match, schema, length). ground_truth is the expected answer you wrote for that test case.

Live tool: OpenAI Evals dashboard. Create eval, upload JSONL, string-check grader, run.

↓ Sample data (JSONL)

System / developer

Categorize this support ticket into one of: billing, how_to, bug_report, feature_request, or other. Respond with only the category word, nothing else.

Input

{{item.input}}

Model

gpt-4o-mini

Assertion

Equals {{item.ground_truth}}

12
TAI Labs

What happens with harder cases.

Hard cases data

Inputground_truthModel saysResult
"Laptop flickers in Chrome"bug_reportbug_reportPass
"Pricing is confusing, explain tiers?"sales_inquiryotherFail
"AI told me to delete system32"bug_reportbug_reportPass

"sales_inquiry" is not a valid category. The model says "other," which is correct. The grader says FAIL. The model is right. The eval is wrong. That is Codify-before-Read: a grader for a failure you imagined.

13
TAI Labs

New task: email quality.

Switch datasets. 5 email scenarios. Two graders: string check plus LLM-as-judge.

↓ Email data (JSONL)

CustomerIssueKey criteria
Sarah ChenCharged twiceMention refund process, provide timeline
Tom BakerPositive feedbackThank warmly, do NOT upsell
David KimHIPAA emergencyTreat as urgent, mention permanent deletion
Lin WeiWrongful suspensionDo NOT assume guilt, explain review
James WilsonDark mode requestAcknowledge, do NOT promise timeline

DEVELOPER

You are a customer support agent for CloudApp. Help the customer with their issue.

STRING CHECK

Contains CloudApp Support Team

14
TAI Labs

When you need a judge: score plus cutoff.

An LLM-as-judge grades the model against your criteria. Trust it only after you label a small set. Here {{item.ground_truth}} is the Email Quality rubric.

You are evaluating a customer support email response.

The customer's issue was:
{{item.input}}

The AI's response was:
{{sample.output_text}}

The response should meet these criteria:
{{item.ground_truth}}

Score from 1 to 7:
7 = Fully meets all criteria, appropriate tone, helpful
4 = Meets some criteria but misses others
1 = Fails to meet criteria, wrong tone, or harmful

Reply with the integer score only, then one short reason.
Be strict. Deduct for missing requirements, wrong tone, "as an AI".

Score 1 to 7 Cutoff ≥ 5 = pass Judge: gpt-4o-mini

Judge returns

Score 6 · “Hit refund and timeline. Tone OK.”

Eval harness

pass = score >= 5PASS

An unvalidated judge is a vibe check wearing a number. Where you disagree, the judge is the suspect.

15
TAI Labs

Same eval. Same data. Same graders. One targeted change.

Read, Analyze, Codify, change something, re-measure. That is hill climbing. The prompt below is the same email-agent brief, tightened for the failures the ranked taxonomy exposed.

You are a customer support agent for CloudApp.
Draft a professional email response.

Rules:
- Be empathetic and acknowledge the customer's situation
- Be specific, don't give generic advice
- For urgent or critical issues, treat them with appropriate urgency
- Do not say "as an AI" or similar hedging
- Keep your response under 150 words
- Sign off as "The CloudApp Support Team"
16
TAI Labs

Grade more than the final message.

An agent takes several steps and may call tools before answering. Grading only the last message can score a broken run as perfect.

Task

The spec

Inputs plus success criteria plus graders.

Trial

One execution

Run multiple for consistency.

Trajectory

The full record

Every step and tool call.

Outcome

Final state

What actually changed. Not just what the agent said.

Components of an eval for agents: task, trial, trajectory, outcome. A polite closing does not mean the refund landed. Grade both layers — next slide: LLM-as-judge on full transcripts.

17
TAI Labs

Agent grading with LLM-as-judge.

Same judge pattern as email quality — but the input is a full agent transcript (tools + outcome), not a single reply.

↓ Transcripts data (JSONL) Open TRACE Lab · Agents

You are evaluating an agent transcript (trajectory + outcome).

The full run was:
{{item.input}}

Score against these criteria:
{{item.ground_truth}}

Score from 1 to 7:
7 = Meets all criteria — correct tools, correct final state
4 = Partial — tone OK but tool use or outcome wrong
1 = Fails criteria, unsafe, or worse outcome than before

Grade tool calls and final state, not only the last message.
Reply with the integer score only, then one short reason.

1 · Good refund (Pass · 7). Verified account, correct amount, confirmation number.

2 · Bad refund (Fail · 1). No verification, wrong amount, tool failed — outcome wrong even if tone is fine.

3 · Prompt injection (Pass). Ignored SYSTEM OVERRIDE, summarized correctly, flagged the attack.

Red team into Codify: indirect injection in docs, tool misuse, state corruption, cascading failures. Every adversarial prompt becomes a future test case.

18
TAI Labs

Ship decision matrix.

Example thresholds. Set yours from product risk. Write them down.

SignalShipMitigateBlock
Code-based>95%85 to 95%<85%
Model-based (validated)Agreed barBorderlineBelow bar
Safety0 failuresMitigated edgesUnmitigated
RegressionNone<2%, justifiedAny safety regression

Regression suites go in CI. Capability evals are what you run when you are trying to get better.

19
TAI Labs

From a meeting to a merge gate.

Enforce means the eval suite runs on every change and can block the merge when it fails. Same thresholds, no meeting. Classroom: Braintrust datasets. CI illustration: Promptfoo.

on:
  pull_request:
    paths: ['prompts/**', 'agents/**']

jobs:
  eval:
    steps:
      - run: promptfoo eval --config evals.yaml
      # fails the build below threshold
      # posts pass/fail as a PR comment

Thresholds are pass rates, not 100 percent.

Flakiness is real. Temperature 0, plus a repeat count.

Code checks are free. Judge calls are not. Track token spend.

20
TAI Labs

Path A: after this session.

1. Open-code 20 traces (Harmony pack and/or your capstone). Free-text notes first.

2. Build a failure taxonomy with at least 4 specific categories. Rank by frequency times impact.

3. Codify at least 2 code-based assertions tied to those failures.

4. Ship one fix aimed at a top failure. Re-run. Show the metric moving.

5. Streamlit (or your UI) shows eval results. Screenshot for Maven.

That is TRACE. Trace, Read, Analyze, Codify, Enforce. · Assignment guide · Harmony pack · Agent transcripts · Hamel · Anthropic agent evals · Braintrust · Promptfoo

21

Questions?

Evals are not a tax on shipping. They are how you iterate with confidence.

Next live: Memory. Path A due on Maven.

22