CCW Vegas

Join us in Las Vegas, June 22–25 for live AI demos, roundtables & 1:1s

Book a 1:1

Table of contents

Reading progress

Summarize this content with AI:

ChatGPTPerplexityGemini

TL;DR

  • Final Answers Lie: An AI agent can give you the perfect answer but take dangerous steps to get there. Also, in order to do this, it may not comply with your systems along the way.
  • Practice Tests Do Not Matter: High scores on lab tests fall apart in the real world. Real tools change, and strict rules easily break top-scoring agents.
  • One Test Is Never Enough: You need hard rules, AI judges, and real humans to check the agent. No single test catches every mistake.
  • Learn From Every Issue and Crash: When an agent fails, you must turn that mistake into a permanent test and not just fix the bug and forget about it.

Still grading your agent on whether the final message sounds right?

That's exactly how catastrophic actions slip through.
An agent can delete an entire database and rebuild it just to change one word. To you, it still gives a correct final answer.

This guide explains what you actually need to test. You will learn how the testing process works and how to catch the hidden mistakes most teams miss.

What Are AI Agent Evals?

AI agent evaluation tests more than just the final words. It checks if the AI makes good choices, uses tools correctly, and takes a safe path to finish the job.

A correct-sounding answer can be a complete lie. An agent might make up a fact instead of using its search tool. Or, it might find the right answer but waste money and break things along the way.

Experts split this testing up into four layers:

  • Step checks: Did the agent get the small tasks right?
  • Path checks: Did it take a logical and safe route?
  • Result checks: Did it actually finish the main goal?
  • System checks: Did it cost too much money or hurt the business?

AI Agent Evals vs. LLM Evals

Evaluating a single prompt-response pair is a fundamentally different problem than evaluating a system that plans, acts, and mutates state across dozens of steps. Treat an agent as a non-deterministic state machine, not a text generator.
Evaluating the distinction between an AI harness vs AI agent can be improved when setting up appropriate test bounds for non-deterministic behavior.

The Four Core Layers of AI Agent Evaluation

Component evaluation checks isolated sub-steps - did the retriever fetch the right document? Trajectory evaluation examines the execution path: ordering, loops, retries, coherence. 

Outcome evaluation verifies the terminal state changed as intended, checked against the database rather than the agent's own summary. System-level evaluation rolls this up into latency, cost, and business resolution.

Feature Traditional Testing LLM Evaluation AI Agent Evaluation
Execution Path Deterministic Single-step stochastic Multi-step, non-deterministic
Primary Metric Pass/Fail Coherence, accuracy Trajectory efficiency, verified state
Environment Static mock data Static prompt datasets Dynamic, stateful, external APIs
Failure Mode Logic/syntax errors Hallucinations Loop cascades, unsafe actions

Why Is Evaluating AI Agents in Production So Difficult?

A wide gap separates public benchmark performance from production reliability. Agents that top the leaderboards routinely fail once compounding errors, environment drift, and long-horizon complexity enter the picture.

Why Benchmark Scores Do Not Equal Production Reliability

Benchmarks like GAIA and SWE-bench saturate fast - modern agents now clear 75%+ of verified SWE-bench issues.
Deep research agents can also exploit Search-Time Contamination, browsing mid-inference to retrieve answer keys and inflating scores by up to 4%. Dynamic benchmarks like SWE-bench-Live and τ-bench expose the gap static snapshots hide.

How Production Environments Create Failures Offline Evals Miss

An agent can predict a perfect API payload and still fail because a record is locked, a permission changed, or a schema drifted mid-request.
Real tasks are dual-control - both agent and human alter shared state - and τ²-bench shows performance drops sharply moving to that dual-control mode.

Environment Realism Variability Best Use Case
Public Benchmark Low Static Initial capability screening
Staging / Sandbox Medium Controlled, injectable Fault-injection, safety testing
Production High Live, uncontrolled Drift detection, real failure discovery

What Should You Evaluate in an AI Agent?

