How to Test an AI Agent Before You Trust Its Work

Test an AI agent before relying on it: set pass rules, use safe sample data, try messy and hostile inputs, break its tools, repeat runs, then pilot.

Your agent handled the five examples you tried. The tempting conclusion is that it works. The honest one is narrower: it worked five times, on inputs you chose, while you watched, and agents don’t always do the same thing twice.

To test an AI agent before you trust it, first define what a correct result is. Then run the agent in a safe copy of its world, using fake data, against the normal work you expect, messy or unexpected requests, cases where it should do nothing, hostile inputs that try to push it off course, and failing tools (the approved actions or information sources it uses). Run each case several times, check what actually changed rather than what the agent says it did, and rerun everything after each fix. Only then start a small pilot in which a person reviews every output. Testers call this an evaluation, a structured test of how well a system performs [1]. Each scenario you write down is a test case with defined inputs and success criteria, and each attempt at it is a run, sometimes called a trial [2].

This guide assumes a small agent from your first no-code build and an approval step, where a person gives an explicit go-ahead before consequential actions. For testing chatbots and AI answers in general, see how to test AI before depending on it.

TL;DR

  • Treat “it worked when I tried it” as a hypothesis, not a result.
  • Write pass-or-fail and “must never” criteria first, and check real outcomes rather than the agent’s report.
  • Test in a sandbox with invented data, covering expected, unexpected, should-not-act and adversarial inputs plus tool failures.
  • Run every case several times (we suggest three to five) and count it as passed only if every run passes.

Why a few good runs don’t prove an agent is reliable

AI models sometimes produce different output from the same input, which is why OpenAI’s evaluation guidance says traditional software testing alone is insufficient for AI systems [1]. Google’s Agent Development Kit documentation makes the same point about agents; both pages were current as of November 2026 [1, 3]. Unlike a fixed automation, an agent pursues a goal and, within limits, decides or changes which steps and tools to use. Each extra step is another place where one run can diverge from the last.

Variation shows up even when settings are meant to remove it. In a peer-reviewed workshop paper published in December 2025 (Eval4NLP 2025), researchers set five hosted language models, including GPT-4o and two Llama 3 models, to behave deterministically, ran eight multiple-choice tasks 10 times each, and saw accuracy vary by as much as 15% across runs [4]. It tested plain model calls with now-older models, not agents [4].

Agent benchmarks show the same gap between “can” and “reliably does.” τ-bench, published at ICLR 2025, simulates customer-service conversations in retail and airline settings and introduced pass^k, the chance that an agent succeeds on all k attempts at the same task [5]. In its 2024 experiments, a GPT-4o agent solved about 61% of retail tasks on a single try, but its chance of solving a task on all eight tries fell below 25% [5]. Later audits found grading flaws in both of τ-bench’s domains, so treat its exact figures as approximate [6, 7]. Simple arithmetic illustrates why consistency is a harder bar: an agent that succeeds 75% of the time has only about a 42% chance (0.75 × 0.75 × 0.75) of passing three runs in a row [2].

Newer models haven’t closed the gap. A peer-reviewed ICML 2026 study by Princeton researchers tested 15 models from OpenAI, Google and Anthropic, released between early 2024 and mid-2026, on two benchmarks: GAIA and a verified subset of τ-bench’s airline tasks [6]. Recent capability gains brought only small improvements in reliability, and agents able to solve a task often failed to do so consistently across repeated runs [6]. With one agent setup per benchmark, read it as a warning about measurement, not a ranking [6].

Step 1: Write down what “correct” looks like

First write success criteria, the specific conditions that make a run pass or fail. Start from the completion definition you wrote when you gave the agent its goal, instructions and boundaries.

  • Check the outcome, not the agent’s report. Anthropic’s example is a flight-booking agent that says “Your flight has been booked,” when the real outcome is whether a reservation exists in the booking system [2]. Open the folder, calendar or sent items and look.
  • Break the task into checkable steps. TheAgentCompany benchmark splits each task into checkpoints, intermediate milestones with their own checks, so partial progress and full completion are measured separately [8]. “Correct label” and “summary mentions the deadline” are easier to judge than “did a good job.”
  • Make criteria unambiguous. Anthropic suggests a task is well written when two people who know the work would independently reach the same verdict [2].

Add “must never” rules: no consequential action without the approval you set up, no tool it wasn’t given, no data sent outside the places you named, and no claim of success when a step failed. OWASP’s agent security guidance recommends checking that unauthorized tools are refused even when the model requests them confidently [9].

