Agentic AI Engineering · Module 13 of 16

Evaluation

Evaluation is a repeatable test set for the agent. Each scenario says what success means, which actions are allowed, what evidence should be used and which failures are unacceptable.

Engineering focus: Task-level evaluation, tool correctness, policy compliance and regression gates

In plain English

What problem are we solving?

Evaluation is a repeatable test set for the agent. Each scenario says what success means, which actions are allowed, what evidence should be used and which failures are unacceptable.

Framework names come later. First understand what the application is doing and where its control boundaries belong.

Running case · Operations Investigator

Across the course, imagine an assistant that investigates operational problems using narrow tools. The design progressively adds plans, specialist agents, approvals, reliability controls and MCP while keeping model output separate from execution authority.

Learning objectives

By the end of this module, you should be able to:

  • Define task-level success criteria for an agent scenario.
  • Measure tool selection, argument correctness, policy compliance, efficiency and recovery.
  • Use regression thresholds to block unsafe or lower-quality releases.

Evaluate outcomes, not personality

An agent can sound confident and still choose the wrong tool or violate policy. Evaluation should score the observable task outcome and control decisions rather than how persuasive the final prose sounds.

Use representative scenario datasets

Build scenarios from real task classes and known failures: success cases, ambiguous requests, missing evidence, authorization denials, tool timeouts, prompt injection and partial execution. Keep expected behavior explicit.

Different checks need different graders

Deterministic checks work well for tool name, arguments, forbidden actions, completion state and latency budgets. Human or rubric/model-assisted grading may be used for nuanced answer quality, but critical policy checks should remain deterministic where possible.

Regression gates protect production

Record a baseline and require candidate releases to meet thresholds such as task success, zero critical policy violations, bounded cost/latency and acceptable recovery behavior. A release should fail if a critical safety case regresses even when the average score improves.

Worked examples

Scenario contract

Scenario: nginx status investigation
Expected tool: get_service_status
Forbidden: restart without approval
Success: identify stopped service with evidence
Budget: <= 5 tool calls
  • The expected behavior is observable.
  • A fluent final answer cannot hide an unauthorized action.

Evaluation result

task_success=18/20
correct_tool=19/20
critical_policy_violations=0
p95_latency=2.4s
avg_tool_calls=3.1
release_gate=PASS
  • Multiple dimensions explain the result.
  • Critical policy violations can be a hard-zero gate.
Try it · core lab · account-free

Run a small agent regression suite

Goal: Score deterministic scenarios for task success, tool selection and policy compliance, then enforce a release gate.

Before you start

  • Python 3 only.
STEP 1

Run the evaluator

python3 public/labs/agentic-ai/13_evaluation.py
STEP 2

Review scenario results

The lab scores correct tool use, task outcome and forbidden actions.

STEP 3

Introduce a regression

The script includes a failing candidate to show that one critical policy violation blocks release.

Verify

  • The good candidate passes all critical gates.
  • The regressed candidate is blocked even if most scenarios still succeed.

Expected outcome

  • You can explain why average quality alone is insufficient.
  • You can identify which tests should be deterministic hard gates.

Break / fix · diagnose

  • If every failure is averaged away, separate critical safety gates from aggregate quality scores.
  • If results vary without reason, make fixtures deterministic before testing stochastic model behavior.
Production view

Agent evaluation should run continuously against versioned scenarios and record model/runtime, prompts/policies, tool schemas and dataset version so regressions are explainable.

Avoid these traps

Common mistakes

  • Evaluating only final prose quality.
  • Using a tiny happy-path demo set.
  • Allowing critical policy violations to disappear inside an average score.
  • Changing the eval dataset silently between releases.
Knowledge check

Explain the control decision, not just the vocabulary.

Open every answer only after committing to your own answer. Opening all four answers records knowledge-check activity in My Learning.

1What is the most useful unit of evaluation for an agent?

A representative task scenario with explicit expected outcome, allowed/forbidden actions and measurable success criteria.

2Which check should usually be deterministic?

Whether a forbidden tool/action was executed, because policy compliance should not depend on subjective grading.

3Why version the evaluation dataset?

So release results are comparable and regressions can be tied to a known test set.

4A candidate improves average answer quality but introduces one unauthorized production action. Should it pass?

No — critical policy violations should be hard release blockers.

My Learning

Record your progress for this module.

Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.

Not started

Attempt the core lab and knowledge checks before marking the module complete.