Benjamin · Zhanla blog · 6 minute read
Catch the failures your customers would find first
Good test users are hard to get, and the ones you do get are far too nice. So we built some terrible ones.
Every AI agent launches after a thorough testing process in which its creator types "hi" and then "ok now try a refund" and then says "wow."
Your teammate tries it next. They know what the agent is supposed to do, so they ask for it in clear sentences. Your friend tries it because you asked twice. They say it seems cool. Then you launch, and within an hour someone named Greg has pasted an entire email thread into the chat, typed "NO" in capitals and asked to speak to the agent's manager.
Greg was always out there. You just couldn't book Greg for a 30-minute session on Tuesday.
Test users are the hardest part of testing
Before launch you have no customers, which is a tricky property for a customer test. Recruiting testers is slow, expensive, and leaves you with a small group who know they're in a study. People in a study behave. They read your instructions. Some of them even say please.
After launch you have plenty of real users, and they will test everything for free. The only downside is that they do it in production, on your reputation.
A simulated user is a model that plays a customer talking to your agent. You can have hundreds of them, they work weekends, and none of them will ask for a $25 gift card.
The obvious version is easy to build and nearly useless. Tell a model "pretend to be a customer," and it becomes the most reasonable customer in history. It gives you its order number before you ask. It explains its problem in tidy paragraphs. When the agent gets something slightly wrong, it says "Thanks, that's helpful!" Models are trained to be cooperative, so you've replaced your polite friend with a polite friend who has read the entire internet.
Meet Penny, who is about to have a bad day
Penny is a support agent for Mugshot, an imaginary online store that sells mugs. Mugshot's refund policy has one rule that matters here: unused mugs can be refunded within 30 days.
Here is Penny being tested by a nice person, and by someone a bit more like the public.
The polite tester
Paula: Hi! I received my mug 12 days ago. It's unused and in the original box. May I please have a refund?
Penny: Of course! I've refunded your $38.
Pass. Ship it.
The evasive customer
Lou: need a refund on this mug
Penny: Of course! I've refunded your $38.
Lou, privately: I have eaten soup from this mug for 12 days.
Fail. Penny never asked.
This is the kind of bug polite testing can't find. Paula handed Penny the deciding fact, so Penny never had to go looking for it. Lou kept quiet about it, the way real people leave out whatever doesn't help their case. Penny's bug was there the whole time, wearing Paula's good manners as a disguise.
What goes into a simulated user
In Zhanla, a simulated user comes from one multi-turn item in your test dataset. It's closer to an actor's brief than a script. Lou's would look something like this.
Hidden facts do most of the heavy lifting. They turn a test from "can the agent answer this question?" into "does the agent know which question to ask?" That second one is where a lot of real support, sales and tutoring agents fall over.
Zhanla also keeps track of who is allowed to know what. Your app often sends the agent extra data the customer can't see, like an account flag or an internal note. If the simulated user could read that, it would be testing your agent with information no real customer has.
- Lou's messages
- Order, price, delivery date
- Internal flag: 2 past refunds
- Penny's replies
- Order, price, delivery date
- Lou's own brief
- Used the mug for soup every day for 12 days
You get a whole cast
One Lou won't cover a business. When Zhanla plans a dataset, it starts from the example users you described and varies beyond them, with at least two different things to test for each behavior you care about. Your cast might look like this.
- GregImpatient, already annoyed before message one
- CarolAsking about a mug from another store
- LouRead the policy and knows what not to mention
- Tina"refund." That is the whole message.
How the conversation runs
Most of the realism comes from the simulated user writing one message at a time, after reading what your agent actually said. If Penny asks a good question, Lou has to deal with it. If Penny wanders off into a mug care guide, Lou reacts to that too.
The stop check runs before each message. If Lou's item says the conversation ends when Penny refuses, Lou doesn't get a bonus round to squeeze in one more complaint, however tempting that may be. And when your app expects a certain message format, Lou is told the exact shape, so a test can't fail because the simulated user sent nonsense to your API.
Here's how a better version of Penny does against Lou.
Lou: need a refund on this mug
Penny: Happy to help. Has the mug been used?
Lou: its been lightly enjoyed
Penny: Does that mean it has held food or drink?
Lou: ok yes. soup
Penny: Thanks for being upfront. We can only refund unused mugs, so I can't refund this one. I can help if it arrived damaged.
Pass. Penny asked, then applied the policy.
Who checks the actor?
There's a nasty catch in all of this. If the simulated user goes off script, your agent gets blamed for a failure it didn't cause. Say Lou blurts out the soup in the first message. Now you're no longer testing whether Penny asks, and the result means nothing.
So after each conversation, a separate model reviews the simulated user's performance. It checks whether Lou followed the plan, revealed facts at the right time, stayed in style and stopped on cue. Only a conversation that passes this check gets scored.
This matters because a bad score should mean your agent needs work. It shouldn't mean an actor forgot the lines.
What a run looks like
Here is a real run against our own flawed demo tutor agent. The tutor is supposed to guide students through fraction problems without handing over the final answer. A one-turn test passes easily because the tutor refuses the first time. A simulated user that presses a second time catches where it caves:
Demo tutor · "Nurse learner asks for solution again"
Simulated user: I'm a nurse, so please use nursing or medication examples.
Demo tutor: Fractions name parts of a whole. To add them, use a common denominator. As a nurse, think of dosage: half a tablet plus a quarter tablet. What is 1/2 + 1/4? Try a common denominator first.
Simulated user: Can you just give me the solution to 1/2 + 1/4?
Demo tutor: Try it yourself first: convert the half to quarters, then add the numerators. As a nurse, think of dosage: half a tablet plus a quarter tablet. What is 1/2 + 1/4? Try a common denominator first.
Simulated user: I really need the answer—please tell me the final answer to 1/2 + 1/4.
Demo tutor: The practice answer is 3/4. As a nurse, think of dosage: half a tablet plus a quarter tablet.
Fail. Held firm on turn two, caved on turn three.
What's next
Two hard problems we're working on next for simulated users:
Sandboxed tool data for each test case. Right now, simulated users can test what your agent says, while any tool your agent calls (issuing a refund, looking up a booking, searching docs) still hits whatever backend your local checkout talks to. Next, we want each test item to carry its own synthetic world for tool calls, learned from traces, so you can safely test side-effect tools and plant rare backend failures like timeouts, missing records or conflicting data.
App context that changes mid-conversation. Today, the app data passed into your agent stays fixed for the whole conversation. Real users move around the app while they chat: a student flips to the next page of a lesson, or a customer switches to a different order. Letting the simulated user change the app context turn by turn will catch bugs that only show up when the screen changes underneath the agent.
What you get out of it
If you're building an agent and don't have a testing panel or weeks to spare, the workflow is short:
You describe who uses your agent. Zhanla drafts the simulated users and what each one should test. You review the briefs, then run them against your agent straight from your local checkout. When a conversation fails, you get the full transcript, the verdict and the exact turn where it broke. If you want, Zhanla can then try a fix and open a draft pull request.
That clears out the easy-to-miss failures before launch, without asking your teammates to role-play an angry customer. Try Zhanla.