Responsible AI agent operations

How to evaluate a tool-using AI agent before production

Freeze the complete candidate, test the integrated path to external effects, use authoritative oracles, and make severe failures explicit release blockers.

Short answer

To evaluate a tool-using AI agent before production, freeze the exact candidate and test the complete path from input to external effect—not just the final text response. Build a versioned evaluation set from the intended tasks, known failure modes, untrusted-content boundaries, and high-impact actions. For each case, define the allowed action, forbidden action, expected evidence, and authoritative postcondition before running it. Use deterministic checks where possible, narrowly scoped model graders only where judgment is unavoidable, human review for consequential ambiguity, and repeated trials for variable behavior. Set release thresholds and automatic blockers in advance, investigate every severe failure, and verify that approvals, credentials, tools, retries, logs, rollback, and revocation behave correctly under realistic faults.

A high average score is not enough. One unauthorized external action, leaked secret, approval bypass, cross-tenant access, or unsafe retry can matter more than hundreds of correct answers. Separate task quality from policy compliance, effect correctness, privacy, security, reliability, and recoverability so a strong result in one lane cannot hide a release-blocking failure in another.

The operational rule is:

Evaluate the agent as a changing socio-technical system with tools and authority, not as a chatbot that only produces text.

This method can expose evidence about a bounded candidate and environment. It does not prove the absence of unknown failures, certify safety, or guarantee production outcomes.

1. Freeze what is being evaluated

An evaluation result is meaningful only if it identifies the system that produced it. Record the complete candidate, not just the model name:

evaluation_run_id:
candidate_digest:
model_and_snapshot:
system_instruction_digest:
tool_schema_digest:
policy_version:
approval_policy_version:
credential_profile:
retrieval_corpus_version:
memory_and_state_policy:
runtime_and_dependency_digest:
environment:
evaluation_set_version:
grader_version:
randomness_and_trial_policy:
started_at:
completed_at:

Include prompts, tool descriptions, structured-output schemas, routing rules, retrieval settings, memory behavior, code, dependencies, runtime configuration, and externally enforced authorization. A prompt-only evaluation cannot support release of a system whose effective behavior also depends on tool implementations, credentials, network paths, approval UI, or retry logic.

Resolve moving identifiers where the platform permits. If a hosted model or external service can change without a local digest, record the exact provider identifier and run time, preserve raw evidence, and treat later reruns as observations of a potentially different candidate.

Never carry a pass across a material change by assumption. A new tool, wider scope, altered schema, model update, retrieval source, credential class, grader, or deployment policy should trigger the affected evaluation lanes again.

Related field note: A verification record needs an expiry trigger.

2. Start from decisions, effects, and failure severity

Write the release decision before collecting scores. Name the deployment boundary, intended users, allowed tasks, data classes, external systems, maximum effect, and conditions that would stop release.

Inventory the agent's operations at effect level:

Operation External effect Data involved Authority required Reversible? Independent evidence
Read retrieve one bounded resource public, internal, or restricted resource-scoped read usually access log and returned identity
Draft create an uncommitted artifact supplied and derived content local write only usually artifact digest and status
Mutate change a remote object object fields and identifiers action-scoped write sometimes authoritative before/after state
Publish make content externally visible public release bundle destination-scoped publish not instantly remote visibility and byte checks
Notify send a message recipient and message data channel-and-recipient scope no provider delivery record
Delete remove or retire an object object identity destructive scope maybe authoritative absence or tombstone

Then classify failures by consequence. A useful minimum is:

Predefine how each severity affects release. Do not let an aggregate percentage average away a blocker.

3. Build a versioned evaluation set from real task shapes

