Skip to content

Founder-led. Limited engagements.Talk to Us →

Part 21 of 30 · 30 Days of AI Agents

Evaluating AI Agents | 30 Days of AI Agents, Day 21

How to evaluate AI agents in practice: test sets, metrics by category, LLM-as-a-judge, human review, benchmarks, and a continuous evaluation loop that sticks.

By CodeITronics6 min readAI Agents · Evaluation · LLM Ops · AI Engineering
Evaluating AI Agents | 30 Days of AI Agents, Day 21

Yesterday we covered how multiple agents collaborate, from supervisors and pipelines to blackboards and swarms. Before adding more agents, tools, or memory, you need a way to tell whether any of it actually works. Day 21 is about evaluating AI agents: what to measure, how to measure it, and how to make evaluation a loop instead of a launch-day checkbox.

Evaluating AI Agents — CodeITronics infographic

Save this sheet. The rest of this note walks through it section by section.

What evaluation means for an agent

Evaluation is the process of measuring how well an agent performs its tasks: how accurate it is, how reliably it behaves, whether it stays safe, how efficiently it gets there, and whether the person on the other end had a good experience.

That is harder for agents than for a single prompt. An agent produces a trajectory: it plans, calls tools, reads results, retries, and only then answers. Two runs on the same input can take different paths and both be right. So you are not just grading text. You are grading decisions.

Done well, evaluation finds weaknesses before users do, catches regressions when you change a prompt or swap a model, and builds the trust that gets an agent out of pilot. You can't improve what you don't evaluate.

The evaluation loop

  1. Define goals. Write down what "good" looks like as criteria a reviewer could apply.
  2. Create a test set. Typical requests, edge cases, and adversarial inputs.
  3. Run the agent multiple times. One run of a non-deterministic system tells you very little.
  4. Collect data. Outputs, logs, traces, tool calls, tokens, and latency.
  5. Evaluate. Score with rules, model judges, and human review.
  6. Improve. Change the prompt, tools, memory, or planning, then run the loop again.

Treat the test set as a living asset: every production failure becomes a new test case.

The building blocks

ComponentWhat it isPractical note
Test dataDiverse inputs, edge cases, real-world scenariosStart with 30 to 50 hand-picked cases from real usage, not synthetic filler
MetricsQuantitative scoresPick a few that map to user outcomes
EvaluatorsRules, LLM judges, or humansUse the cheapest evaluator that is reliable for each check
Traces and logsStep-by-step execution recordsEssential for diagnosing why a score dropped
BenchmarksStandard datasets for comparisonUseful for model selection, weak for your specific task
FeedbackHuman or automated signalsThumbs up or down, corrections, escalations

Metrics by category

  • Correctness: accuracy, exact match, F1. For structured outputs like SQL or JSON, check execution success, not text similarity.
  • Completeness: recall and coverage. Did it address every part of the request?
  • Helpfulness: ratings and satisfaction. Was the answer usable, not just technically right?
  • Efficiency: latency, tokens, number of steps. The right answer in fourteen tool calls is still a problem.
  • Robustness: error rate, retry success, fallback usage on ambiguous or broken inputs.
  • Safety: policy compliance, toxicity, data leakage. Treat these as gates, not averages. One leaked record is not offset by good helpfulness scores.

Choosing an evaluation method

MethodBest forWatch out for
Rule-basedFormat checks, required fields, exact answers, forbidden contentBrittle on open-ended text
LLM as a judgeRelevance, helpfulness, correctness against a referenceJudges drift, prefer longer answers, and can be inconsistent
Human evaluationHigh-stakes tasks, calibrating judges, subjective qualitySlow and costly, so sample
HybridMost real systemsNeeds clear rules about which evaluator decides what
A/B evaluationComparing two agent versions on the same test setNeeds enough cases to see real differences

In practice you layer them: rules on every case because they are free, the judge where rules cannot decide, and humans on a sample plus everything the judge scored low.

Worked example with a support agent

The sheet scores a support agent from 1 to 5 on correctness, completeness, helpfulness, efficiency, robustness (handling an ambiguous input), and safety, averaging 4.2 out of 5.

