Stop guessing.
Start measuring.
An eval is a structured, repeatable experiment: golden dataset + graders + runner + report/gate. This lab teaches you what evals are, what’s possible, and how to improve prompts with evidence — by running the loop yourself, right here in your browser.
One loop. Everything else is infrastructure.
Click each stage. The loop is the whole framework — tracing UIs, dashboards, and red-teaming all sit around it.
What is an eval, really?
A structured, repeatable experiment that measures behaviour despite model nondeterminism. It answers two questions: can it ever do it? (capability) and does it reliably do it? (consistency).
Deterministic code — free, instant, never drifts
JSON validity, regex, tool-call presence, final state/DB end-state. In evaled: contains, is_json, state_check, tool_calls_include. Rule: code first, LLM only for what code can’t check.
from evaled import contains, is_json
graders = [contains("refund"), is_json(["status"])]
LLM-as-judge — for tone, groundedness, nuance
One dimension per call. Anchored levels (1/3/5 behaviours), reasoning before the score, strict JSON, UNKNOWN escape hatch, temperature=0, judge from a different model family than your app. In evaled: get_judge("openai" | "anthropic" | "ollama" | "mock").
from evaled import EvalRunner, SUPPORT_RUBRIC
report = EvalRunner(SUPPORT_RUBRIC, judge_name="openai").run(cases, my_app)
Human — calibrate the judge, catch the edges
30–50 labelled cases per rubric. Compare judge vs human (Cohen’s κ or ≥80% agreement). Re-validate on every judge/rubric change. Humans are the ground truth; judges are instruments with a noise floor.
# EvalCase.human_verdict = "PASS" | "FAIL" → compare with judge verdict
# docs/08-calibration-and-bias.md has the full loop
Production signals — drift, real-world truth
Trace every call (input, context, output, model, tokens, cost, latency, tool calls). Sample 1–5% of traffic, auto-score, alert on drift (>5% drop). Every failure becomes a new golden case. In evaled: JsonlRecorder, Langfuse / Phoenix / OTel adapters.
from evaled.telemetry import JsonlRecorder
runner = EvalRunner(RUBRIC, recorder=JsonlRecorder("traces.jsonl"))
A rubric is not “rate quality 1–10”.
It’s named, independent dimensions with anchored levels, a verdict format, and a gate/preference decision. Pick a use case and play with the scale.
Try an anchored scale: Tone
Drag the slider. Anchors describe behaviour, not numbers — that’s what makes judges agree.
3 = neutral and polite. A preference — trend it, don’t gate on it.
Gates (groundedness, safety) block release. Preferences (tone, brevity) just trend. Never average them equally.
Improve a prompt with evidence, not vibes.
Edit the system prompt, run the golden set, read the failures, change one thing, re-run. This simulates the exact evaled loop (MockJudge heuristics mirror evaled/judge.py).
✍️ System prompt
Tip: v1 hallucinates “90 days” and complies with injections. Add grounding + refusal language and watch the gates flip. Then read why each case failed below.
📋 Golden set (6 cases)
Production · failure-replay · edge · adversarial. Two reviewers must agree on pass/fail per case.
Sets that don’t rot are failure-fed.
60% production sample · 15% adversarial · 15% edge · 10% failure replays. Version it, diff it in PRs, refresh monthly. Filter and add your own cases, then export JSONL for the Python core.
Add your own case
Capability vs consistency.
A 90% agent still fails ~10 of 100 users. pass@k asks “can it ever do it?”; pass^k asks “does it reliably do it?” Production runs on pass^k.
pass@k = 1 − (1−p)k · pass^k = pk. Drag and watch capability stay high while consistency collapses.
Pick the tool per job. Most teams run 2–3.
Default OSS stack ($0 + judge API costs): DeepEval or Promptfoo in CI + RAGAS if RAG + Langfuse/Phoenix for tracing + Promptfoo red-team.
The 7-week path (solo dev / small team).
Don’t boil the ocean. One layer per week — each pays for itself.
Copy-paste starters.
Vendor evaled/ (stdlib-only) or run the examples. Pick your stack.
from evaled import EvalCase, EvalRunner, SUPPORT_RUBRIC, contains
cases = [EvalCase(id="1", input="refund?", context="Policy: 30 days.", bucket="production")]
runner = EvalRunner(SUPPORT_RUBRIC, judge_name="openai",
deterministic_graders=[contains("refund")])
report = runner.run(cases, my_app) # my_app(input, context) -> str
print(report.summary()) # pass rate, scores, reasons# LangSmith auto-traces LangGraph; score the outcome, not the path.
# 1) Verify final state (DB/tickets), not just the final message.
# 2) Check tool sets (order-flexible), not exact sequences.
# 3) One LLM rubric per quality dimension.
from evaled import EvalRunner, AGENT_RUBRIC
report = EvalRunner(AGENT_RUBRIC, judge_name="anthropic").run(tasks, agent_fn)from evaled import EvalRunner, RAG_RUBRIC
# Separate retrieval (precision/recall) from generation (faithfulness).
# Golden case needs: (question, expected_doc_ids, expected_chunk_text)
report = EvalRunner(RAG_RUBRIC, judge_name="openai").run(cases, rag_fn)
# Or RAGAS for reference-free faithfulness / context precision.from evaled import EvalRunner, AGENT_RUBRIC
from evaled.telemetry import JsonlRecorder
# Run each task 3-5x. Report pass@k (capability) AND pass^k (consistency).
runner = EvalRunner(AGENT_RUBRIC, judge_name="mock",
recorder=JsonlRecorder("traces.jsonl"))
report = runner.run(tasks, agent_fn) # agent returns {tool_calls, final_state}Try it now: python3 examples/00-no-key-demo/run.py (offline, ~1s) · python3 examples/07-agent-trajectory/run.py · Full recipes: docs/06-adding-to-existing-projects.md
Five questions. No vibes.
Score 0 / 5. Aim for 5/5 before you gate CI on a judge.
What “great” looks like after week 7.
From the repo audit (docs/09-improvement-roadmap.md): fix the Tier-0 bugs first, then climb.
🔧 Fix the core
Inverted judge prompt, scale-gate semantics, runner error isolation, judge JSON parsing, real pass@k/pass^k. Half a day each — see docs/09 Tier 0.
📐 Calibrate properly
Judge-vs-human agreement + Cohen’s κ on 30–50 labels. Re-validate on every change. No calibration code exists yet — building it is the highest-value feature gap.
🛡️ Harden & scale
Timeouts/retries, cost tracking, PII redaction, red-teaming (Promptfoo), multi-model bake-offs, online evals on 1–5% of prod traffic, drift alerts.