> ## Documentation Index
> Fetch the complete documentation index at: https://docs.retellai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Text and audio tests

> Create Retell AI text and audio test cases: describe the caller, set success criteria and performance metrics, and mock functions for repeatable runs.

In a text or audio test, an AI caller follows your scenario and talks to your agent, and your success criteria grade the conversation. A **text test** runs the conversation as a chat. An **audio test** runs it as a call: the AI caller speaks with a synthesized voice, and your agent hears it through its own speech recognition, the same way it hears a real caller.

For example, an insurance agent's test case has a caller who wants to file a claim but doesn't know their policy number. The criteria check that the agent looks the caller up by date of birth instead, and calls `create_claim` with the right policy. As a text test it checks the logic. As an audio test, with a fast-talking caller on a busy street, it also checks that the agent hears the date of birth correctly.

## Text or audio?

Start with text. It's faster and cheaper, and it covers responses, tool calls, and flow logic. Add an audio test when the behavior depends on speech: how the agent hears names and numbers, latency, interruptions, or background noise. Audio tests work on voice agents only, and chat agents get text tests only.

## Create a test case

**1. Start a new test case**

On the `Simulation` page, click `Add test`, open `Create manually`, and choose `Create text test case` or `Create audio test case`. To have Conductor draft test cases instead, use `Create with AI` (see [Testing with Conductor](https://docs.retellai.com/test/testing-with-conductor.md)).

**2. Name it**

Give it a name you'll recognize in a list of results, like `reschedule-no-appointment-impatient`. Add **Tags** to group related test cases, so you can [filter the list by tag](https://docs.retellai.com/test/simulation-testing.md#manage-test-cases) later.

**3. Describe the caller and how to grade the run**

Fill in the sections below. Only the name, the caller description, and at least one success criterion are required.

**4. Save or run**

Click `Save only`, or `Run test case` to save it and go straight to [run settings](https://docs.retellai.com/test/run-tests.md#run-tests).

You can also create a test case from the `Simulation Test` tab of the [test panel](https://docs.retellai.com/test/manual-testing.md), which starts with the panel's test variables and mocks. To edit a test case, click `Edit` on its row.

![Animation of creating a test case. The Create tests dialog opens on the Create with AI tab, offering Generate tests, Import a call, and Upload call file. The Create manually tab is selected, listing Create text test case, Create audio test case, and Create transcription test case. Create audio test case opens an empty form with Test case name, Tags, Voice settings (Caller voice and Background noise), Describe the caller with Custom and Transcript tabs, and Simulated user model. The form then scrolls to Caller behavior, Success criteria, Performance metrics, Starting node, and the collapsed Start conversation, Dynamic variable, and Functions & tools sections, above Save only and Run test case.](https://mintcdn.com/retellai/8ZCrhFAw4xq7qprW/images/test/create-test-case.gif?s=b1cfb547ffdd0f59e9e4aacea62b5993)

Add test opens the Create tests dialog. Create manually lists the three test case types.

## Pick a caller voice (audio only)

**Caller voice** sets the voice the AI caller speaks with. Click the play button to preview one. To test with any other voice, choose `Select custom voice` at the bottom of the list to pick one of your cloned or provider voices.

**Background noise** plays behind the caller, so you can test the agent on a noisy line. Choose busy street, subway, car interior, crowded bar, construction, airport, crackling static, wind, or TV in a restaurant, and set the **Noise level** from 0 to 2 (1 is the default).

## Describe the caller

**Describe the caller** has two modes.

**Custom** describes the caller in your own words, and the AI caller improvises from it. Cover who they are, what they want, and any details your agent will ask for:

```markdown theme={"dark"}
## Identity
You are Marcus, a prospective gym member in New York.
## Goal
Find out the monthly membership price and whether there is a joining fee.
## Context
You have not chosen a location yet. Ask about pricing before discussing a tour.
```

**Caller behavior** (optional) adds how the caller acts. Pick a preset or write your own:

| Preset | The caller... |
| - | - |
| Impatient | is in a hurry, gives short answers, and gets annoyed by long explanations. |
| Rambler | says more than needed, goes off topic, and sometimes doesn't answer the question. |
| Confused | misunderstands questions and asks the agent to explain again. |
| Skeptical | questions what the agent says and asks why it needs their information. |
| Angry | is short-tempered and blunt, with little patience for scripted answers. |

**Transcript** gives the caller a script instead. Add messages for the agent and the caller, or switch to the JSON view to paste them, and the AI caller says the caller lines in order, adapting only as much as the conversation needs. If the agent asks something the script doesn't answer, the caller says they don't know. A transcript needs at least one caller message. Use `Load example` to start from a sample.

Caller behavior, the starting node, and the start of the conversation only apply in Custom mode.

**Simulated user model** sets the LLM that plays the caller. It's separate from your agent's [model](https://docs.retellai.com/build/llm-options.md), and both bill per message.

## Define success criteria

Success criteria grade the run. Click `Add` and choose a type. A run passes only if every criterion passes, so write one behavior per criterion.

**Prompt** criteria describe what the agent must do, in plain language. An LLM reads the transcript and judges each one separately, with a reason. Choose that LLM in the model menu next to **Success criteria**.

```markdown theme={"dark"}
1. Looks up the caller by date of birth when they don't know their policy number.
2. Calls create_claim with the policy number it found.
3. Doesn't promise a payout amount.
```

**Equation** criteria compare a variable to a value, with no LLM involved, so they're exact and free. Pick a variable on the left, an operator, and a value. Variables include your agent's [dynamic variables](https://docs.retellai.com/build/dynamic-variables.md), with any values the agent collected during the run, and the run's [performance metrics](#measure-performance-metrics) under `metrics`.

| Operator | Passes when |
| - | - |
| `=` and `≠` | The values match, or don't, ignoring case. |
| `>`, `≥`, `<`, and `≤` | Both sides are numbers and the comparison holds. |
| Contains and Does not contain | The value appears in the variable, or doesn't, ignoring case. |
| Exists and Does not exist | The variable has a value by the end of the run, or doesn't. |

For example, `{{appointment_date}}` **Exists** checks that the agent collected a date, and `{{metrics.latency.p50}}` `<` `1000` checks that median latency on an audio test stayed under a second.

![Success criteria section of a test case form, with GPT-6 Luna selected as the grading model. Two prompt criteria read Correctly hears and repeats back the caller's date of birth, and Collects the new preferred day and time for the follow-up. An equation criterion checks metrics.latency.p50 \< 1000. The Add menu is open, offering Prompt and Equation.](https://mintcdn.com/retellai/8ZCrhFAw4xq7qprW/images/test/success-criteria.png?fit=max\&auto=format\&n=8ZCrhFAw4xq7qprW\&q=85\&s=f3e0a335c64d9f01300d6d2992b4c0a6)

Add prompt criteria for behavior and equation criteria for exact checks.

## Measure performance metrics

Performance metrics measure the run itself. Some are always measured. Others you turn on under **Performance metrics**, and they cost extra. None of them pass or fail a run on their own: use an equation criterion to set a threshold, such as `{{metrics.agent_hallucination.rate}}` `<` `0.05`.

Turn these on when you need them:

| Metric | Measures | Variable |
| - | - | - |
| Hallucinations | Share of agent replies an LLM judge flags as made up | `metrics.agent_hallucination.rate`, `.count` |
| Inaccurate tool calls | Replies that call the wrong tool or use the wrong arguments | `metrics.tool_call_inaccuracy.rate`, `.count` |
| Inaccurate node transitions | Wrong node transitions (Conversation Flow agents only) | `metrics.node_transition_inaccuracy.rate`, `.count` |
| RAG accuracy | Share of knowledge base retrievals that returned every relevant chunk | `metrics.rag_accuracy.rate` |

Always measured, at no extra cost:

| Metric | Tests | Variable |
| - | - | - |
| Custom tool errors | Text and audio | `metrics.custom_tool_error.rate`, `.count` |
| Latency, in ms | Audio | `metrics.latency.p50`, `.p90`, `.p95`, `.p99` |
| Tool latency, in ms | Audio | `metrics.tool_latency.p50`, `.p90`, `.p95`, `.p99` |
| Interruptions | Audio | `metrics.interruption.count` |
| Talk ratio | Audio | `metrics.talk_ratio.agent`, `.user` |
| Transcription word error rate | Audio | `metrics.transcription.wer` |

A metric with nothing to measure is left empty. For example, RAG accuracy is empty if the agent made no retrievals.

## Set the starting point

Both settings are optional and apply in Custom mode only.

* **Starting node** starts the run at a node instead of the start of a [Conversation Flow](https://docs.retellai.com/build/conversation-flow/overview.md). Flows in flex mode always start from the start node.
* **Start conversation** sets the first few messages, then lets the simulation continue from there. Use it to skip a long greeting and verification. The success criteria don't grade these messages.

## Set dynamic variables

**Dynamic variable** fills in the values your agent's `{{placeholders}}` need, the way a real call would. A new test case starts with your agent's default values and every variable the agent references. Fill in what the scenario needs, or click `Add` for another. `Load values` fills them from an [environment tag](https://docs.retellai.com/agent/version.md#environment-tags) or a JSON file, and `Clear values` empties them.

Use variables to steer the scenario. To test a returning customer, give `{{customer_name}}` and `{{appointment_date}}` real values. To test "no appointment on file," leave `appointment_date` empty.

## Mock functions and tools

**Functions & tools** lists your agent's functions. Each one runs `Live`, calling the real endpoint, until you switch it to `Mock` and enter the `Mock output` it should return. Transfer and SMS mocks also take a `Result` of `Succeeds` or `Fails`. To mock a function by name, use `Add tool` and choose `Custom function name`. A mock by name applies to every call to that function.

For example, mock `check_availability` to return no open slots and add a criterion that the agent offers a callback:

```json theme={"dark"}
{
  "availability_for_selected_time": []
}
```

You can mock custom functions, [code tools](https://docs.retellai.com/build/single-multi-prompt/code-tool.md), [integration tools](https://docs.retellai.com/integrations/overview.md#use-integration-tools-in-an-agent), the Cal.com tools, transfers, and SMS. Built-in actions such as end call, press digit, extract variables, and agent transfer always run as part of the simulation. MCP tools aren't listed.

> [!WARNING]
>
> A function you leave Live calls its real endpoint during the run, so a test can create a real booking, charge, or record. Text tests also always call MCP tools for real. Mock every function that reaches production before you run. Transfers and SMS are the exception: in a simulation they're always simulated and succeed unless you mock a failure.

![Functions & tools section of a test case form. Transfer to Nurse Line is set to Mock with Result on Fails and the mock output Transfer failed: the nurse line did not answer. Check Availability (check\_availability) is set to Mock with a JSON mock output that returns an empty availability\_for\_selected\_time list. Book Appointment (book\_appointment) is left on Live. An Add tool button is below.](https://mintcdn.com/retellai/8ZCrhFAw4xq7qprW/images/test/function-mocks.png?fit=max\&auto=format\&n=8ZCrhFAw4xq7qprW\&q=85\&s=47739f78a179d81692da80da11b1712b)

Each of the agent's functions runs Live until you switch it to Mock.

## How an audio test runs

Your agent hears the AI caller through its own speech recognition, as on a real call, so a misheard word changes the conversation. An audio run passes only if the call ends in a hangup. If it reaches your agent's maximum call duration instead, it ends in Error.

## FAQ

> [accordion] Can I use my own cloned voice as the caller?
>
> Yes. In Caller voice, choose Select custom voice and pick one of your cloned or provider voices.

> [accordion] Why does my audio test end in Error?
>
> Usually because the call never hung up. An audio run passes or fails only when the call ends in a hangup, so make sure the scenario lets the conversation finish and the agent can end the call.

> [accordion] Do I need a success criterion for every metric?
>
> Only for the ones you want to grade. Metrics are measured and shown in the run details either way, and an equation criterion turns one into a pass or fail.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.