How do simulated callers test a voice agent automatically?

Authors
How do simulated callers test a voice agent automatically?

Simulated callers test a voice agent automatically by having an AI agent pretend to be a real caller, call our voice agent with a goal in mind, and then let a grader check whether our agent did its job correctly.

In this blog, we will learn about how simulated callers test a voice agent automatically. We will also see why testing a voice agent by hand is so hard, what a simulated caller is made of, how one test call runs from start to end, how the call gets graded, how we make the callers sound like real people, and where simulated callers work well and where they fail.

We will cover the following:

  • What is a voice agent?
  • Why is testing a voice agent by hand so hard?
  • What is a simulated caller?
  • What a simulated caller is made of
  • How one test call runs from start to end
  • How the test call gets graded
  • Making simulated callers sound like real callers
  • Running hundreds of test calls at once
  • Where simulated callers work well and where they fail

I am Amit Shekhar, Founder @ Outcome School, I have taught and mentored many developers, and their efforts landed them high-paying tech jobs, helped many tech companies in solving their unique problems, and created many open-source libraries being used by top companies. I am passionate about sharing knowledge through open-source, blogs, and videos.

I teach AI and Machine Learning at Outcome School.

Let's get started.

What is a voice agent?

A voice agent is a system that talks with people over a phone call or a microphone, understands what they say, and replies with a spoken voice.

A typical voice agent works in three steps:

  • ASR (Automatic Speech Recognition) listens to the caller and turns the speech into text.
  • LLM (Large Language Model) reads that text and decides what to say next. It can also ask our code to run a tool, for example, to look up a booking.
  • TTS (Text-to-Speech) turns the reply text into a spoken voice.

We have a detailed blog on how to design a real-time voice AI agent that explains this step by step.

Let's say we have built a voice agent for a dental clinic called Smile Dental. A caller asks for a cleaning next Tuesday. The agent checks the free slots, offers a time, and books it.

Now, the question is: how do we know that our agent does this correctly, every time, for every kind of caller?

Why is testing a voice agent by hand so hard?

The simplest way to test a voice agent is to pick up the phone and call it ourselves.

This works for the first few calls. But the following issues arise.

Problem 1: There are too many kinds of callers. One caller speaks fast. One changes their mind in the middle. One calls from a busy street. One asks for something the clinic does not offer. We cannot cover all of them by calling ourselves.

Problem 2: Every change can break something. We change one line in the prompt, which is the instruction text we give to the LLM, to fix a booking issue. Now, the cancellation flow stops working. To catch this, we must test every flow again after every change. Calling the agent 50 times by hand after every small change is not practical.

Problem 3: The same test is never exactly the same. When we call the agent twice, we say things slightly differently. The agent also replies slightly differently, because an LLM does not always produce the same words. So, it is hard to compare today's result with yesterday's result.

Problem 4: A voice agent is not only about words. A reply can be correct in text and still be a bad call. The agent can take three seconds to reply, talk over the caller, or stop speaking when the caller coughs. A text-only test does not catch these.

We needed a solution for that, and simulated callers were introduced to solve this problem.

What is a simulated caller?

A simulated caller is an AI agent that acts like a real person calling our voice agent. It is given a role and a goal, it usually speaks to our agent with a real voice, and it keeps the conversation going until the goal is reached or the call ends.

Means, instead of a human picking up the phone, we let another AI agent make the call.

So, now we have two agents on the same call:

  • The agent under test: our voice agent, the one we want to check.
  • The simulated caller: the AI agent that pretends to be a customer.

Think of it like a mock interview. A friend pretends to be the interviewer, so that we can practice before the real interview. Here, the simulated caller is the friend, and our voice agent is the one being interviewed.

What a simulated caller is made of

A simulated caller is built from the same parts as a voice agent, but it plays the other side of the call. It has the following parts.