The average is the least useful number on that card. The 3 on robustness tells you where to dig. Read the traces for the ambiguous cases: did the agent guess instead of asking a clarifying question, or call the wrong tool? That diagnosis turns a score into a fix.

A minimal LLM judge harness

The sheet includes a short Python judge. Here is a slightly sturdier version that returns structured scores and runs each case more than once.

import json
from openai import OpenAI

client = OpenAI()

JUDGE_PROMPT = """You are grading a support agent's answer.
Question: {question}
Reference answer: {expected}
Agent answer: {answer}

Score correctness and completeness from 1 to 5.
Return JSON: {{"correctness": int, "completeness": int, "reason": str}}"""

def judge(question, expected, answer):
    resp = client.chat.completions.create(
        model="gpt-4o-mini",
        temperature=0,
        response_format={"type": "json_object"},
        messages=[{"role": "user", "content": JUDGE_PROMPT.format(
            question=question, expected=expected, answer=answer)}],
    )
    return json.loads(resp.choices[0].message.content)

def run_suite(agent, cases, runs=3):
    results = []
    for case in cases:
        for _ in range(runs):
            answer = agent(case["question"])
            results.append({"id": case["id"], **judge(case["question"], case["expected"], answer)})
    return results

Two habits make this trustworthy. Keep the judge model and prompt pinned, so a score change means the agent changed, not the grader. And periodically have a human score a sample of the same cases to confirm the judge agrees with people.

Where public benchmarks fit

GAIA (general assistant tasks), AgentBench (varied environments), ToolBench (tool and API use), the Berkeley Function Calling Leaderboard, and HELM (holistic model evaluation) help with one decision: which model to start with. They do not tell you whether your agent handles your refund policy or your customers' phrasing. That needs your own test set.

Best practices and common traps

The practices on the sheet hold up: clear criteria, diverse and challenging tests, combined methods, tracking over time, human review for important tasks, and production monitoring.

The traps: the wrong metrics, test sets full of easy cases, uncalibrated judges, eval runs so slow or costly that nobody runs them, and bias where the test set reflects what the team expects rather than what users send. Most teams also skip the boring part: wiring the suite into CI so it runs on every prompt or model change.

Key Takeaways

  • Agents produce trajectories, not just answers, so evaluate decisions, tool use, and efficiency along with the final output.
  • Run each test case several times; one run of a non-deterministic system proves very little.
  • Combine rules, LLM judges, and human review, and use humans to calibrate the judge.
  • Work from per-dimension scores and failing traces, not the overall average.
  • Turn every production failure into a new test case and run the suite on every change.

FAQs

How many test cases do I need to start?

Start with a few dozen well-chosen cases drawn from real usage, covering typical, edge, and adversarial inputs. Grow the set from production failures rather than padding it with synthetic cases.

Can I trust an LLM to grade my agent?

For many checks, yes, if you pin the judge model and prompt, ask for structured scores against a reference, and regularly compare its scores with human reviewers on a sample.

Should safety be part of the overall score?

Keep safety separate as a pass or fail gate. Averaging it with helpfulness hides the failures you most need to see.

Up Next

Tomorrow is Day 22: AI Agent Safety and Guardrails. We will look at input, action, and output guardrails, how to stop prompt injection and unauthorized tool calls, and when an agent should hand a decision to a human. If your team wants an evaluation harness built around a real agent, get in touch.

Keep reading

MCP (Model Context Protocol) | 30 Days of AI Agents, Day 8

Day 8 of 30 Days of AI Agents: what MCP is, how hosts, clients, and servers fit together, a small Python MCP server, and the security caveats.

Building Your First AI Agent | 30 Days of AI Agents, Day 7

Day 7 of 30 Days of AI Agents: build a small working agent in Python with tool calling, web search, a safe calculator, memory, and a step limit.

AI Agent Lifecycle | 30 Days of AI Agents, Day 6

Day 6 of 30 Days of AI Agents: the six-stage agent lifecycle from perceive to evaluate and learn, with a worked example and what to log at each stage.

Subscribe to the edition

One useful systems note a week from real Salesforce and automation builds. Unsubscribe in one click.

Letters

Letters to the editor

No letters yet. Questions and counterpoints are welcome.