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? 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.

failed runs · fitco-agentlast 7 days
Quoted a clause the contract doesn't havehallucinating
Answered without retrieving the contractmissing context
Applied last year's fee policywrong rules
Same question, a different fee each runhallucinating

What evals give you

  • CatchRegressions before users do.
  • ProveA new LLM is better.
  • ComparePrompts and versions, objectively.
  • RepeatOn every change, automatically.
eval runs · fitco-cancellations50 cases
prompt v11 · baseline45/50
prompt v12 · cites clauses47/50
prompt v13 · shorter system prompt39/50 regression
prompt v12 · new LLM version48/50

Unit tests for LLMs?

test_math.py · one valid output
def test_add():
    assert add(2, 2) == 4

PASSED  exact match, deterministic
eval · many valid outputs

Is this summary faithful, complete and under 100 words?

Faithful to the sourceyes
Covers every key pointyes
Under 100 wordsno · 132

Input, expected output, judge

Input

Contract + question

“When can I cancel, and what does it cost?”

Agent output

16 Dec · €40

Plus its reasoning.

Expected

16 Dec · €40

The ground truth.

Evaluator

Pass

Code, an LLM or a human.

Example · FitCo cancellations · the input

FitCo Gym · Membership agreement (excerpt)

§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.

Email · received 16 Nov 2026

“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

QuestionExpectedWhy
Ends on16 Dec 202630 days after the email (§4.1)
Fee waived?NoThe Porto club is 5 km away, under 30 km (§4.3)
Fee€402 full months left (Jan, Feb) × 50% of €40 (§4.2)
AlsoThe email is valid noticeWritten notice, email accepted (§4.1)

Example · four answers, graded

AnswerWhat the agent saidVerdictWhy
A“§4.3 waives the fee. Ends 16 Dec, you pay nothing.”FailSkipped the 30 km condition
B“Ends 16 Dec. No waiver, Porto club is within 30 km. €40: Jan, Feb × 50% of €40.”PassRight date, reasoning and fee
C“Ends 16 Dec. No waiver. 50% for 2.5 months: €50.”FailCounted December (§4.2)
D“Ends 16 Dec 2026. Not eligible because of the Porto club. Fee: €40.”It dependsRight 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.

run 2291 · call tree
orchestrator
├── research_agent
│   ├── search_web()
│   └── read_doc()
├── analyst_agent
│   └── calc_score()  ← wrong?
└── writer_agent
    └── final answer

Two kinds today

Cheap at scale

LLM as a judge

An LLM grades output against a rubric.

Ground truth

Human sampling

Thumbs up or down on a sample of real outputs.

LATER: AGENT AS A JUDGE · BUSINESS METRICS · DECISION MODELS

judge.pybinary verdict · reasoning first
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.

judge run · case fitco-001 · answer C1.9s

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.

Criterion 3 failedFAIL

Thumbs down is the cheapest ground truth

Review 5 to 10% of real outputs. Every thumbs down becomes a new test case.

review queue · 8% samplethis week
412Sampled
23Thumbs down
23New cases
“Ends 31 Jan, fee €0, you're past the term”UP
“Medical waiver applies” · no certificate sentDOWN
“Your email counts as notice. Ends 3 Jan”UP
“Fee is €60” · counted a partial monthDOWN

Which checks need a judge?

Disagreement

Vague rules

If two reviewers disagree on D, an LLM judge will too. Make the rule more precise.

Code can check

Date · amount

Exact values, checked by code without a judge.

Judge needed

Reasoning

“Explains why the waiver doesn't apply” needs an LLM or a human.

eval_fitco.pythe FitCo eval, in code
# 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.

ci · evalsprompt v14
$ 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.
langfuse · trace 7f3a · span analyst_agentgeneration
LLMclaude-sonnet-5-5
Latency4.0s
Tokens in / out2,104 / 212
Cost$0.0094
Session · users-8812 · u-311

input Estimate the applicant's annual income from the context below. Context: [ ]

langfuse · trace 7f3a · loan-review8.2s · 4.1k tokens
SpanLatencyTokens
orchestrator8.2s4.1k
research_agent3.1s1.2k
search_docs(q="applicant incme") → 0 results0.4s0
analyst_agent4.0s2.3k
llm: "income is ~$85k" ← hallucinated3.8s2.3k
writer_agent1.1s0.6k

A typo in a tool argument, then missing context, then a hallucination. The prompt was fine.

What each failure looks like

FailureWhat you see in the trace
HallucinationA claim with no source in any tool result
Missing contextEmpty retrieval, truncated context, skipped tool
Bad rulesThe agent followed the instructions; they were wrong
Tool misuseWrong tool, malformed arguments, retry loops
Cost, latencyOne span uses 80% of tokens or time

You don't need to build this

Open source · run it yourselfPaid · hosted
LangfuseLangfuse, self-hostedLangfuse Cloud
ArizeArize PhoenixArize 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.

agent.pylangfuse sdk
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.
transcript · fitco-agent2 tool calls
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.
tools/search_documents.jsonname · description · schema
{
  "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

Design tools for the LLM

Clear names, enums over free text, few high-level tools, errors that say how to fix it.

mcp server · fitco-tools3 tools
search_contract(query)top 5 clauses
get_member(member_id)start, plan, club
calc_fee(start, end)months, €

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.

tool evals · fitco-tools50 cases
49Right tool
50Valid args
47Task done
case 12 · called calc_fee before get_memberwrong tool
case 31 · email not sent, loop hit max stepsnot done

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

Evals and feedback · connect to the spansIs it good?
Observability · every step emits a spanWhat happened?
Guardrails · permissions, approvals, filtersIs it allowed?
Tools · registry, validation, sandbox, timeoutsHow does it act?
Context and memory · retrieval, compaction, sessionsWhat does it know?
Agent loop · max steps, stop conditions, retriesWhen does it stop?
LLMSwappable
harness.pya harness in 20 lines
@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

config.yamlchange it here
analyst:  claude-sonnet-5-5
router:   claude-haiku-5-5
fallback: other-provider/model

tools:    mcp://fitco-tools   # defined once
one interface · chat + toolsbehind the layer
Anthropicdirect
OpenAIdirect
OpenRoutergateway
Vercel AI SDKlibrary
LiteLLMlibrary

Agnostic doesn't mean identical

eval run · fitco suite · same cases, two LLMsillustrative numbers
MetricLLM A · currentLLM B · new
Eval pass rate86%91%
Tool-call accuracy97%95%
Hallucination flags4.1%2.2%
p95 latency3.2s5.8s
Cost per 1k tasks$14$9

It's one system

Harness

Runs

The LLM and its tools.

Traces

Records

Every step.

Evals

Judges

The result.

Agnostic

Changes

Providers, with proof.

Questions?

FDESKOOL.COM