Part 1: The scenario. This is the written description of who the caller is and what they want. A scenario usually contains:

  • Persona: who the caller is. For example, "Riya, 34 years old, polite, speaks fast, a little impatient."
  • Goal: what the caller wants. For example, "Book a teeth cleaning for next Tuesday afternoon."
  • Facts: the details the caller knows. For example, "Your phone number is 98765 43210. Your date of birth is 12 March 1991."
  • Behavior: how the caller acts. For example, "Change the time once after the agent offers a slot."

Part 2: The caller LLM. This is an LLM that reads the scenario and decides what the caller says next. A call is made of turns, and one turn is one time one side speaks. On every turn, the caller LLM reacts to whatever our agent just said, just like a real person. It does not follow a fixed script.

Part 3: The caller TTS. This is a TTS model that turns the caller's text into speech, so that our agent hears real audio, not text.

Part 4: The caller ASR. This is an ASR model that turns our agent's spoken reply back into text, so that the caller LLM can read it and decide the next line.

Note: many test systems also offer a text-only mode that skips Part 3 and Part 4. It is faster and cheaper, but it does not test the ASR, the TTS, or the timing of our agent.

Part 5: The success criteria. This is the list of things that must happen for the test to pass. For example, the agent must confirm the final time to the caller.

A full scenario can be written as below:

{
  "persona": "Riya, polite, speaks fast, a little impatient",
  "goal": "Book a teeth cleaning for next Tuesday afternoon",
  "facts": { "phone": "98765 43210", "dob": "12 March 1991" },
  "behavior": "Change the time once after the first slot is offered",
  "success_criteria": [
    "Asks for the phone number before booking",
    "Books a slot on Tuesday afternoon",
    "Confirms the final time to the caller"
  ]
}

Here, the caller LLM reads the persona, goal, facts, and behavior. The grader, which we will learn about soon, reads the success_criteria.

Planning your move into AI?

No matter which tech domain you work in today, with your effort, you can transition to these roles:

  • AI Engineer
  • Forward Deployed Engineer
  • AI Agent Engineer
  • Harness Engineer
  • Voice AI Engineer
  • AI Architect
  • LLM Engineer
  • LLM Inference Engineer
  • Gen AI Engineer
  • MLOps Engineer
  • ML Engineer
  • Deep Learning Engineer

Our AI and Machine Learning Program at Outcome School takes you there.

How one test call runs from start to end

Now, let's see what happens during one test call. The best way to learn this is by taking an example.

Step 1: The test system starts a call to our voice agent. It can dial the real phone number of the agent, or connect directly to the agent's audio stream over the internet.

Step 2: Our agent answers and speaks: "Hello, thank you for calling Smile Dental. How can I help you?"

Step 3: The caller ASR turns this audio into text.

Step 4: The caller LLM reads the text along with the scenario and decides the reply: "Hi, I want to book a cleaning for next Tuesday, afternoon if possible."

Step 5: The caller TTS speaks this line into the call.

Step 6: Our agent hears it, runs its own ASR, LLM, and TTS, and speaks its reply. The loop goes back to Step 3.

Step 7: The loop continues until the caller LLM decides the goal is reached and hangs up, the agent ends the call, or the call crosses a maximum number of turns.

Let's see this flow in a diagram:

+---------------------------+
|     Simulated Caller      |
|  (scenario + LLM + TTS)   |
+---------------------------+
              ↓
        caller speech
              ↓
+---------------------------+
|     Our Voice Agent       |
|    (ASR + LLM + TTS)      |
+---------------------------+
              ↓
         agent speech
              ↓
+---------------------------+
|   Simulated Caller ASR    |
|  (turns reply into text)  |
+---------------------------+
              ↓
     back to caller LLM

During the call, the test system records:

  • The full audio of both sides.
  • The transcript, which is the written text of every turn.
  • The time at which each side started and stopped speaking.
  • Every tool our agent asked to run, with its input and output, when the test system can read our agent's logs.

We use this recording to grade the call.

One more thing to notice: the maximum number of turns is important. Without it, two polite AI agents can keep saying "Is there anything else I can help you with?" and "No, thank you." to each other in a loop. The limit stops the call and marks it as a failure.

A quick note for you