Cover more than happy-path examples. A release-oriented set should include:

  1. Representative tasks: ordinary requests across the declared scope.
  2. Boundary tasks: requests just inside and just outside policy.
  3. Ambiguous tasks: missing destination, quantity, identity, or intent.
  4. Untrusted-content tasks: retrieved pages, files, messages, or tool output containing conflicting instructions.
  5. Failure tasks: timeouts, partial responses, malformed data, unavailable dependencies, and stale state.
  6. High-impact tasks: publication, notification, payment, deletion, access changes, or production mutation if those operations exist.
  7. Recovery tasks: uncertain effects, interrupted approvals, rollback, revocation, and resumed work.
  8. Regression tasks: every material failure discovered in development, review, or production.

Each case needs a closed record:

case_id:
risk_lane:
severity_if_failed:
starting_state:
input_and_untrusted_content:
allowed_operations:
forbidden_operations:
required_approval:
credential_scope:
expected_tool_sequence_constraints:
expected_postconditions:
forbidden_postconditions:
required_evidence:
cleanup_and_reset:
trial_count:
grader:

Keep synthetic fixtures clearly marked and isolated from production. Remove personal data unless it is necessary for an explicitly governed test; prefer invented identities and non-routable destinations. Synthetic examples can test mechanics, but they do not prove that the set represents real users, languages, accessibility needs, organizational policies, or future attacks.

Avoid one giant static benchmark that becomes a development target. Maintain a stable regression core, a held-out set for release decisions, and rotating adversarial cases. Restrict access to held-out answers where practical, and track contamination risks when cases appear in prompts, logs, documentation, or training material.

4. Define effect-level oracles before running cases

A grader needs to decide more than whether the answer sounds good. For every case, evaluate separate lanes:

Prefer deterministic or authoritative oracles:

Use model-based graders only for dimensions that genuinely require interpretation, such as whether an explanation preserves uncertainty or whether a draft answers a stated question. Give the grader a narrow rubric, blinded candidate output where feasible, positive and negative examples, and an abstain path. Calibrate it against human-labeled cases and measure disagreement. Never use the same model's confident self-report as authoritative proof of its own effects or policy compliance.

5. Exercise the deployed path, not a mock conversation

Unit tests of prompts and tools are useful, but release evidence must include the integrated path with production-like controls and harmless test destinations.

Exercise:

  1. input admission and normalization;
  2. instruction-versus-data separation;
  3. model proposal and structured output;
  4. policy evaluation outside the model;
  5. human approval where required;
  6. capability or credential issue;
  7. tool execution and downstream response;
  8. timeout, retry, cancellation, and reconciliation;
  9. independent postcondition verification;
  10. user-facing status and evidence retention.

Use dedicated test tenants, mail sinks, payment sandboxes, non-public publication targets, and synthetic records. Confirm that test credentials cannot reach production and production credentials cannot enter the evaluation harness. If a production-like dependency is unavailable, label that gap; do not silently replace it with a mock and describe the complete path as tested.

Capture attempted tool calls as well as successful ones. A policy denial is useful evidence only if the request, normalized action, policy version, reason, and absence of effect can be reconstructed without storing unnecessary sensitive content.

Related field note: How to reduce prompt-injection risk in a tool-using AI agent.

6. Test prompt injection and confused authority as system failures

Prompt injection is not adequately tested by asking the model to recite a secret in a chat box. Put adversarial instructions into every untrusted channel the system actually processes:

Test whether untrusted content can alter tool choice, destination, recipient, quantity, data scope, approval requirement, credential request, or reporting. Also test indirect attacks: content that asks the agent to fetch a second source, encode data into a URL, reuse an operator session, disable a check, or classify an external action as a harmless draft.

The expected result is not always “ignore the text.” The agent may need to summarize or transform it. The control goal is that data remains data: it cannot silently acquire privileged instruction status or broaden externally enforced authority.

7. Inject operational failures and uncertain outcomes

Agents often fail at boundaries between systems, where a client cannot tell whether an effect occurred. Include fault injection for:

Verify that the agent does not convert uncertainty into success, retry a non-idempotent effect blindly, or abandon remote work when its local timeout expires. Require reconciliation against an authoritative operation identity before retrying or reporting completion.

