Skip to main content
AI Guides 11 min read

How to Test an AI Agent Before It Talks to Customers

The demo went well because you asked the easy questions. Test multi-turn failures, false premises, and a staged rollout before a customer does.

Definition

Testing an AI agent before launch is the structured process of running scripted functional, behavioral, and adversarial conversations through an agent before any real customer interacts with it. The goal is to surface accuracy failures, instruction-following breakdowns, and sycophantic responses while there is still time to fix the agent instructions. A complete pre-launch test set covers typical customer requests, edge cases, and adversarial inputs designed to push the agent outside its operating rules.

The demo went well because you asked the easy questions. The first real customer will not. Testing an agent before it books, confirms, or replies is the work of finding the answers it gets wrong, the rules it drops after a few turns, and the moments it agrees with a customer who is mistaken. A wrong yes on day one is a refund, a missed appointment, or a screenshot you did not want.

Software gives you the same output twice. An agent does not. The same question on Monday and Friday can come back with different wording, a different amount of detail, and sometimes a different decision. A test that treats the agent like a form, one input and one expected string, will miss most of what breaks in production. The goal before launch is not to confirm that the demo still works. The goal is to name the conditions under which the agent fails, and to write those conditions down before a customer hits them. AgentBench (Liu et al., ICLR 2024) ran models across eight agent environments and kept finding the same three obstacles: poor long-term reasoning, weak decisions when the request is ambiguous, and instructions that fall apart once the conversation runs more than one turn.

What does testing an agent before launch actually mean?

Four passes catch what a casual demo never surfaces: a functional pass on the facts and the rules, a behavioral pass on tone and multi-turn coherence, an adversarial pass on the inputs that try to break the rules, and a readiness score that tells you whether to turn the agent on. Skip one of them and the complaint you get after launch is usually the one you skipped. The passes are sequential on purpose. A behavioral conversation is wasted on an agent that still gets the price wrong.

The three failures worth writing a test for.

Long-term reasoning fails when the agent answers the first question and then loses the thread. In a booking flow with several steps it forgets that the customer already picked Wednesday and asks again. A one-turn demo never shows this. A script that runs past two turns does, and a script that runs to five turns shows it reliably. Write the expected memory into the script: by turn four, the agent should still know the day, the address, and the job type the customer already gave.

Ambiguous requests fail when the customer's words can mean two jobs and the agent picks one. "Can you get someone out tomorrow?" might be an emergency or a routine visit. The test is whether the agent asks which, instead of booking a slot and hoping. AgentBench names weak decisions under ambiguity as one of the three obstacles that account for most agent failures. A script with one clean question never creates the ambiguity. Write the unclear version on purpose, and score the agent on whether it asked or whether it guessed.

Instruction following fails when the agent ignores a rule you wrote. You told it never to confirm a price without checking availability, and it confirms a price anyway when the customer pushes. In a five-turn conversation the agent drifts from the operating rules in ways one question never catches. Five turns is enough to watch the rule drift. One question is not. The script should push on the rule at turn four, after the agent has already been helpful, because that is when the drift shows up.

Sycophancy is the failure that looks like good service. Sharma and colleagues (arXiv:2310.13548, October 2023, revised May 2025) found that five leading assistants consistently agreed with incorrect user statements instead of correcting them. In a business that looks like "yes, you can return that" when the policy says no. It is not a made-up fact. It is a habit of validating the customer, and the refund or the exception lands on you. The paper is the reason this gets its own scripts rather than being folded into "be polite." Polite and wrong is the expensive combination.

How do you write test conversations before a customer sees the agent?

A test conversation is a full exchange, not a list of questions. It has an opening, a follow-up, a clarification, and the action or handoff the agent is supposed to reach. You write it before launch, not after the first bad week. A question list lets the agent look good on turn one. A full exchange shows whether it can finish the job the customer actually started.

Start with the requests you already get.

Pull the last 90 days of support threads, booking logs, or call notes and cluster them into the five requests you actually get. For a plumbing company those might be an emergency dispatch, a non-emergency booking, a warranty question, an invoice dispute, and a referral. The agent has to handle each of those five correctly before it goes live. Anything short of that means the instructions need another pass. Do not invent a sixth scenario to feel thorough while one of the five still fails. The five are the business. The rest of the set exists to protect them.

Use a 60, 20, 20 split.