Agent evaluation needs a multi-dimensional framework mapping failure symptoms to the layer that produced them - generic accuracy alone won't catch most of what breaks.

Outcome Quality and Task Completion

Task completion rate, correctness of the final state, resolution quality, partial success, cost per resolution, and satisfaction. Trusting the agent's own claim of success isn't enough - verify the backend state actually changed.

Agent Reasoning and Decision Quality

Scrutinize planning quality, action selection, premature stopping, and unnecessary actions. An agent that reaches a conclusion but hallucinates the logic behind its tool choice has poor reasoning coherency that resurfaces later.

Tool Use and Function Calling

Check tool selection accuracy, schema compliance, argument accuracy, and call success rate. Redundant calls, wrong sequencing, and fabricated observations are the most common failure modes here.

Trajectory Quality and Step Efficiency

Examine steps, loops, retries, dead ends, and recovery sequences. An agent that reaches the right outcome through 15 unnecessary retries is inefficient and potentially dangerous - waste gets penalized even when the task succeeds.

Context, Memory, and State Management

Detect stale context, context contamination, poor retrieval quality, and state corruption. Research from Arvix suggests in dense domains like Banking, agents frequently pull the wrong document, triggering policy violations and bad state transitions.

Safety, Security, and Policy Compliance

Assess unauthorized actions, excessive permissions, prompt injection, tool poisoning, and data leakage - confirming the agent won't act unsafely against an adversarial or poisoned environment.

Failure Symptom Metric Example
Missing parameters Schema Compliance Passes a string where an integer is required
Endless retry loop Step Efficiency Calls get_user 10 times in a row
False "success" text Task Completion Rate Says "refund processed," database unchanged
Exfiltrated API keys Safety Incident Rate Tool poisoning leaks credentials
High cost, simple task Cost per Task Reads 50 files to find one email

How Do AI Agent Evals Work?

The full pipeline runs from defining a goal to committing a production failure as a permanent regression test - a lifecycle, not a one-time gate before launch.

Define the Agent Goal and Success Criteria

Before writing a single eval, define the measurable outcome and the behavioral constraints that make an action unacceptable regardless of outcome.

Create and Version Evaluation Datasets

Hand-authored cases give high fidelity but low coverage; synthetic datasets scale infinitely but skip real-world mess. The most robust approach converts historical production traces into labeled, versioned datasets.

Run Agents in Sandboxes and Simulated Environments

Because agents take real actions, testing against live APIs risks catastrophic data corruption. Use simulators, mock APIs, and ephemeral containers for reproducibility, re-running only retryable failures.
Sandbox management can be helped by using an AI agent harness to safely decouple tool actions from live environments.

Capture Traces and Grade the Agent

Every run needs a captured trace: tool calls, reasoning steps, and state changes. Grading applies trajectory scoring against that trace and outcome verification against the terminal state - never the agent's own summary.

Turn Failures Into Regression Tests

When a production incident happens, extract the trace, scrub PII, attach a ground-truth label, and add it to the CI/CD dataset - the loop that stops teams from fixing the same bug twice.

Stage What Happens Output
Define Set success criteria & constraints Measurable goal spec
Generate Build or extract test scenarios Versioned dataset
Execute Run agent in sandbox Captured trace
Grade Score trajectory & outcome Pass/fail + rubric scores
Regress Commit incident as test case New CI/CD test

What Are the Different Types of AI Agent Evaluations?

No single evaluator covers everything - production pipelines run a hybrid funnel, deterministic checks first, then heuristics, then LLM judges, with human review reserved for what matters most.

Deterministic Evaluation

The cheapest, most reliable method for component testing - schema compliance, exact matches - though it misses reasoning nuance and alternative valid paths.

Rule-Based and Formal Verification

Treats the LLM as an oracle inside a formally verifiable finite-state machine. With studies from Research Gate show that temporal logic and Event-B catch deadlocks and permission bypasses at the cost of setup effort.