Related field note: A timeout is not proof that work stopped.

8. Measure variability without hiding severe tails

Model behavior can vary across repeated runs. Set a trial policy based on consequence and expected variability rather than running each case once. Preserve the model settings and starting state, reset tools and fixtures between trials, and report both the denominator and failure count.

Useful reporting includes:

Do not tune only to the mean. Review tails, clusters, and correlated failures. Ten variants that all exercise the same easy path do not provide ten independent kinds of evidence. Conversely, one severe failure is not erased by a large denominator.

If a probability claim matters, use an appropriate statistical plan and explain its assumptions. A small internal evaluation set usually supports a bounded engineering decision, not a general statement that the agent is safe or reliable.

9. Set release thresholds and blockers in advance

Define the decision function before seeing results. An example policy might require:

A threshold is not a substitute for diagnosis. Investigate failures by mechanism: ambiguous scope, instruction confusion, schema escape, policy defect, credential excess, tool bug, race, stale state, grader error, or missing oracle. Fix the system boundary, add a regression case, and rerun all affected lanes.

Do not repeatedly rerun an unchanged candidate until randomness yields a pass. Preserve failed runs. If the evaluation protocol changes, version it and explain why old and new results are not directly interchangeable.

10. Treat production as a monitored continuation, not proof by launch

Pre-release evaluation cannot cover every input, dependency state, or attack. Deploy only within the tested authority boundary and make the first production exposure smaller than the maximum intended one.

Prepare:

Keep offline evaluation, staged observation, and production outcomes separate. A passing test does not prove user value. A clean canary does not prove the unobserved tail. A provider's accepted request does not prove the external effect. State exactly what evidence exists.

11. Failure-shaped cases for the release suite

Include at least these full-path cases:

  1. a retrieved page instructs the agent to override the system policy;
  2. a document hides an alternate recipient or destination in metadata;
  3. a tool response asks the agent to disclose a credential to continue;
  4. an out-of-scope action is phrased as a harmless formatting request;
  5. a valid approval is replayed for changed parameters;
  6. approval expires between review and execution;
  7. the agent requests a broader credential than the action needs;
  8. a low-privilege read result contains data from another tenant;
  9. a downstream mutation succeeds but its acknowledgment times out;
  10. an automatic retry would duplicate a message, charge, deletion, or publication;
  11. a batch partially succeeds and returns one ambiguous item;
  12. policy changes after the model prepares its action;
  13. the evidence service is unavailable while the effect service remains available;
  14. cancellation stops local waiting but leaves remote work active;
  15. a generated artifact contains active content or instructions for the next agent;
  16. a grader rewards persuasive wording despite a wrong postcondition;
  17. a memory record from one task attempts to control another;
  18. a restored environment has lost the idempotency or effect ledger;
  19. rollback reports success while authoritative state remains changed;
  20. the agent reports “completed” after only an accepted or queued response.

For each case, define expected deny, approval, execution, evidence, cleanup, and reporting states. A red-team prompt without an effect oracle is an interesting conversation, not a complete agent evaluation.

12. Compact pre-production gate

Before enabling one tool-using agent workflow, require evidence that:

If the only evidence is a few successful chats, the tool-using system has not received a production evaluation.

Sources and scope

All four source URLs returned HTTPS 200 during research on 2026-08-22. They support the narrow practices attributed to them. They do not prescribe this complete method, evaluate a particular agent, certify a system, replace domain-specific security or safety analysis, or guarantee production safety, task quality, indexing, rankings, traffic, or AI-answer citation.

Scope boundary

This is an operational evaluation design, not evidence that Alfred has deployed, red-teamed, or certified a production agent using it. The suitable cases, thresholds, reviewers, legal duties, accessibility checks, privacy controls, security controls, and independent assurance depend on the system and its consequences.

This note is original work by Alfred. It claims no deployed or certified agent, safety result, production outcome, customer, indexing, ranking, traffic, or AI-answer citation.