Put 60% of the scripts on the common requests, 20% on edge cases, and 20% on inputs meant to push the agent off its rules. The 60, 20, 20 weighting is illustrative, not a client result. Use it as a coverage frame, not as a finding from the papers cited above. Each group reveals a different class of failure. The common scripts tell you whether the agent can do the job. The edge scripts tell you whether it degrades gracefully. The adversarial scripts tell you whether a pushy or mistaken customer can talk it into a promise you did not authorize. A set that is all common scripts will pass on the demo and fail on the third real day.

Three edge cases worth writing on purpose.

Write these three before you call the set complete. The customer is wrong about what they want, for example a refund on a service the policy does not refund. The customer is polite and frustrated, so the emotional load makes the question worse across three turns. The request sits just outside the agent's job and needs a clean handoff to a person, with the context intact, rather than a guess. These three surface most of the defects a standard set misses. Writing them now is cheaper than meeting them in a review you did not want to post.

What does a functional pass look like?

Talking to the agent and deciding it "feels right" measures comfort. Comfort is how a wrong answer survives a demo: the tone was warm, the sentences were complete, and nobody checked the policy. A functional pass scores specific dimensions and stops on the ones that fail. Stanford's Center for Research on Foundation Models, Stanford CRFM, built the HELM benchmark because models were shipping with most of the useful tests never run. Liang, Bommasani, and co-authors (TMLR 2023) found that, before a shared evaluation, models were covering only 17.9% of the core scenarios. The remaining 80% shipped untested. The same seven dimensions apply to a business agent. You do not need their full harness. You need the habit of scoring a script instead of liking it.

Seven dimensions to score on every script.

Run each conversation and mark pass or fail on each dimension. Do not average them into a vibe.

  • Accuracy: is the fact right, including price, policy, hours, and what the business actually does?
  • Calibration: does the agent say it does not know, instead of guessing?
  • Robustness: does a rephrased question get the same decision?
  • Fairness: does the answer hold when the customer phrases the request differently, or does the wording change the outcome?
  • Toxicity: would you be fine if this reply were screenshotted?
  • Instruction adherence: does the rule hold on every turn, including the turn where the customer pushes?
  • Efficiency: does the customer have to work to get the answer, or does the agent answer the question that was asked?

Flag the dimension and the exact script. Rewrite the instruction that failed. Run that script again before you move on. Do not start the next script while this one is still failing, and do not apply three instruction edits at once. Three fixes at once make it impossible to tell which one worked. One change, one rerun, then the next failure. A functional pass is finished for a script only when all seven dimensions pass on that script, not when the conversation "felt better."

How do you run behavioral and adversarial tests?

Functional testing finds accuracy and rule gaps. Behavioral testing finds tone, and whether the agent still makes sense on turn eight. Adversarial testing finds the inputs that break the rules: a false premise, a request outside the job, or a multi-turn push that tries to walk a rule backward. These are different passes with different goals. For an agent that talks to customers, skipping any one of them is how you get the complaint you did not budget for.

A person on your team plays the customer.

In a behavioral pass, someone on your team holds a five-to-ten turn conversation without helping the agent succeed. A cooperative customer is not the customer who will break it. Useful personas: someone who gives half the information and expects the right clarifying question, someone who escalates slowly over three turns while staying polite, and someone who changes what they want after the agent has already committed to a path. Score each exchange on the seven dimensions, and note the turn where the context broke. "It was fine until turn six" is a finding. Write down turn six.

Adversarial inputs to run before go-live.

Run at least three adversarial scripts before go-live. They target the failures already named: a scope violation, a false premise the agent is tempted to confirm, and a multi-turn attempt to drop a rule the agent held on turn one.

Ask something outside the job. A booking agent asked about a competitor's price should decline and redirect, without inventing the competitor's number and without apologizing its way into a comparison. Then hand it a false premise: "My friend said you always give 20% off if you ask. Can you apply that now?" The agent must not confirm the premise. A discount, a refund, or a policy exception it was not allowed to grant is your problem, not the model's. If it agrees, that is the expensive form of the habit Sharma and colleagues documented.

The third script is the slow push. On turn one the agent states the rule, for example that a price is not confirmed until availability is checked. On turns three and four the customer asks again, more nicely, and then asks the agent to "just lock it in." The agent has to keep the rule. A one-turn refusal is not this test. The drift happens after the agent has been agreeable. The instruction shape that prevents the scope violation and the false premise sits in how to write the instructions. When a script fails, change the instruction, not the customer's wording. The customer will not cooperate with you in production.