LLM-as-a-Judge Evaluation

Frontier models grade subjective properties like reasoning coherence and plan adherence - scalable, but susceptible to bias and cost at high volume.

Trajectory-Based Evaluation

Analyzes the step-by-step path rather than the final answer - essential for catching an agent that succeeded through an unauthorized shortcut.

Human Evaluation and Judge Calibration

The gold standard, used to calibrate automated judges and review uncertain edge cases through targeted uncertainty sampling.

Method Best Use Case Cost/Scale Limitation
Deterministic CI, component tests Very low / infinite Misses nuance
Formal Verification Safety-critical flows High setup Rigid state defs
LLM-as-a-Judge Trajectory grading Medium Bias, cost
Trajectory Analysis Debugging errors Low / high Overfits to one path
Human Review High-risk calibration Very high / low Slow, unscalable

Which Metrics Should You Use for AI Agent Evals?

Metrics need technical fidelity and business reality together - an agent can get "better" on a benchmark while becoming slower, pricier, and less reliable.

Core Technical Metrics

Task completion rate, tool-call accuracy, schema compliance, and trajectory efficiency - steps taken versus required - plus loop rate, retry rate, and recovery success rate.

Production and Operational Metrics

Latency, cost per successful task, token usage, and escalation rate - first-class evaluation dimensions, not afterthoughts checked once a quarter.

Safety and Reliability Metrics

Policy violation rate, unsafe action rate, data leakage incidents, and security attack success rate - ignore these and you'll greenlight agents that are quietly dangerous.

Business Outcome Metrics

Measure end-to-end resolution, not narrow task closure - downstream work created, customer impact, and human effort genuinely saved versus simply shifted elsewhere.

Metric Detects When to Use
Task Completion Rate False "success" claims Every eval
Trajectory Efficiency Wasteful, unsafe paths Pre-launch
Recovery Success Rate Cascading failures Fault injection
Cost per Successful Task Runaway spend Continuous monitoring
Safety Incident Rate Unsafe actions Adversarial eval

How to Evaluate AI Agents in Production

This is the crux of running agents safely at scale - not a switch you flip once, but a continuous discipline.

Offline Evals vs. Online Evals

Offline evals run against static datasets in CI/CD, safely catching regressions - but miss environmental drift.
Online evals score live traces asynchronously, catching real anomalies but unable to block a bad output before a user sees it.

Production Trace Sampling and Triage

Grading 100% of live traffic with an LLM judge is cost-prohibitive. Signal-based triage computes cheap heuristics - execution failures, context-length spikes, loop detection - to flag informative sessions. 

Random sampling wastes budget on happy paths; shift toward failure-based sampling instead.

Detecting Model, Retrieval, Tool, and Policy Drift

Model drift happens when the foundation model's weights or guardrails change. Retrieval drift comes from an evolving knowledge base. Tool drift hits when services alter schemas. Policy drift renders previously correct behavior invalid as rules shift.

Adding AI Agent Evals to CI/CD

Updating a prompt, adding a tool, or tweaking a policy must trigger a regression suite scoped to exactly the domains affected - not a full re-run, and not a silent merge with no gate at all.

Offline Online
Environment Sandboxed, mocked APIs Live production, real APIs
Timing Pre-deployment, CI/CD gate Post-deployment, async
Goal Prevent regressions Detect drift, novel failures
Sampling Exhaustive Statistical, triage-based

Trigger Event Suite Executed Goal
Pull request Component & regression tests Catch broken logic early
Model upgrade Exhaustive trajectory & outcome Catch alignment/reasoning shifts
New tool added Tool-use & security checks Prevent schema failure, poisoning
Pre-launch Golden dataset, formal verification Gate on cost & safety
Continuous Trace sampling, LLM judge Detect drift, edge cases
Post-incident Replay extraction Convert failure into regression test

AI Agent Observability vs. AI Agent Evaluation

Observability answers "what happened." Evaluation answers "was it good." The two get conflated constantly, but neither replaces the other.