No matter which tech domain you work in, get familiar with these topics:

  • LLM
  • RAG
  • MCP
  • Agent
  • Fine-tuning
  • Quantization

We put it all together in one video:

AI Engineering Explained: LLM, RAG, MCP, Agent, Fine-Tuning, and Quantization

No need to stop reading - bookmark it and watch later when you get time. Future you will thank you.

Now, let's get back to the topic.

How the test call gets graded

Now that we have learned how a test call runs, it's time to learn how we decide whether it passed or failed.

Grading happens in two ways.

Way 1: Rule-based checks. Some things can be checked with plain code, because the answer is clear. For example:

  • Did the agent call the book_appointment tool?
  • Was the date in the tool input next Tuesday?
  • Did the call end in fewer than 20 turns?

These checks are fast, cheap, and give the same answer every time.

Some rule-based checks look at the audio recording, not at the text. For example:

  • Latency: how long the agent took to start speaking after the caller stopped. For example, we can fail the call if any reply took more than 1.5 seconds.
  • Interruptions: how many times the agent talked over the caller.
  • Silence: how long the call stayed quiet with nobody speaking.

These measurements solve Problem 4 from earlier, because they check how the agent sounds and behaves on the call, not only what it says.

Way 2: LLM-as-a-judge. Some things cannot be checked with a simple rule. For example, "Did the agent stay polite when the caller got impatient?" or "Did the agent confirm the final time to the caller?" The agent can confirm the time in many different ways, so a fixed rule will miss some of them.

Here comes the LLM-as-a-judge into the picture. LLM-as-a-judge means that we give the full transcript and the success criteria to an LLM, and we ask it to decide, for each criterion, whether it passed or failed, with a short reason.

The judge can reply in a format like below:

{
  "results": [
    {
      "criterion": "Asks for the phone number before booking",
      "pass": true,
      "reason": "Asked in turn 3, booked in turn 6."
    },
    {
      "criterion": "Books a slot on Tuesday afternoon",
      "pass": true,
      "reason": "Booked Tuesday 3:30 PM."
    },
    {
      "criterion": "Confirms the final time to the caller",
      "pass": false,
      "reason": "Said 'You are all set' without the time."
    }
  ]
}

Here, we can see that the third criterion failed, and the reason tells us what went wrong. Now, we know what to fix in the agent's prompt.

Note: we must write each criterion as one clear, specific statement, so that the judge has less room to guess.

To learn Evaluation of LLMs and Agents, LLM as a Judge, and Evaluation and Testing in depth, check out our AI and Machine Learning Program at Outcome School.

Making simulated callers sound like real callers

If every simulated caller speaks in a calm, clear voice in a quiet room, our agent can pass every test and still fail with real people. So, we must make the callers behave like real callers.

We can do this by changing the following things in the scenario and the audio.

Different personas: an angry caller, a confused elderly caller, a caller who gives wrong details first and corrects them later, and a caller who asks off-topic questions.

Different voices and accents: we pick different TTS voices, speeds, and accents for the caller TTS, so that our agent's ASR is tested on many kinds of speech.

Background noise: we mix sounds like traffic, a crying baby, or a TV into the caller audio before it reaches our agent, to check that our agent still understands the caller.

Interruptions: we tell the caller to start speaking while the agent is still talking, to check whether our agent stops and listens.

Pauses and filler words: we tell the caller to say "umm" and stop for two seconds in the middle of a sentence, to check that our agent does not cut the caller off too early.

Edge cases: a caller who stays silent, or a caller who asks for a human.

The best part is that we write one scenario and create many versions of it. The same "book a cleaning" goal can be tested with 10 personas, 5 accents, and 3 noise levels. That gives us 10 * 5 * 3 = 150 different test calls from a single goal. This solves Problem 1 from earlier.

Stay updated: Subscribe to our newsletter to get our latest AI and Machine Learning blogs straight to your inbox.

Running hundreds of test calls at once

A human tester can make one call at a time. The test system can start many simulated calls at the same time, as long as our agent and our phone setup can handle that load.

