FDE Skool · Session
Vibes don't scale
Evals, traces, tool calling, harnesses and provider-agnostic agents: how to ship AI you can check.
Five questions, one loop
- Evals: does it work?
- Traces: why didn't it?
- Tool calling: how does it act?
- Harness: what runs it all?
- Model agnostic: can we change the LLM?
Evals
Does it work? What an eval is, and how to build one.
Who has shipped a feature with evals?
It feels
better
You change the prompt. It feels better. You ship it. Something else breaks, and you start again.
We need to verify what we build
And when it fails, trace it back to see what the agent did.
What evals give you
- CatchRegressions before users do.
- ProveA new LLM is better.
- ComparePrompts and versions, objectively.
- RepeatOn every change, automatically.
Unit tests for LLMs?
def test_add(): assert add(2, 2) == 4 PASSED exact match, deterministic
Is this summary faithful, complete and under 100 words?
Input, expected output, judge
Contract + question
“When can I cancel, and what does it cost?”
16 Dec · €40
Plus its reasoning.
16 Dec · €40
The ground truth.
Pass
Code, an LLM or a human.
Example · FitCo cancellations · the input
§2Start date: 1 March 2026. Monthly fee: €40.
§3Minimum term: 12 months from the start date.
§4.1The member may cancel at any time by written notice (email accepted). The membership ends 30 days after the notice is received.
§4.2If the membership ends during the minimum term, a fee applies: 50% of the monthly fee for each full calendar month remaining.
§4.3The fee is waived if the member moves more than 30 km from the nearest FitCo club, or presents a medical certificate.
§5After the minimum term, the membership runs month to month and can be cancelled with 30 days' notice at no cost.
“I'm moving from Lisbon to Porto next month, and my new flat is 5 km from your Porto club. I want to cancel, and this email is my notice. When does my membership end? Can I cancel for free, and if not, how much will I pay?”
Example · expected output
The answer we'd accept
| Question | Expected | Why |
|---|---|---|
| Ends on | 16 Dec 2026 | 30 days after the email (§4.1) |
| Fee waived? | No | The Porto club is 5 km away, under 30 km (§4.3) |
| Fee | €40 | 2 full months left (Jan, Feb) × 50% of €40 (§4.2) |
| Also | The email is valid notice | Written notice, email accepted (§4.1) |
Example · four answers, graded
| Answer | What the agent said | Verdict | Why |
|---|---|---|---|
| A | “§4.3 waives the fee. Ends 16 Dec, you pay nothing.” | Fail | Skipped the 30 km condition |
| B | “Ends 16 Dec. No waiver, Porto club is within 30 km. €40: Jan, Feb × 50% of €40.” | Pass | Right date, reasoning and fee |
| C | “Ends 16 Dec. No waiver. 50% for 2.5 months: €50.” | Fail | Counted December (§4.2) |
| D | “Ends 16 Dec 2026. Not eligible because of the Porto club. Fee: €40.” | It depends | Right facts, no calculation or clause |
One prompt change affects the whole tree
A new prompt gives a new output. Behind it, agents call tools. Follow the failure back to its cause.
orchestrator ├── research_agent │ ├── search_web() │ └── read_doc() ├── analyst_agent │ └── calc_score() ← wrong? └── writer_agent └── final answer
Two kinds today
LLM as a judge
An LLM grades output against a rubric.
Human sampling
Thumbs up or down on a sample of real outputs.
LATER: AGENT AS A JUDGE · BUSINESS METRICS · DECISION MODELS
JUDGE_PROMPT = """ You are grading an answer about a contract cancellation. Criteria: 1. End date matches the reference answer 2. Says whether the fee waiver applies, and why 3. Fee amount matches the reference answer 4. Every claim is supported by a clause in the contract Contract: {contract} Question: {question} Reference answer: {expected} Agent answer: {output} Explain your reasoning, then answer PASS or FAIL. """ verdict = judge_llm(JUDGE_PROMPT.format(...))
The judge explains, then decides
Read its reasoning. Check its verdicts against human labels before you trust it.
1. End date 16 Dec 2026 matches the reference.
2. States the waiver doesn't apply because of the nearby club. Supported by §4.3.
3. Fee is €50 from 2.5 months. §4.2 counts only full calendar months, so the reference is €40.
4. No invented clauses.
Thumbs down is the cheapest ground truth
Review 5 to 10% of real outputs. Every thumbs down becomes a new test case.
Which checks need a judge?
Vague rules
If two reviewers disagree on D, an LLM judge will too. Make the rule more precise.
Date · amount
Exact values, checked by code without a judge.
Reasoning
“Explains why the waiver doesn't apply” needs an LLM or a human.
# cases.jsonl: case fitco-001, plus 20 to 50 more {"question": "...moving to Porto...", "end_date": "2026-12-16", "waiver": false, "fee": 40} for case in dataset: out = agent.run(contract, case.question) # traced checks = { "date": out.end_date == case.end_date, # code "fee": out.fee == case.fee, # code "reason": judge(RUBRIC, case, out), # LLM judge } results.append(all(checks.values())) assert mean(results) >= baseline, "regression!" # runs in CI
From vibes to evidence
Every change runs the whole suite. It ships only at or above baseline.
$ git push origin prompt-v14 ✓ 53 cases loaded (+3 from thumbs down) ✓ code checks date 53/53 · fee 52/53 ✓ LLM judge reason 50/53 ✓ pass rate 94% baseline 90% → ship
Traces
A failing score says it broke. A trace says where and why.
A trace is the full record of one run
- SpansEach LLM call, tool call or sub-agent, nested.
- PayloadsExact prompts, arguments and results.
- MetadataLatency, tokens, cost, version, user.
input Estimate the applicant's annual income from the context below. Context: [ ]
A typo in a tool argument, then missing context, then a hallucination. The prompt was fine.
What each failure looks like
| Failure | What you see in the trace |
|---|---|
| Hallucination | A claim with no source in any tool result |
| Missing context | Empty retrieval, truncated context, skipped tool |
| Bad rules | The agent followed the instructions; they were wrong |
| Tool misuse | Wrong tool, malformed arguments, retry loops |
| Cost, latency | One span uses 80% of tokens or time |
You don't need to build this
| Open source · run it yourself | Paid · hosted | |
|---|---|---|
| Langfuse, self-hosted | Langfuse Cloud | |
| Arize | Arize Phoenix | Arize AX |
Both do traces, evals and datasets, and both accept OpenTelemetry.
Link every failing eval to its trace
One decorator per function. One trace id per result.
from langfuse import observe @observe() # every call becomes a span def analyst_agent(doc): ctx = search_docs(doc.query) # nested span return llm(prompt, ctx) # nested span # in the eval loop result = {"case": case.id, "passed": verdict, "trace_id": current_trace_id()}
Tool calling
LLMs only produce text. So how do they send an email?
The LLM asks. Your code acts.
- AsksA tool name and JSON arguments.
- RunsYour code validates and executes.
- ReturnsThe result goes back in.
- DecidesAnother tool, or the answer.
user When does my membership end? llm tool_use search_contract {"query": "cancellation notice"} code §4.1 ends 30 days after notice llm tool_use calc_fee {"start": "2026-03-01", "end": "2026-12-16"} code {"full_months_left": 2, "fee_eur": 40} llm Ends 16 Dec 2026. The fee is €40.
{
"name": "search_documents",
"description": "Search the applicant's uploaded documents.
Use when you need facts about income, debt or history.
Returns up to 5 passages with source page numbers.",
"input_schema": {
"type": "object",
"properties": {
"query": { "type": "string" },
"doc_type": { "enum": ["payslip", "bank", "credit"] }
},
"required": ["query"]
}
}
Where tool calling breaks
- Picks the wrong tool, or none at all
- Malformed or hallucinated arguments
- Infinite loops and endless retries
- Tool errors it can't recover from
- Too many tools, and accuracy drops
Design tools for the LLM
Clear names, enums over free text, few high-level tools, errors that say how to fix it.
error end must be YYYY-MM-DD, got "16/12". Retry with "2026-12-16".
The easiest part to eval
Plain code checks against the expected call and the end state. No judge.
The harness
The LLM is the engine. The harness is the car.
Same LLM
Different harness, different product
Claude Code, Cursor and OpenCode can run the same LLM. They behave like different products.
Everything around the call
@observe() def run_agent(task, tools, model, max_steps=10): messages = [system_prompt(), user(task)] for step in range(max_steps): # loop + stop condition reply = model.chat(messages, tools=tools) # model is a parameter if not reply.tool_calls: return reply.text # done for call in reply.tool_calls: if needs_approval(call): # guardrail ask_human(call) result = execute(call, timeout=30) # traced span messages += [reply, tool_result(call, result)] messages = compact_if_needed(messages) # context raise MaxStepsExceeded(task)
Model agnostic
A new LLM ships every month. Can you switch in a day?
Don't depend on one provider
Quality
The best LLM changes every few months.
Cost
Route easy tasks to cheaper ones.
Resilience
Switch automatically when a provider is down.
Compliance
Some clients require a provider or a region.
Put a layer between your code and the provider
analyst: claude-sonnet-5-5 router: claude-haiku-5-5 fallback: other-provider/model tools: mcp://fitco-tools # defined once
Agnostic doesn't mean identical
- Tool-calling reliability varies between LLMs
- Context limits and caching behave differently
- The same prompt can score very differently
- Switching without evals is still guessing
| Metric | LLM A · current | LLM B · new |
|---|---|---|
| Eval pass rate | 86% | 91% |
| Tool-call accuracy | 97% | 95% |
| Hallucination flags | 4.1% | 2.2% |
| p95 latency | 3.2s | 5.8s |
| Cost per 1k tasks | $14 | $9 |
It's one system
Runs
The LLM and its tools.
Records
Every step.
Judges
The result.
Changes
Providers, with proof.
Questions?
FDESKOOL.COM