34 shown
| Layer | Tool | Technique | Command / Code | Notes |
|---|---|---|---|---|
| framework | Inspect AI | Install & first evalAISI / UK Gov: fully open, no SaaS |
pip install inspect-ai --break-system-packages
inspect eval inspect_evals/mmlu --model openai/gpt-4o
inspect eval inspect_evals/mmlu --model ollama/llama3.1
# local model via ollama: no outbound API key needed
|
Architecture: task → solver → scorer pipeline. Deterministic, reproducible, CI-friendly. No SaaS dependency. Best fit for teams that want to write and own eval logic. You write the evals; Inspect runs them. |
| framework | Inspect AI | Write a custom tasktask / solver / scorer pattern |
from inspect_ai import task, Task
from inspect_ai.dataset import json_dataset
from inspect_ai.scorer import exact
from inspect_ai.solver import generate
@task
def my_agent_eval():
return Task(
dataset=json_dataset("cases.json"),
solver=generate(), # swap for your agent
scorer=exact(),
)
|
solver is where your agent under test plugs in. scorer is deterministic (exact, regex) or LLM-as-judge. Dataset is a list of {input, target} records. Swap generate() for a custom solver that drives your agent harness. |
| framework | Inspect AI | LLM-as-judge scorerlocal judge: no API key |
from inspect_ai.scorer import model_graded_fact
scorer = model_graded_fact(
model="ollama/qwen2.5:7b", # local judge
template="Did the agent correctly {criterion}? "
"Answer CORRECT or INCORRECT only.",
)
# never use the same model as judge and subject
|
Critical: judge model must differ from model under test: same-model self-evaluation inflates scores by ~15-20% (self-consistency bias). Local judge on CPU: Qwen2.5-7B-Q4_K_M is cost-free and auditable. |
| framework | Inspect AI | Run in CI (GitHub Actions)regression gate on every PR |
# .github/workflows/eval.yml
- name: Run evals
run: |
inspect eval my_eval.py \
--model ollama/llama3.1 \
--limit 50 \
--log-dir ./eval-logs \
--fail-on-error
# --limit 50: fast gate; full suite on merge to main
|
Run a fast subset (50 cases) on every PR; full suite on merge. --fail-on-error makes the step fail on uncaught exceptions, not on low scores. Add a score threshold check in a post-step script. |
| framework | DeepEval | pytest-style eval runnerLLMTestCase + metrics as classes |
pip install deepeval --break-system-packages
from deepeval import evaluate
from deepeval.test_case import LLMTestCase
from deepeval.metrics import (
AnswerRelevancyMetric, HallucinationMetric,
ToolCorrectnessMetric)
tc = LLMTestCase(
input="Book a flight to Oslo",
actual_output=agent_response,
tools_called=agent_tool_log,
expected_tools=["search_flights","book_ticket"])
evaluate([tc], [ToolCorrectnessMetric()])
|
ToolCorrectnessMetric checks tool call sequence: the most useful agent-specific metric here. 50+ built-in metrics; choose ≤5 per run (DeepEval's own advice). SaaS backend optional: results print locally without deepeval login. |
| framework | DeepEval | E2E vs component splitblack-box vs per-step eval |
# E2E: treat agent as black box; single LLMTestCase
tc_e2e = LLMTestCase(input=q, actual_output=final_ans)
# Component: grade each step independently
tc_retrieval = LLMTestCase(
input=q, actual_output=retrieved_chunks,
expected_output=gold_chunks)
tc_gen = LLMTestCase(
input=q, actual_output=final_ans,
retrieval_context=retrieved_chunks)
|
Rule of thumb: E2E for simple/flat pipelines; component for multi-step agents where errors compound. If E2E score is low, component eval tells you which step broke. Don't skip component grading and wonder why the agent fails. |
| framework | DeepEval | Multi-turn conversational evalConversationSimulator |
from deepeval.dataset import ConversationalGolden
from deepeval.test_case import Turn
async def agent_callback(input, turns, thread_id):
return Turn(role="assistant",
content=your_agent(input, turns))
golden = ConversationalGolden(
scenario="User wants refund for delayed flight",
expected_outcome="Refund issued or escalated",
user_description="Frustrated, concise, refuses workarounds")
|
Scenario drives a synthetic user; agent_callback wraps your system under test. Expected outcome is natural language: graded by LLM judge. Persona matters: "frustrated + refuses workarounds" hits different edge cases than "cooperative user." |
| framework | Braintrust | Offline experiment rundataset → task → scorer → immutable snapshot |
pip install braintrust autoevals --break-system-packages
from braintrust import Eval
from autoevals import Factuality
Eval("agent-booking",
data=lambda: [{"input": q, "expected": a}
for q, a in test_pairs],
task=lambda x: your_agent(x["input"]),
scores=[Factuality],
)
|
Each run is immutable: Braintrust captures the snapshot for regression comparison. Vendor dependency is real: regression dashboards, dataset versioning, and trace diffing require their SaaS. Offline eval alone is usable without it, but degraded. |
| framework | Braintrust | Hyperparameter sweepfind best model config systematically |
from deepeval.evaluate import DisplayConfig
# (DeepEval variant: avoids Braintrust SaaS lock-in)
for temp in [0.0, 0.3, 0.7]:
evaluate(
test_cases=cases,
metrics=metrics,
hyperparameters={"model": "llama3.1:8b", "temp": temp},
display_config=DisplayConfig(
results_folder="./evals/temp-sweep"))
# each run saved as test_run_
|
Temperature, model version, system prompt variant: sweep systematically, not by intuition. Results folder makes runs comparable across sessions without a SaaS backend. Don't tune on your eval set: hold out 20% as a final check. |
| benchmark | AgentBench | Environment task suiteOS / DB / KG / Web: ICLR'24 |
git clone https://github.com/THUDM/AgentBench
cd AgentBench && pip install -r requirements.txt \
--break-system-packages
# 8 environments: OS bash, DB SQL, KG, HouseHolding,
# WebArena, WebShop, Mind2Web, AlfWorld
python eval.py --task os --model your-model
|
Use as a reference point, not a living tool. Last substantive commit ~2024. Key finding: most LLMs collapse in real-tool environments vs. chat. OS and DB tasks are the most transferable to internal agent work. Web tasks are noisy and environment-fragile. |
| benchmark | AgentBench | Red-flag checklist from resultswhat AgentBench failure tells you |
# common failure modes (from paper):
1. hallucinated tool outputs: model assumes success
2. lost state after 5+ turns: context degrades
3. retry loop: no exit condition on tool failure
4. off-by-one in SQL. Never validated against schema
5. web agent: clicks non-existent element, ignores error
|
These failure modes are more useful than the benchmark scores. If your agent does any of these on manual testing, it will fail systematically at scale. Build explicit checks: tool-call result validation, retry caps, state serialisation checkpoints. |
| benchmark | τ²-Bench | Dual-control eval setupagent + user both use tools in shared world |
git clone https://github.com/sierra-research/tau2-bench
cd tau2-bench && uv sync
tau2 run \
--domain airline \
--agent-llm ollama/llama3.1 \
--user-llm ollama/qwen2.5:7b \
--num-trials 4 \
--num-tasks 10
# domains: airline, retail, telecom, banking_knowledge
|
Key insight: every other benchmark makes the user a passive text source. τ² gives the user tools too: both agent and user modify shared state (Dec-POMDP). This is how real support/service agents actually fail. Uses uv. Actively maintained into 2026. |
| benchmark | τ²-Bench | Task composition & verificationprogrammatic task generation, not hand-crafted |
# τ² tasks are compositionally generated: verifiable
# example airline task (from data/tau2/domains/):
{
"reason_for_call": "Cancel flights XEHM4B + 59XX6W",
"known_info": "user_id: daiki_muller_1116",
"task_instructions": "If basic economy: ask to upgrade
first. After 3rd agent msg: ask about other flights
+ total cost.",
"expected_actions": ["cancel_reservation XEHM4B", ...]
}
|
Tasks have verifiable expected actions: ground truth is a tool call sequence, not a natural language description. User persona includes behavioural constraints ("persistent + terse", "refuses workarounds"). Compositional generation ensures domain coverage without hand-labelling every case. |
| benchmark | τ²-Bench | Local-model eval runno external API: fully air-gapped |
# pull models first:
ollama pull llama3.1:8b-instruct-q4_K_M # agent
ollama pull qwen2.5:7b-instruct-q4_K_M # user sim
tau2 run \
--domain telecom \
--agent-llm ollama/llama3.1:8b-instruct-q4_K_M \
--user-llm ollama/qwen2.5:7b-instruct-q4_K_M \
--num-trials 2 --max-concurrency 2
# results saved to data/tau2/simulations/
|
Fully local: agent model + user simulator model both via Ollama. CPU-only i9/64GB can handle this at batch=1. Keep --max-concurrency 2 on CPU: higher values thrash memory. Use different models for agent and user sim: same-model creates cooperative bias. |
| benchmark | GAIA (AMD) | Scenario YAML structure54 scenarios, 10 categories, 7-dim rubric |
# scenario YAML anatomy (from gaia/eval/scenarios/):
name: rag_quality_basic
category: rag_quality
documents: ["policy.pdf"]
turns:
- objective: "Find refund policy section"
persona: "Direct user, expects exact quotes"
# 7-dim rubric: correctness, relevance, completeness,
# conciseness, tool_use, hallucination, coherence
# score recomputed deterministically: LLM arithmetic overridden
|
Borrow the pattern, not the tool. GAIA evaluates AMD's specific Agent UI, not portable without rework. The deterministic score recomputation is the idea worth stealing: never trust LLM-produced arithmetic; recompute from raw scores using your own weights. |
| benchmark | GAIA (AMD) | BLOCKED_BY_ARCHITECTURE statusstructural failures vs eval failures |
# GAIA status taxonomy (steal this for your own harness):
PASS: all turns: correctness≥4 AND score≥6.0
FAIL: any turn below threshold
BLOCKED_BY_ARCHITECTURE: structural limitation detected
TIMEOUT: wall-clock exceeded per-scenario limit
BUDGET_EXCEEDED: API cost cap hit
INFRA_ERROR: MCP/tool error before eval could run
SETUP_ERROR: indexing returned 0 chunks
|
BLOCKED_BY_ARCHITECTURE is never auto-upgraded. It requires human review. This distinction matters: a FAIL can be fixed by prompt engineering; a BLOCKED means the architecture can't do the task at all. Conflating these hides real problems. |
| outcome | pattern | Binary task completiondid it finish correctly: yes/no |
def check_outcome(expected_state: dict, actual_state: dict) -> bool:
"""Compare world state before/after agent run."""
for key, expected_val in expected_state.items():
if actual_state.get(key) != expected_val:
return False
return True
# not: "did it say the right thing"
# yes: "did the reservation get cancelled in the DB"
|
Outcome eval requires a verifiable world state. SQL query result, API response code, file presence, DB row value, not natural language output. If you can't check the world state, you're grading prose, not agent behaviour. Build world-state snapshots into your test harness. |
| outcome | pattern | Tool call sequence validationexpected vs actual call order |
from deepeval.metrics import ToolCorrectnessMetric
tc = LLMTestCase(
input="Book cheapest flight Oslo→Berlin 15 June",
actual_output=agent.last_response,
tools_called=agent.tool_log, # actual
expected_tools=[ # required
"search_flights",
"compare_prices",
"book_ticket"])
# order matters: booking before searching = wrong
|
Tool call order is not always strict: define partial-order constraints where needed (search must precede book; compare is optional). Log every tool call with timestamp and arguments. Hallucinated tool calls (model claims it called a tool but didn't) are a distinct failure class from wrong-order calls. |
| outcome | pattern | Ground truth from real reposhamel.dev pattern, not synthetic |
# build test set from repos with known correct outputs:
gh repo list org --json name,url \
| jq '.[] | .url' \
| xargs -I{} gh api {}/contents/.github/workflows
# existing pipelines = ground truth for CI/CD agent
# run agent on the same repos, diff the YAML output
diff expected_workflow.yml agent_output.yml
# structural diff, not string match
|
Let's say you're building a CI/CD wizard: Your repos with good, existing pipelines are the ground truth. Run the agent against the same repos and diff structurally, not string equality. Don't generate synthetic repos: synthetic inputs don't surface the edge cases that real repos do. |
| outcome | pattern | Pass@k metricreliability over N independent trials |
import math
def pass_at_k(n: int, c: int, k: int) -> float:
"""n=total trials, c=correct, k=budget"""
if n - c < k: return 1.0
return 1.0 - math.comb(n-c, k) / math.comb(n, k)
pass_at_1 = pass_at_k(n=10, c=7, k=1) # 0.7
pass_at_3 = pass_at_k(n=10, c=7, k=3) # 0.917
# τ²-Bench uses 4 trials per task for the same reason
|
Single-trial eval of a stochastic agent is noise. Pass@1 with n=10 trials tells you reliability: the probability of success on a single attempt. Pass@k with k>1 tells you if the agent can succeed given retries. Report both: an agent that only passes with 3 attempts is not production-ready at k=1. |
| trajectory | pattern | Step-level gradingdecompose: which step broke |
# grade each step independently, not just final output:
steps = agent.trace # list of {step, input, output, tool}
for step in steps:
score = grade_step(
step_name=step["name"],
output=step["output"],
expected=ground_truth[step["name"]])
results.append({**step, "score": score})
# bad retrieval poisons generation. You need to know which
|
E2E score of 0.3 tells you the agent is bad. Step-level tells you it's bad at retrieval specifically, and generation given good context scores 0.8. These require completely different fixes. Never skip step-level grading for multi-step agents. |
| trajectory | GAIA (AMD) | 7-dimension rubric (steal it)deterministic weighted scoring |
SCORE_WEIGHTS = {
"correctness": 0.35, # highest weight
"relevance": 0.20,
"completeness": 0.15,
"tool_use": 0.15,
"hallucination": 0.10, # fail-gate: <4 = FAIL regardless
"conciseness": 0.03,
"coherence": 0.02,
}
# recompute deterministically. Never trust LLM arithmetic
score = sum(dim_scores[k]*w for k,w in SCORE_WEIGHTS.items())
|
Hallucination is a fail-gate: score 9.8 on six dimensions and 3.9 on hallucination → FAIL. Never aggregate hallucination into an average. It masks the worst failure mode. Cap FAILed scenario scores at 5.99 before computing benchmark averages to preserve signal. |
| trajectory | pattern | Trace logging schemastructured output, not free text |
import json, time
trace = {
"scenario_id": "flight_cancel_001",
"model": "llama3.1:8b-q4_K_M",
"turns": [
{"turn": 1,
"user_input": "...",
"tools_called": [{"name":"search","args":{...},"result":{...}}],
"agent_output": "...",
"latency_ms": 1240,
"tokens_in": 512, "tokens_out": 89}
]}
|
Log tool call arguments and results, not just names. Latency and token counts per turn are essential for cost analysis. Store as JSONL: append-friendly, grep-friendly, no schema migration required. One file per scenario run. |
| trajectory | Inspect AI | Trajectory eval with Inspectcustom scorer over full turn history |
from inspect_ai.scorer import scorer, Score, CORRECT, INCORRECT
@scorer(metrics=[accuracy()])
def tool_order_scorer():
async def score(state, target):
calls = [m.tool for m in state.messages
if hasattr(m, 'tool')]
expected = target.text.split(",")
ok = all(e in calls for e in expected)
return Score(value=CORRECT if ok else INCORRECT)
return score
|
Inspect gives you the full state.messages history in the scorer: every turn, tool call, and model output. This is the hook for trajectory grading: inspect the path, not just the destination. |
| online / prod | pattern | Production trace samplinginteresting traces → new test cases |
import random, json
def sample_for_labelling(traces: list, n: int = 50) -> list:
"""Stratified sample: failures + low-confidence + random."""
failures = [t for t in traces if t["status"] == "FAIL"]
low_conf = [t for t in traces if t["score"] < 0.6]
rand_sample= random.sample(traces, min(n//3, len(traces)))
pool = failures + low_conf + rand_sample
return list({t["id"]: t for t in pool}.values())[:n]
|
Production traces are your best source of new test cases. Don't sample uniformly: over-index on failures and low-confidence outputs. 50 labelled production traces outperform 500 synthetic ones for finding real failure modes. Feed back into your offline dataset monthly. |
| online / prod | Braintrust | Online scoring ruleasync LLM judge on live traffic |
# Braintrust online scoring: runs async, no latency impact
# configure via UI: Project → Online Scoring → Add Rule
from braintrust import traced
@traced # instrument your agent call
def run_agent(user_input: str) -> str:
return your_agent(user_input)
# scoring rule fires on each logged trace
# no ground truth available: LLM judge only
|
Online scoring has no ground truth. It's LLM-as-judge on live output. Useful for regression detection, not absolute quality measurement. Critical limitation: judge consistency degrades over time as model updates; re-calibrate the judge against human labels quarterly. |
| online / prod | pattern | Self-hosted trace storeJSONL + DuckDB: no SaaS needed |
pip install duckdb --break-system-packages
import duckdb, json, pathlib
# write traces as JSONL
with open("traces.jsonl", "a") as f:
f.write(json.dumps(trace) + "\n")
# query with DuckDB: no schema, no migrations
duckdb.sql("""
SELECT model, AVG(score), COUNT(*)
FROM read_ndjson('traces.jsonl')
WHERE timestamp > NOW() - INTERVAL 7 DAYS
GROUP BY model""")
|
JSONL + DuckDB is the self-hosted alternative to Braintrust's trace store. No schema migrations, appends are atomic, SQL queries on raw JSON. Sufficient for teams that don't need real-time dashboards. Add a weekly cron to compute summary stats and alert on regression. |
| online / prod | pattern | Regression alert thresholdscore drop detection over rolling window |
def regression_alert(current_week: float,
baseline: float,
threshold: float = 0.05) -> bool:
"""Alert if score drops >5% from baseline."""
drop = (baseline - current_week) / baseline
return drop > threshold
# set baseline from first 2 weeks of prod traffic
# 5% drop threshold: tune to your variance
# alert on: score drop, latency spike, cost spike
|
Alert on relative drop, not absolute score: absolute varies too much across domains. Three signals worth alerting on independently: quality score drop (model/prompt regression), latency spike (retrieval or tool call degradation), cost spike (runaway tool loops or context bloat). |
| cost / budget | pattern | Token cost per taskmeasure before you optimise |
from dataclasses import dataclass, field
@dataclass
class TaskCost:
task_id: str
tokens_in: int = 0
tokens_out: int = 0
tool_calls: int = 0
turns: int = 0
wall_sec: float = 0.0
@property
def cost_usd(self) -> float:
return self.tokens_in * 3e-6 + self.tokens_out * 15e-6
# Sonnet 4 pricing: update when model changes
|
Token cost per task is not optional instrumentation. It's how you detect runaway loops, context bloat, and unnecessarily large system prompts. Measure first, optimise second. A 10-turn agent consuming 50K tokens per task is broken before it's expensive. |
| cost / budget | GAIA (AMD) | Per-scenario budget capcost-bounded eval, not open-ended |
# GAIA timeout formula (adapt for your harness):
def effective_timeout(num_docs: int, num_turns: int) -> int:
base = 300 # 5 min minimum
startup = 120 # agent init
per_doc = num_docs * 90 # indexing
per_turn = num_turns * 200 # eval latency
return min(max(base, startup + per_doc + per_turn), 7200)
# API budget cap (claude -p subprocess per scenario):
--max-budget-usd 0.50 # cost bounded per scenario
|
Never run evals without a budget cap. Agentic loops with tool-calling models can spend $10 on a single runaway scenario. GAIA's design of one subprocess per scenario + per-scenario budget cap is the right pattern: isolates cost and prevents one bad scenario from burning the whole run. |
| cost / budget | pattern | Local judge cost modelfree judge vs API judge tradeoff |
# API judge cost at scale (1000 eval runs/month):
gpt-4.1: ~$0.008/eval × 1000 = $8/month
claude-sonnet-4: ~$0.006/eval × 1000 = $6/month
qwen2.5:7b local: $0.00/eval (electricity only)
# local judge calibration check:
python calibrate_judge.py \
--judge ollama/qwen2.5:7b \
--reference gpt-4.1 \
--sample 50 # spot-check agreement rate
|
Local judge is free but needs calibration. Run agreement-rate check against a reference judge on 50 human-labelled cases before trusting it. Target: >85% agreement on PASS/FAIL classification. Below that, local judge is introducing noise, not saving money. |
| cost / budget | pattern | Eval pyramidfast/cheap gate → slow/expensive suite |
# run in order, abort early on failure:
TIER 1: unit: deterministic scorer, 50 cases, <2 min
TIER 2: integration: local judge, 200 cases, <15 min
TIER 3: full: API judge + τ²-Bench, 1000 cases, <2 hr
# CI: tier 1 on every PR
# CI: tier 2 on merge to main
# scheduled: tier 3 weekly or before release
|
The eval pyramid is a cost control structure, not just a speed optimisation. Tier 1 must be deterministic (no LLM judge, no flakiness). Don't run Tier 3 on every PR. That's how eval costs exceed infrastructure costs. Early abort: Tier 1 failure blocks Tier 2. |
| cost / budget | pattern | Eval variance: why k≥4 trialsstochastic agents need repeat runs |
import numpy as np
scores_1trial = [0, 1, 1, 0, 1] # n=1: high variance
scores_4trials = [0.75, 1.0, 0.75, 0.25, 1.0] # n=4: stable
print(np.std(scores_1trial)) # 0.49: coin flip noise
print(np.std(scores_4trials)) # 0.27: still noisy
# τ²-Bench recommendation: 4 trials minimum
# SWE-bench uses 3; HumanEval reports pass@1 with n=20
|
A single eval run of a stochastic agent is noise. At n=1, standard deviation is ~0.49 for binary tasks. You cannot distinguish a 50% agent from a 70% agent without more trials. Minimum: 4 trials per task. Report mean and std. An agent with high variance is unreliable regardless of mean score. |
| cost / budget | pattern | Self-judge inflation guardprevent same-model bias |
# self-evaluation inflation: same model as judge + subject
# inflates PASS rate by ~15-20% (documented in literature)
SUBJECT_MODEL = "llama3.1:8b"
JUDGE_MODEL = "qwen2.5:7b" # must differ
# calibrate judge before using:
agreement = measure_agreement(
judge=JUDGE_MODEL,
human_labels=gold_labels_50,
threshold=0.85) # reject if below
|
GAIA explicitly states: judge model must differ from model under test. Same-model self-evaluation inflates PASS rate: the model grades its own output charitably. This is not speculation: it's documented across multiple eval papers. Enforce this structurally, not by convention. |
No techniques match this filter.