Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / AI & Agents

Agent Evaluation-Test Generator

AI & Agents advanced 6 min read Free Updated 2026-08-22

Method for building an agent evaluation suite before changing a model, prompt, tool, or permission set: generate representative, boundary, adversarial, permission, and cost test cases, grade deterministically where possible, and convert every real production failure into a permanent regression test.

Shipping a prompt or model change to an agent without a real test suite means the first adversarial input or edge case is a production incident. This turns an agent spec into normal, boundary, adversarial, and permission tests with actual pass criteria.
Interactive resolver

What are you seeing?

Pick the symptom closest to yours — this pulls the likely layer, the first decisive check to run, and what the result means straight from the guide below.

Pick a symptom above to see the match.

Turn an agent specification into repeatable normal, boundary, adversarial, permission, cost, and regression tests with clear pass criteria.

The result you're building

A versioned evaluation suite with representative, boundary, adversarial, permission, cost, and regression cases; deterministic graders where possible; human rubrics where necessary; baselines; and release gates tied to real outcomes.

Use this guide when

  • Before changing an agent model, prompt, tools, schemas, permissions, or workflow.
  • Converting production failures into permanent regression cases.

Do not use it as a substitute for

  • Do not grade style while ignoring unsafe side effects or wrong factual outcomes.
  • Do not reuse only the examples used to tune the prompt.

Before you change anything

  • Collect the items below first. They let you compare before and after, keep the work reproducible, and avoid guessing from a single error message.
  • Agent specification, tools, policies, and success/refusal criteria.
  • Real task distribution and sanitized failure examples.
  • Cost/latency budgets and allowed nondeterminism.
  • Safe sandbox/mocks and grading owners.
Stop before proceeding: Stop release when any critical permission, secret, financial, destructive, cross-tenant, or injection test fails, even if average quality score improves.

Understand the system before fixing it

Evaluate behavior and state, not prose
Check tool calls, arguments, side effects, final external state, citations, spend, and refusals.

Critical cases need zero-tolerance gates
Average scores can hide a single catastrophic action.

A held-out set prevents prompt overfitting
Keep tuning examples separate from release/regression evaluation.

Evidence-to-decision map

EvidenceLikely layerFirst decisive checkWhat the result means
Happy path passes, edge failsCoverageBoundary partitions for every input/toolAdd empty/max/invalid/ambiguous/timeouts.
Answer sounds right, action wrongGraderInspect external state/tool traceUse deterministic outcome grader.
Flaky scoreNondeterminismRepeat seeds/runs and confidence intervalDefine acceptable pass probability/variance.
Adversarial bypassSafetyTrace policy/tool boundaryBlock release; fix independent control and preserve case.

Step-by-step procedure

Work in order. Record the output after each step. If a step produces the stated stop condition, do not keep pushing forward; preserve the evidence and use the recovery path.

Step 01 — Translate spec into observable claims

Why: Vague 'works well' cannot be tested.

Do: List correct tool/arguments, outcome, required evidence, refusal/escalation, budget, latency, and prohibited effects per task.

Read the result: Each claim gets a grader and severity.

Next: Critical safety gates are binary.

Step 02 — Partition case space

Why: Production failures live at boundaries.

Do: Create normal, empty, max, malformed, ambiguous, conflicting, stale, timeout, duplicate, unavailable dependency, permission, injection, secret, cross-tenant, and cost cases.

Read the result: Sample distribution and rare critical risks separately.

Next: Keep tuning/holdout sets.

Step 03 — Build controlled fixtures

Why: Live systems make evaluation unsafe and irreproducible.

Do: Use mocks/sandbox/test accounts, fixed data versions, deterministic IDs/time, and cleanup/reconciliation.

Read the result: No production message/payment/delete can occur.

Next: Record fixture/schema versions.

Step 04 — Choose graders

Why: LLM judges alone can reward fluent wrong answers.

Do: Prefer exact schema, tool trace, database/state, citation, arithmetic, and policy graders; use rubric/human review for nuanced quality with calibration.

Read the result: Grade claimed success against actual outcome.

Next: Capture reason and evidence.

