FullStack AI Hub
Studio
lesson depth
Mastery
not started · 0%

Agent Evaluation

Evaluate agent trajectories, actions, outcomes, and policy compliance rather than judging only the final response.

Freshness: current•15 min read•Agentic Systems and Protocols

Key Learning Outcomes

  • ✓Explain the operating model behind Agent Evaluation.
  • ✓Evaluate trade-offs and failure modes for Agent Evaluation.
  • ✓Apply Agent Evaluation to a production decision.
Full Technical Reference Document

Mental model

Agent evaluation treats multi-turn autonomous workflows as stateful software systems rather than static text completion prompts. Instead of judging eloquent final answers, production harnesses spin up seeded sandbox environments, assert exact external world-state transitions (database records, diffs, API ledger mutations), audit tool call trajectories and security boundaries, and measure consistency across multiple independent runs (pass^k).

Seeded deterministic sandbox
Autonomous multi-turn trajectory
Post-run DB/FS state assertions
Trajectory cost & policy audit
Slice pass^k gate & CI log
Conceptual teaching model synthesized from:Demystifying Evals for AI AgentsEvaluation Best Practices

Learning outcomes

  • Measure world-state side effects deterministically rather than trusting an agent's self-reported completion summary.
  • Contrast optimistic pass@k capability discovery (1 of k succeeded) against production reliability consistency pass^k (all k runs succeeded).
  • Construct layered agent evals spanning unit code graders, trajectory step-cost limits, security injection probes, and calibrated LLM rubrics.

Theory

Evaluation harnesses built solely for stateless chat fail catastrophically on tool-using agents because an agent can apologize politely while deleting the wrong row, burn 28 tool calls circling broken filters before stumbling onto luck, or claim "Refund complete" while omitting database commit calls completely. Comprehensive agent benchmarking grades four distinct layers on every release:

Evaluation LayerPrimary Signal GradedDeterminismProduction Failure Caught
Environment State AssertionsPost-run SQL row values, failing-to-passing test suite exit codes, ledger receipts100% deterministicFalse success claims, forgotten cleanup, silent corruption
Trajectory Efficiency & PathTool call count, redundant retry loops, total latency & dollar spendDeterministic countersInfinite browse/search loops, wasteful brute-force scanning
Policy & Adversarial SecurityUnauthorized tool/tenant arguments blocked; prompt injection payloads ignoredRule engine + taint checkConfused-deputy exfiltration, deleting protected fixtures
Rubric & UX Quality GraderTone, citation completeness, escalation timing across nuanced edge transcriptsPairwise LLM judge calibrated via kappaCorrect outcome reached via rude/confusing user interaction

Notice the crucial statistical distinction between pass@k and pass^k when evaluating non-deterministic agents over kk repeated trials per task:

  • pass@k: Probability at least 1 out of kk runs passes (useful for exploratory R&D / coding search where users pick the best diff).
  • pass^k (pkp^k approximation across kk independent trials): Probability all kk trials succeed consecutively (critical for unattended customer refunds, compliance actions, or SRE playbooks). An agent scoring 70% per single trial delivers only 0.705≈16.8%0.70^5 \approx 16.8\% five-run consistency (pass^5), exposing fragile edge behavior immediately!
python
from dataclasses import dataclass
​
@dataclass(frozen=True)
class TrialTrace:
task_id: str
trial_idx: int
db_state_valid: bool
policy_violations: int
tool_calls: int
max_allowed_calls: int
​
def compute_agent_reliability_metrics(
traces: list[TrialTrace],
k_trials: int = 3,
) -> dict[str, float]:
"""Compute pass@k vs strict pass^k consistency while disallowing policy violations."""
by_task: dict[str, list[bool]] = {}
for t in traces:
passed = t.db_state_valid and t.policy_violations == 0 and t.tool_calls <= t.max_allowed_calls
by_task.setdefault(t.task_id, []).append(passed)
​
valid_tasks = [runs[:k_trials] for runs in by_task.values() if len(runs) >= k_trials]
n = max(1, len(valid_tasks))
pass_at_k = sum(1 for runs in valid_tasks if any(runs)) / n
pass_pow_k = sum(1 for runs in valid_tasks if all(runs)) / n
return {"pass_at_k": round(pass_at_k, 3), "pass_power_k": round(pass_pow_k, 3)}

Trade-offs

Full container-isolated environment assertion suites with trajectory replay catch real production regressions reliably and expose silent policy tampering before rollout, at the cost of slower CI execution (minutes per run), stateful sandbox reset plumbing, and trace storage redaction overhead. Lightweight final-answer LLM judges run cheaply in seconds on pull requests cleanly, yet miss broken database state, subtle privilege escalation attempts, and multi-turn thrashing completely. Teams pair fast deterministic unit/mock-tool trajectory sanity checks on every commit with nightly real-sandbox pass^3 suites across high-consequence billing and admin tasks.

Failure modes and misconceptions

  • Grading Self-Reported Completion: Trusting "I have refunded $49 cleanly" without asserting downstream ledger state misses silently dropped commits and API errors.
  • Confusing Single-Run Luck with Production Readiness: Celebrating pass@5 = 90% when pass^5 = 12% ships wildly flaky behavior to unattended workflows.
  • Allowing Test Tampering in Coding Agents: Failing to hash-lock unit tests during autonomous SWE grading lets agents delete failing assertions to make exit codes green cleanly.
  • Unredacted Production Trace Leakage: Saving raw customer secrets cleanly into public evaluation fixtures creates severe compliance leaks.

Decision scenario

A customer operations team plans to move a refund agent from supervised human-draft mode into unattended automation after seeing 88% rubric score on single-turn final responses. Telemetry reveals no database postcondition checks or repeat consistency tests. Design a sandboxed SQL state verifier, pass^3 consistency gate, and policy violation suite.

Reflect before revealing the guide

Why is grading an agent solely on a fluent, accurate-sounding final response insufficient before enabling autonomous external actions?

Prerequisites & Related Concepts (4)

Private notes

0 words
Included In Free Course
Free · Verifiable Credential

FS-301Agentic Systems Engineer

Engineer bounded tool-using systems with explicit workflows state protocols evaluation observability security and human control.

27 concepts~29h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.

Next