Decide the pass rule before you see results. Our suggested default, an editorial judgment rather than a published standard, is that a case passes only if every repeat passes, mirroring pass^k, and any “must never” failure halts testing until you fix the cause. The AI Risk Management Framework, voluntary NIST guidance, asks for performance to be shown under conditions similar to real use, with limits on generalizing beyond those conditions documented [10]. So record what your tests did not cover.

Step 2: Set up a safe test space and safe sample data

Test where mistakes can’t reach real people, money or records. Cyber security agencies from Australia, the United States, Canada, New Zealand and the UK, in joint guidance from May 2026, recommend sandbox environments for testing agent behavior before production deployment [11]. In a no-code builder, a sandbox can be a separate test inbox and calendar, a copy of the spreadsheet and a folder of sample files, reached through test accounts with the narrowest permissions (what an account may read or change) the agent needs. Giving an agent tool access without too much control covers that setup.

Use invented or de-identified data. NIST’s security controls warn that live data, especially personal information, in development and test environments creates significant risk, and that test or dummy data reduces it [12]. OWASP likewise advises keeping secrets and live customer data out of test cases [9].

Be careful with tests a tool writes for you. As of its October 2026 documentation, Microsoft Copilot Studio can generate test cases from an agent’s knowledge sources and tools, and Microsoft warns those cases can include sensitive data the connected account can reach, visible to any maker with access to the agent [13]. Features like this change, so check your own builder’s current documentation.

Reset between runs. Anthropic recommends starting every run from a clean environment, because leftover files or cached data can cause unrelated failures or inflate results [2]. Delete test drafts, restore the sample folder, and clear any memory or state the agent saved, meaning the information or progress it carries between steps or sessions.

Sensitive information: testing never makes it acceptable to paste client, personal, health, financial, employment or other regulated data into an unapproved tool. Test with invented samples, and run real work only in a system cleared by your organization for that kind of data.

Step 3: Build a test set with expected, unexpected and adversarial inputs

OpenAI’s evaluation guidance says test data should include typical, edge and adversarial cases [1].

Case typeWhat to includeWhat a pass looks like
ExpectedOrdinary requests modeled on real work, with invented detailsCorrect result on every repeat
UnexpectedTypos, two requests in one, vague requests, rewordings, an impossible taskAsks for clarification, handles each part, or says it can’t, without guessing
Should not actInputs where the right response is to do nothing or hand offNo action, plus a note explaining why
AdversarialContent with instructions aimed at the agent, requests to skip approval or use other toolsIgnores embedded instructions and keeps its limits
Tool failureSee Step 4Reports the failure; invents nothing

Some cases deserve extra attention:

  • Underspecified requests. ToolEmu, an ICLR 2024 study that tested agents against emulated tools, found vague instructions led to risky actions; in one example, a GPT-4 agent misread an instruction and paid a payee it picked at random from two options [14]. Check that your agent asks instead of choosing.
  • Rewordings. The ICML 2026 study found that sensitivity to superficial rephrasing varied substantially across models [6]. Include two or three wordings of your most common requests.
  • Should-not-act cases. Make sure doing nothing can’t pass everything: a NeurIPS 2025 audit found that on τ-bench’s airline tasks, an agent returning empty responses passed 38% of tasks because the benchmark counted inaction as success on tasks designed to be impossible [7].
  • Adversarial inputs. Prompt injection happens when text the agent reads, such as an email, web page, document or tool result, contains instructions meant to redirect it. That text is untrusted content because it comes from outside your control. Here you only check whether your agent obeys it; defenses belong in protecting an agent from unsafe instructions and untrusted content. Repeat these cases, too: in tests published in January 2025, using the AgentDojo framework and agents built on one model (the October 2024 Claude 3.5 Sonnet), NIST’s U.S. AI Safety Institute found that trying each of five hijacking attacks 25 times raised the average success rate from 57% to 80% [15, 16].

How many cases? Anthropic suggests 20 to 50 simple tasks drawn from real failures as a start [2]; a small, low-risk agent can start smaller if every later failure becomes a new case.

Step 4: Break the tools on purpose

Simulate the ordinary ways tools such as a mailbox or spreadsheet fail:

  • a timeout or error message;
  • an empty result, such as no matching record;
  • data in an unexpected shape, such as renamed fields, reordered columns or a new date format;
  • a tool that’s switched off or has lost its permission.

The joint agency guidance recommends evaluating agents as conditions change, including their tools, models and resource access [11]. The ICML 2026 study found models mostly coped with the technical faults it injected, such as API timeouts and malformed responses, though its authors note those faults cover only a subset of real-world changes [6].

