Evaluating Agent Performance: Metrics That Matter
Task success rate is a vanity metric. Here are the metrics that actually matter for production agents.
Why Task Success Rate Lies
Imagine an agent that:
- Succeeds 90% of the time on simple tasks
- Fails catastrophically 10% of the time (deletes database, leaks API keys)
- Has no way to recover from failures
Task success rate: 90% → Looks good. Reality: Dangerous.
Production agents need a richer set of metrics.
The Four Essential Metrics
| Metric | What It Measures | Why It Matters | Target |
|---|---|---|---|
| Faithfulness | How often the agent sticks to retrieved facts | Prevents hallucinations and made-up answers | ≥ 0.9 |
| Hallucination Rate | % of outputs containing unsupported facts | Direct measure of reliability | ≤ 0.05 |
| Cost-Per-Task | Average cost (in $) to complete a task | Determines economic viability | < $0.05 |
| Recovery Rate | % of failed tasks that self-recover via retries/failovers | Measures resilience | ≥ 0.8 |
Let’s dive into each.
1. Faithfulness: The Truthfulness Score
Faithfulness measures whether the agent’s output is supported by the sources it consulted.
Definition:
Given a context C (retrieved documents, conversation history) and an output O,
faithfulness = % of claims in O that are entailed by C.
How to Measure:
- Extract claims from output O
- For each claim, check if it’s supported by context C
- Score = (supported claims) / (total claims)
Example:
-
Context: “The study found magnesium reduced sleep latency by 15 minutes.”
-
Output: “Magnesium reduces sleep latency by 15 minutes, based on the study.”
-
Faithfulness: 1.0 (claim is supported)
-
Output: “Magnesium reduces sleep latency by 30 minutes, based on the study.”
-
Faithfulness: 0.0 (claim contradicts context)
Tools: Use NLI models or LLM-as-judge to automate.
Target: ≥ 0.9 for production use. Below 0.8 requires immediate investigation.
2. Hallucination Rate: The Reliability Gauge
Hallucination rate measures how often the agent invents facts.
Definition:
% of task outputs that contain at least one hallucinated fact.
How to Measure:
- Run agent on a test set with known ground truth
- For each output, verify all factual claims against ground truth
- Score = (outputs with ≥1 hallucination) / (total outputs)
Types of Hallucinations:
- Intrinsic: Contradicts provided context (e.g., context says X, agent says not-X)
- Extrinsic: Adds information not in context and not verifiable (e.g., “The study also found Y” when Y wasn’t studied)
Target: ≤ 0.05 (5%) for production. Medical/legal agents: ≤ 0.01.
3. Cost-Per-Task: The Economic Metric
Agents consume tokens and make tool calls. Cost-per-task tells you if it’s affordable.
Definition:
Average total cost (in USD) to complete one task end-to-end.
Calculation:
Cost-Per-Task =
(Input Tokens × $/1K_input) +
(Output Tokens × $/1K_output) +
(Tool Calls × $/call) +
(Overhead × $/second)
Example Breakdown for a Research Task:
- Input tokens: 2000 × $0.15/1K = $0.30
- Output tokens: 500 × $0.60/1K = $0.30
- Tool calls: 5 web searches × $0.005 = $0.025
- Total: $0.625
Optimization Levers:
- Use cheaper models for sub-tasks (Haiku for extraction, Opus for synthesis)
- Cache repeated searches and extractions
- Compress prompts
- Batch tool calls
Target: Depends on use case. For high-volume tasks: < $0.01. For deep research: < $0.50.
4. Recovery Rate: The Resilience Measure
No agent is perfect. Recovery rate measures how well it handles failures.
Definition:
% of failed tasks that the agent successfully recovers from via retries, fallback tools, or self-correction.
How to Measure:
- Inject failures (tool errors, timeouts, bad outputs)
- Observe agent’s response
- Score = (tasks recovered to success) / (total failed tasks)
Recovery Strategies:
- Retry with exponential backoff (for transient errors)
- Fallback tools (if web_search fails, try cached data)
- Self-correction (if output fails validation, regenerate)
- Human escalation (after N failures, ask for help)
Example:
Agent tries to extract data from a PDF.
- First attempt: PDF corrupted → retry with different parser → success
- Second attempt: Parser timeout → fall back to manual extraction → success
- Recovery rate: 100% for these failures
Target: ≥ 0.8 for production. Below 0.5 means the agent is brittle.
The Evaluation Dashboard
Track these metrics over time:
# Monitoring configuration
metrics:
faithfulness:
window: 1h
alert: "< 0.85"
critical: "< 0.7"
hallucination_rate:
window: 1h
alert: "> 0.1"
critical: "> 0.2"
cost_per_task:
window: 24h
alert: "> $0.10"
critical: "> $0.50"
recovery_rate:
window: 1h
alert: "< 0.7"
critical: "< 0.5"
Building a Test Suite
Create a golden dataset for continuous evaluation.
1. Faithfulness Test Set
| Context | Query | Expected Output (Supported Claims) |
|---|---|---|
| “Study: Mg improves sleep latency by 15 min (N=50)” | “What did the study find about magnesium and sleep?” | “The study found magnesium improved sleep latency by 15 minutes.” |
| “API returns error 429 when rate limited” | “How should we handle 429 errors?” | “Implement exponential backoff and retry.” |
2. Hallucination Test Set
| Query | Known Fact | Hallucination to Detect |
|---|---|---|
| “What is the capital of France?” | “Paris” | “London” |
| “What does the study say about dosage?” | “Study tested 200mg” | “Study tested 500mg” |
3. Failure Injection Test Set
| Tool | Failure Type | Expected Recovery |
|---|---|---|
| web_search | Timeout | Retry 2x with backoff |
| web_extract | 404 | Fall back to search snippet |
| LLM call | Rate limit | Queue and retry later |
The Takeaway
Stop measuring task success rate. Start measuring what actually matters:
- Faithfulness → Does the agent stick to the facts?
- Hallucination Rate → How often does it make things up?
- Cost-Per-Task → Can you afford to run it at scale?
- Recovery Rate → How well does it handle failures?
A production agent isn’t the one that succeeds most often. It’s the one that:
- Stays truthful
- Admits uncertainty
- Manages costs
- Bounces back from failures
Measure these. Alert on them. Improve them.
Your users (and your CFO) will thank you.