What AI Agent Observability Captures

Traces, spans, tool invocations, token usage, latency, logs, and state changes - passive collection that reconstructs what an agent did, without judging whether it was right.

How Observability Data Powers AI Agent Evals

Without execution data captured as structured traces, evaluating non-deterministic outputs is impossible. Raw traces don't explain failures alone - an evaluation suite overlays scores to pinpoint which span caused the collapse.

Incident Replay and Resume Safety

Can an engineer reconstruct the exact state after a failed run? Replay means rebuilding the log via an append-only receipt log; resume means safely continuing from a durable checkpoint - which demands tracking every mutating tool call and enforcing idempotency.

Observability Evaluation
Core Focus Visibility, debugging, cost Quality, correctness, safety
Outputs Span trees, logs, graphs Scores, pass/fail gates, rubrics
Mechanism Passive collection Active grading
Use Case Reconstruct a session Block a bad change in CI

The AI Agent Failures That Final-Answer Evals Miss

Standard evals focus almost entirely on final-answer correctness. These five patterns are exactly what that lets slip through.

Correct Answer, Wrong Trajectory

An agent can reach the right final state through an inefficient, expensive, or genuinely risky sequence of actions - the path taken dictates infrastructure cost and safety, and functional correctness alone overestimates quality.

Duplicate Actions and Infinite Loops

Agents get stuck calling the same API with identical parameters after an unexpected response, sometimes terminating with a generic "task failed" that hides dozens of costly, rate-limited calls underneath.

Recovery Quality After Tool or API Failures

Production infrastructure is inherently flaky. An agent that assumes a timed-out call succeeded and proceeds anyway hallucinates every downstream action - which is why fault-injection testing matters more than clean-path testing.

Partial Task Completion

On a multi-part prompt, an agent may nail one sub-intent and silently drop the others - binary pass/fail metrics force evaluators to pass an incomplete task or fail one that was partly useful.

External Side Effects and State Corruption

An agent can achieve its primary goal while quietly mutating unrelated external state. Standard evaluators typically check only the fields it was supposed to touch - missing destructive side effects until production.

Failure Type Final-Answer Eval Miss Catch It With
Redundant API loops Output looks fine, cost 10x higher Trajectory step-efficiency analysis
Search-time contamination Passes benchmark via memorization Network-isolated sandboxes
Memory contamination Converses fine on fake past data Transactional state assertions
Tool metadata poisoning Executes an attacker's injected command Adversarial tool evaluation
Context-free escalation Bails safely, human starts from scratch Handoff payload verification

How to Evaluate AI Agent Memory, State, and Long-Horizon Tasks

Agents that remember things or run for hours introduce evaluation problems a clean-slate test will never surface.

Testing Stale and Poisoned Memory

Multi-turn agents lean on shared vector stores; a past hallucination becomes a false premise for future logic. Inject stale information and check whether the agent verifies it before acting.

Evaluating Idempotency and Safe Retries

If an agent crashes and resumes, it might fire a side effect twice without an idempotency key. Kill the process right after the side effect fires but before the receipt records, and confirm it doesn't double-send.

Measuring Delayed Outcomes

Long-horizon tasks - send an email, wait for a reply - can't be scored in milliseconds like a CI test. Link future telemetry back to the original trace ID and score only after the window closes.

Evaluating Reversibility and Compensation

Agents make mistakes; the real question is whether they can undo one. Force a logic failure after a state-changing call and confirm the agent calls the correct compensation tool instead of leaving damage in place.

How to Test AI Agent Security and Safety

Security deserves its own dedicated evaluation track, not a line item buried inside a general metrics dashboard.

Prompt Injection and Indirect Prompt Injection

Test whether instructions hidden inside external content - a webpage, a tool response - can override the agent's task. Indirect injection is especially dangerous because the malicious text never comes from the user.

Tool Poisoning and Tool Description Poisoning