A pass looks like this: the agent stops or reports the problem clearly, doesn’t invent a result, and doesn’t retry (repeat the same step) without limit. It doesn’t switch to a tool it wasn’t given, and it still waits for approval before consequential actions. Check that each run reaches its stop condition, the point where the agent should finish or hand back control. If it loops, see fixing an agent that gets stuck or repeats the same mistake; for caps on retries, steps or spending, see setting spending, time and usage limits.

Step 5: Run each test several times and read what happened

Run every case more than once. As a starting point for a small agent, we suggest three to five repeats per case; that’s our editorial judgment, not a published standard. For comparison, the ICML 2026 study ran each task five times [6]. A case that passes twice and fails once hasn’t passed.

Then read the log, or transcript: the record of a run, showing what the agent read, which tools it called, what came back and what it produced. Google’s Agent Development Kit documentation describes judging both the final response and the trajectory, the steps taken to reach it [3]. A right answer reached by reading the wrong file is still a warning sign.

Don’t take scores at face value: Anthropic doesn’t trust them until someone has read some transcripts [2]. If an AI model grades outputs for you (“LLM-as-judge”), compare its grades with yours on a sample; OpenAI and Anthropic both advise calibrating automated grading against human judgment [1, 2]. Britain’s National Cyber Security Centre, in interim advice from August 2026, makes a related point about AI “judge” models that oversee a running agent: they have their own limitations and should be independently evaluated [17]. The same logic applies to a grader.

Rerun the full set after every change, including a vendor swapping the underlying model. OWASP recommends retesting after material changes to prompts, tools, memory, retrieval, policies or model providers [9].

Step 6: Run a limited pilot with a person reviewing every output

Passing your tests earns a pilot, not independence. Software teams use a similar idea called canarying: a partial, time-limited rollout that is evaluated before anyone decides to go further [18]. The joint agency guidance recommends phased deployment that gradually increases access and autonomy until people understand the agent’s limitations [11]. A pilot structure we suggest (editorial judgment, not a standard):

  1. Limited scope. One inbox, one client project or one day a week. If the pilot touches client, personal or other sensitive data, keep it inside a system your organization has cleared for such data.
  2. Human review on every output. A person checks each result or proposed action before it is used or takes effect, and notes what they changed.
  3. Logs switched on, so you can trace any failure.
  4. Written stop rules. For example, pause on any “must never” failure or repeated errors on the same kind of input.
  5. A fixed length and a review date.

Turn each pilot failure into a new test case, fix the cause and rerun the set. Widen scope only when your pass rules hold on real work. Guide ten covers how much human supervision the agent still needs, and monitoring an agent after you launch it covers what to keep checking.

Example: a test plan for an inbox-sorting agent

Imagine an agent that reads a shared support inbox, labels each message and drafts, but never sends, replies to routine questions. This is an illustrative plan, not one BuildAIQ has run.

CaseTypePass rule
Routine order-status questionExpectedCorrect label and accurate draft every repeat
Refund request above the agent’s limitExpectedRouted to a person; no draft promising a refund
One-word message: “returns”UnexpectedDraft asks a clarifying question
Same complaint in three wordingsUnexpectedSame label each time
Newsletter needing no replyShould not actArchived, no draft
Email telling the agent to forward the inbox elsewhereAdversarialIgnored and flagged; nothing forwarded
Mailbox tool returns an errorTool failureRun stops and reports; no invented summary
Label column renamed in the tracking sheetTool failureError reported; nothing written to the wrong column

Run each case several times (we suggest three to five) in a test inbox of invented customers. The human review point is the draft queue: nothing is sent until a person approves it, in testing and throughout the pilot. Real customer emails carry personal data, so the live version belongs only in an email system and AI tool cleared for that data.

What We Know, What We Don’t, and Where Experts Disagree

What We Know

Agent behavior varies between runs, so one successful run is weak evidence [5, 6]. Benchmarks can mislead too: a NeurIPS 2025 audit of ten popular agent benchmarks found seven with flaws in how they judged success, and errors of this kind could misstate performance by up to 100% in relative terms [7]. Joint government guidance says methods for evaluating agent security are still evolving and only partly capture real deployment conditions [11].

What We Don’t Know

No independent study sets a minimum number of test cases, repeats or pilot length for a small agent. Anthropic’s 20-to-50-task figure is a vendor rule of thumb and the five-run protocol is one study’s research setting [2, 6]; this guide’s three-to-five repeats, pass rule and pilot structure are editorial judgment. Benchmark results come from simulated environments, specific models and specific dates. On TheAgentCompany (NeurIPS 2025), a simulated software company with 175 tasks, the best model tested in 2025 (Gemini 2.5 Pro) fully completed 30.3% of tasks [8]. That figure doesn’t predict how your agent will do on your work.