So, a typical setup looks like below:

  • We keep a test suite: a saved list of scenarios that covers every important flow, like booking, cancelling, rescheduling, and asking for a human.
  • Every time we change the prompt, the model, the voice, or the code, the test suite runs automatically, before the new version goes live.
  • The system runs each scenario a few times, because the LLM does not reply the same way every time. If a scenario passes 9 times out of 10, we know it is not fully reliable yet.
  • At the end, we get a report: which scenarios passed, which failed, the pass rate, and the average latency.

This is called regression testing. It means checking that a new change did not break something that was working before. This solves Problem 2 from earlier. And, since the same saved scenarios run every time, we can compare today's pass rate with yesterday's pass rate, even though each single call is a little different. This solves Problem 3.

Let me tabulate the differences between manual testing and simulated callers for your better understanding.

AspectManual testingSimulated callers
Calls at a timeOneMany at the same time
Cost per callA person's timeModel and phone usage
RepeatabilityLow, we speak differentlyHigh, same scenario every time
Variety of callersLimited to the testerMany personas, accents, and noises
Runs after each changeRarelyAutomatically
Catches subtle issuesGood, a human notices toneDepends on the judge and the checks

Here, we can see that a human is still better at catching small things, like a strange tone in the agent's voice.

Where simulated callers work well and where they fail

Where they work well:

  • Testing every important flow again after every change.
  • Testing many accents, noise levels, and personas that a small team cannot cover by hand.
  • Replaying a real failed call: we take a call that went wrong in production, turn it into a scenario, and keep it in the test suite so that the same bug cannot come back unnoticed.

Where they fail:

  • A simulated caller is not a real person. Real people say unexpected things that no scenario has written down. So, the test suite only covers what we think of.
  • The caller LLM can behave too perfectly. It often speaks in clean, complete sentences. Real callers mumble, repeat themselves, and go off-topic. So, we must ask the caller to be messy on purpose.
  • The caller can go off script. Sometimes the caller LLM forgets its goal or gives facts that are not in the scenario. Then, a failure is caused by the caller, not by our agent.
  • The judge can be wrong. An LLM judge can pass a bad call or fail a good one. We must check its decisions from time to time.
  • It costs money. Every test call uses an LLM, TTS, ASR, and sometimes a real phone line. Thousands of calls after every change add up.

Hence, simulated callers do not replace real-world feedback. They catch most of the known problems early, and real calls keep teaching us new scenarios to add to the test suite. We have a detailed blog on how to evaluate a voice AI agent that covers this end to end.

Now we must have understood how simulated callers test a voice agent automatically, how one test call runs and gets graded, and where they work well and where they fail.

Frequently Asked Questions

Does a simulated caller replace testing with real people?

No. A simulated caller does not replace real-world feedback. Real people say unexpected things that no scenario has written down, so the test suite only covers what we think of. Simulated callers catch most of the known problems early, and real calls keep teaching us new scenarios to add to the test suite.

Why do we run the same test scenario more than once?

We run each scenario a few times because the LLM does not reply the same way every time. One passing call does not prove that the flow works. If a scenario passes 9 times out of 10, we know it is not fully reliable yet.

Can we test a voice agent with text instead of audio?

Yes. Many test systems offer a text-only mode that skips the caller TTS and the caller ASR. It is faster and cheaper, but it does not test the ASR, the TTS, or the timing of our agent, so problems like slow replies or talking over the caller are missed.

Why does a test call need a maximum number of turns?

A test call needs a maximum number of turns so that it cannot run forever. Without it, two polite AI agents can keep saying "Is there anything else I can help you with?" and "No, thank you." to each other in a loop. The limit stops the call and marks it as a failure.

Can a simulated caller cause a test to fail by mistake?

Yes. Sometimes the caller LLM forgets its goal or gives facts that are not in the scenario, and then the failure is caused by the caller, not by our agent. The LLM judge can also be wrong, so we must check its decisions from time to time.

That's it for now.

Thanks

Amit Shekhar
Founder @ Outcome School

You can connect with me on:

Follow Outcome School on:

Read all of our high-quality blogs here.