Attackers embed malicious instructions in a tool's metadata, targeting planning logic rather than the user prompt. On the MCP-TDP benchmark, leading models show close to a 100% attack success rate against poisoned descriptions.

Permission Boundaries and Unauthorized Actions

Confirm the agent never exceeds its intended authority - no reading outside scope, no calling a destructive tool it wasn't explicitly granted.

Data Leakage and Sensitive State Exposure

Check whether tool outputs, memory, or context can expose credentials - a schema check alone won't catch a hallucinated string that leaks a real API key.

Threat Attack Surface Evaluation Method
Prompt injection User input, tool responses Adversarial input testing
Tool description poisoning Tool/MCP metadata Poisoned-metadata sandbox testing
Excessive permissions Action scope Boundary/authorization testing
Data leakage Memory, tool output, context Sensitive-data exposure scanning

Common AI Agent Evaluation Mistakes

  • Grading Only the Final Answer: missing every unsafe or wasteful step taken to get there.
  • Relying on One Golden Trajectory: penalizing valid alternative paths the agent discovered on its own.
  • Treating Benchmark Scores as Production-Ready: ignoring drift, contamination, and dual-control complexity.
  • Testing Only Clean Environments: skipping fault injection for the flaky APIs agents actually meet.
  • Ignoring Recovery After Failure: never checking if the agent hallucinates success after a timeout.
  • Evaluating Only Fresh Memory: missing how stale or poisoned context degrades long sessions.
  • Running Uncalibrated LLM Judges: trusting a biased evaluator as ground truth.
  • Sampling Production Traces Randomly: burning budget on happy paths while rare failures go unreviewed.
  • Ignoring Evaluation Cost: building a pipeline so expensive it gets quietly abandoned.
  • Never Converting Incidents Into Tests: fixing the same production bug over and over.

A Practical AI Agent Evaluation Checklist

  1. Define verifiable task outcomes tied to actual backend state
  2. Identify unacceptable actions and hard policy constraints upfront
  3. Build component and tool-use tests for every integration
  4. Add trajectory and recovery tests, not just outcome checks
  5. Verify final system state - never trust the agent's summary
  6. Test prompt injection and tool poisoning in an isolated sandbox
  7. Add fault-injection scenarios that simulate real API flakiness
  8. Calibrate LLM judges against human reviewers on a regular cadence
  9. Wire evaluation gates directly into CI/CD, not a side process
  10. Monitor production traces continuously, not just at launch
  11. Watch for model, retrieval, tool, and policy drift separately
  12. Convert every production failure into a permanent regression case

Building Production-Ready AI Agents With Thunai AI

Most agent evaluation frameworks exist because most agents weren't built with production rigor in mind.
However, Thunai was.

  • With this Agentic AI orchestration platform, every suggestion is grounded in retrieved, verified context, so it's never raw model guesswork based on Thunai Brain or AI knowledge base - where complex enterprise information can be helped by integrating Thunai Knowledge Graph and SafeMind, as we did for a Fortune100 retailer.
  • Every interaction is automatically scored against your SOPs using AI call scoring, not a random 2% sample using AI call scoring.
  • Trajectory-level safeguards catch unsafe or looping actions before they reach a customer, while human-in-the-loop handoffs preserve full context instead of forcing a restart. On calls and AI chats, Thunai Omni allows this through our barge-in feature.
  • With Thunai, deployments stay fully isolated, with continuous drift monitoring built in rather than bolted on.

So if your evaluation checklist demands verifiable outcomes, safety, and real observability, Thunai is designed to pass it by default.
Want to see Thunai AI in action? Book a free demo!

Aditya Santhanam is a technology entrepreneur and the Co-Founder & CTPO of Thunai AI, Entrans Technologies, and Infisign. A former AWS product leader, he specializes in building advanced agentic AI systems and decentralized cybersecurity architectures.

Let AI Handle the Busywork.

Try Thunai yourself with a 16-day free trial

Get Started for Free
Get Started