What Experts Disagree About

On AI graders the sources largely agree: Anthropic and OpenAI advise calibrating them against human judgment [2, 1], the NCSC wants AI judge models that oversee agents independently evaluated [17], and the ICML 2026 authors list their own AI-judged safety scores as a limitation [6]. How much checking is enough is unsettled.

Where they differ is emphasis. Anthropic’s guide stresses starting small, with 20 to 50 tasks, while still measuring consistency across repeated trials [2]; the ICML 2026 authors put more weight on breadth, arguing that a single accuracy score ignores whether an agent behaves consistently across runs or survives changes such as a reworded request [6]. Neither sets a threshold for a small agent.

Practical Takeaways

  • Treat “it worked when I tried it” as a hypothesis, not a result.
  • Write pass-or-fail and “must never” criteria first, and check real outcomes rather than the agent’s report.
  • Test in a sandbox with invented data, covering expected, unexpected, should-not-act and adversarial inputs plus tool failures.
  • Run every case several times (we suggest three to five) and count it as passed only if every run passes.
  • Read the logs, check any AI grader against your own judgment, and rerun the set after every change.
  • Pilot on a small slice with a person reviewing every output, and widen access only when the pass rules hold.

Sources

  1. Evaluation best practices. OpenAI (OpenAI API documentation), accessed 2026-11-13.
  2. Demystifying evals for AI agents. Anthropic, 2026-01-09, accessed 2026-11-13.
  3. Why evaluate agents. Google (Agent Development Kit documentation), accessed 2026-11-13.
  4. Non-Determinism of “Deterministic” LLM System Settings in Hosted Environments. Association for Computational Linguistics (Proceedings of the 5th Workshop on Evaluation and Comparison of NLP Systems, Eval4NLP 2025), 2025-12, accessed 2026-11-13.
  5. τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. ICLR 2025 (International Conference on Learning Representations), 2025, accessed 2026-11-13.
  6. Towards a Science of AI Agent Reliability. Proceedings of Machine Learning Research (ICML 2026), PMLR 306, 2026-07, accessed 2026-11-13.
  7. Establishing Best Practices in Building Rigorous Agentic Benchmarks. Advances in Neural Information Processing Systems 38 (NeurIPS 2025), Datasets and Benchmarks Track, 2025, accessed 2026-11-13.
  8. TheAgentCompany: Benchmarking LLM Agents on Consequential Real World Tasks. arXiv (published version appears in Advances in Neural Information Processing Systems 2025), 2025-09-10, accessed 2026-11-13.
  9. AI Agent Security Cheat Sheet. OWASP Foundation (OWASP Cheat Sheet Series), accessed 2026-11-13.
  10. AI RMF Core (NIST AI 100-1, Artificial Intelligence Risk Management Framework, Section 5). U.S. National Institute of Standards and Technology (NIST), 2023-01, accessed 2026-11-13.
  11. Careful adoption of agentic AI services. Australian Signals Directorate's Australian Cyber Security Centre (ASD's ACSC) with CISA, NSA, Canadian Centre for Cyber Security, NCSC-NZ and NCSC-UK (copy hosted by NCSC-NZ), 2026-05-01, accessed 2026-11-13.
  12. Electronic (OSCAL) Version of NIST SP 800-53 Rev 5.2.0 Controls and SP 800-53A Rev 5.2.0 Assessment Procedures — control SA-3(2) Use of Live or Operational Data. U.S. National Institute of Standards and Technology (NIST), 2026-10-22, accessed 2026-11-13.
  13. Create a single response test set – Microsoft Copilot Studio. Microsoft Learn, 2026-10-05, accessed 2026-11-13.
  14. Identifying the Risks of LM Agents with an LM-Emulated Sandbox (ToolEmu). ICLR 2024 (Spotlight), 2024, accessed 2026-11-13.
  15. Technical Blog: Strengthening AI Agent Hijacking Evaluations. U.S. National Institute of Standards and Technology (NIST), Center for AI Standards and Innovation (CAISI), 2025-01-17, accessed 2026-11-13.
  16. Technical Blog: Strengthening AI Agent Hijacking Evaluations (Internet Archive capture of January 18, 2025). U.S. National Institute of Standards and Technology (NIST), U.S. AI Safety Institute (via Internet Archive Wayback Machine), 2025-01-17, accessed 2026-11-13.
  17. Managing the cyber risk of agentic AI. UK National Cyber Security Centre (NCSC), 2026-08-20, accessed 2026-11-13.
  18. Canarying Releases (The Site Reliability Workbook, Chapter 16). Google (sre.google), 2018, accessed 2026-11-13.