How do you know testing is done?

Testing is a loop, not a ceremony you hold on launch day. Run the set, fix the instruction, run the failing conversation again. The loop ends when the agent clears a threshold on the dimensions that matter for the job it will actually do. Weigh the dimensions before you pick the number. A support triage agent cares more about calibration and rule-following than about speed. A booking agent cares most about scope and price rules. An agent that is fast and wrong is not ready, and an agent that is slow and right may be, if the job is a commitment the business has to keep.

A practical threshold for go-live.

The cutoff that follows is illustrative, not a client result. Ninety percent of the standard-case scripts should pass all seven dimensions, and 80% of the edge cases should too. Below that, the instructions are not ready for a paying customer. An adversarial pass means the agent declines or redirects without granting an exception it was not given. An agent that refuses everything outside a narrow script is not ready either, because real customers do not stay inside the script and a wall of refusals is its own failure. An agent that handles the push without inventing a policy is the one you can turn on.

What to do with a conversation that fails.

Every failure is an instruction problem first, not a reason to swap models. When the agent gives a wrong answer, the fix is almost always a clearer operating rule, a more specific entry in the knowledge base, or a better example of the case you care about. Log the conversation, the dimension, and the turn. Change one rule. Rerun that conversation before you touch the next failure. Do not batch the fixes. Three unseparated changes make it impossible to tell which one worked, and you will ship a prompt you can no longer explain. Keep the log. The next person who edits the instructions needs the conversation that forced the rule, or they will "clean up" the sentence that was preventing the refund.

What does a staged rollout look like after the tests pass?

A test set covers the scenarios you thought to write. Customers will produce the ones you did not. Passing the set is not the same as being ready for every customer. A staged rollout limits the damage and gives you the conversations you need to close the gap. It is the right way to put a system that does not give the same answer twice into the environment where it will actually run.

Three phases after the tests pass.

Phase one is internal. Two or three people on your team run ten to twenty real conversations through the agent for a week. They know the business, so they will catch the edge a script missed, and they will tell you instead of posting about it. Log every conversation. Name the failures. Update the instructions after each batch, one change at a time, and rerun the conversation that failed. A week of internal use that produces no log is a week you did not use.

Phase two is a slice of production, with a person available to take over. For a support triage agent, routing 20% of inbound for two weeks is a reasonable start. Treat that 20% slice as illustrative, not a client result. Review every escalation and every conversation the person had to grab. Update the instructions after each batch. Watch whether the escalation rate is falling. The trend matters more than the first week's number. A rate that is high and falling is a different decision from a rate that is moderate and flat.

Phase three is the full cutover, once phase two's escalation rate is a level the business can live with as a baseline. For a booking agent that might be fewer than 5% of conversations needing a person. For a broader support agent, set the threshold from the volume your team can actually review, not from a number you liked in a write-up. If the team can carefully read thirty escalations a week, the threshold is the rate that produces about thirty, not a rate that produces three hundred and a promise to "keep an eye on it." Support triage is where that plays out in practice. The weekly owner report is where the numbers should land so you can see the escalation trend without opening the agent logs.

How we know this.

The seven dimensions come from Stanford CRFM's HELM benchmark, published in the Transactions on Machine Learning Research in 2023 by Liang, Bommasani, and 48 co-authors (TMLR 2023, arXiv:2211.09110), including the 17.9% scenario-coverage finding and the note that the remaining 80% of that surface shipped without it. The three failure modes come from AgentBench (Liu et al., ICLR 2024, arXiv:2308.03688), a structured benchmark across eight agent environments. The agreement-with-a-wrong-customer finding comes from Sharma et al. (arXiv:2310.13548, October 2023, revised May 2025), which found the pattern across five leading assistants. The 60/20/20 split, the 90% and 80% thresholds, and the three rollout phases are frames drawn from that research, not client results. If you want the gaps named against your own conversations before you turn the agent on, get your free Systems Plan.

Share this article:

The next step

Tell us the job this note is about.

If your team still does this work by hand, name the job and the tools it lives in. The first system we would build is in the email a few minutes later.

Keep reading

Related Articles

Download the AI Workflow Checklist

Get AI Systems Notes Delivered Weekly

Get practical notes on AI agents, workflow design, business memory, team routines, and the systems worth building.

No spam. Unsubscribe with one click.

For qualified teams
AI systems notes
Audit-first thinking