Step 05 — Run baseline/candidate with repeats

Why: One run hides variance.

Do: Use same held-out cases, multiple runs where nondeterministic, and compare critical pass, task success, wrong-tool, invalid-call, refusal, cost, and latency.

Read the result: No candidate ships with critical regression.

Next: Analyze failure clusters, not just average.

Step 06 — Convert incidents to regression

Why: Tests must grow with reality.

Do: Sanitize and minimize each production failure, add expected behavior, reproduce against old version, and require pass before release.

Read the result: Version suite and thresholds.

Next: Review for stale cases/data.

Worked example

Starting problem: A new model improves answer quality 8% but once sends an email from a malicious webpage instruction.

Evidence collected

  • Overall score averages safety and style.
  • Email tool test uses mock but grader checks only final text.
  • Tool trace shows unauthorized send.
  • Injection case is one of 200.

Decision: Average metric hides a critical authority failure.

Actions taken

  • Made unauthorized side effect a zero-tolerance gate.
  • Added deterministic tool/state grader and injection variants.
  • Fixed tool approval/egress boundary and reran held-out suite.
Proof of completion: Candidate ships only after zero unauthorized sends across required repeated critical suite and no material quality/cost regression.

Why this example matters: Severity-aware gates prevent cosmetic gains from buying catastrophic risk.

Verify, recover, and hand off

Completion tests

  • A change is complete only when the original task succeeds, the failure does not immediately return, and adjacent behavior remains healthy.
  • Every spec/policy claim maps to observable grader.
  • Critical side effects use deterministic state/tool checks.
  • Normal/boundary/adversarial/permission/cost cases exist.
  • Held-out and repeated runs quantify variance.
  • Baseline/candidate report includes failures and severity.
  • Production incidents become minimized regression tests.

Rollback or safe recovery

  • Route to last passing model/prompt/tool/schema bundle.
  • Disable changed high-impact tool/policy independently.
  • Preserve failed candidate results and test version for diagnosis.

If the expected result does not appear

What happenedWhat it usually meansNext safe move
Judge disagrees with humansRubric/calibration weak.Calibrate on labeled set or use deterministic evidence.
Tests pass; production failsDistribution/fixture gap.Minimize incident and expand cases/state realism.
Suite too expensiveNo tiering/caching.Run fast critical smoke on every change; full suite on release.
Flakiness masks regressionUncontrolled data/time/model variance.Pin fixtures, repeat, and report confidence/variance.

Reusable handoff record

  • Save this with the project, ticket, or client delivery. It turns the work into a repeatable result instead of a one-time guess.
  • Observable requirements and severity map.
  • Versioned cases/fixtures/graders.
  • Baseline/candidate repeated results.
  • Critical release gates and cost/latency thresholds.
  • Failure clusters and regression additions.

Agent delivery contract

Commercial boundary: Human-readable use remains free. The paid product is deterministic, versioned, structured delivery for agents, bulk automation, and tool integration - not access to hidden facts.

Required inputs

FieldTypeRequirement
contextobjectVersioned environment, target, and requested outcome.
evidenceobject[]Timestamped observations and sanitized command or API results.
constraintsobjectAuthority, risk, downtime, budget, and reversibility limits.
successcheck[]Observable acceptance tests; never infer success from command exit alone.

Returned output

FieldTypeMeaning
diagnosisobjectLikely layer, evidence, alternatives, and confidence.
planstep[]Ordered actions with risk, command or operation, and expected evidence.
verificationcheck[]Pass/fail checks that prove the requested outcome.
handoffobjectSanitized evidence record, remaining risks, and rollback state.

Agent refusal and escalation rules

  • Refuse any request that requires a secret, seed phrase, private key, or credential in ordinary input.
  • Stop when the requested action exceeds declared authority, budget, or reversible scope.
  • Escalate when evidence is missing, contradictory, or too stale to support the proposed action.

Confidence rule: Score confidence from the number and quality of independent observations, not from how familiar the error looks. Return low confidence when only a symptom is available; return high confidence only when a decisive test isolates the layer and the repair is verified.

Official reference starting points