# Testing your agent

> Simulated callers and pass/fail checks for prompt-based agents — what a test covers, and what it deliberately leaves out.

Source: https://docs.cleartalk.ai/docs/agents/testing

A prompt-based agent can be tested before any real customer talks to it, the same way a pathway can. A **test** is a simulated caller with a personality and a goal, who has a conversation with your agent while a set of **checks** decide whether it did the right thing.

No real call is placed and no real customer is involved. Testing works for **inbound**, **outbound** and **website** agents that run on a prompt (Agent Instructions).

<Summary
  items={[
  "Open the Tests button on the agent's edit page.",
  "Every run tests the agent's current instructions and first sentence — save first, then run.",
  "Knowledge bases and tools aren't used in a test. Check those on a real test call.",
  "Step checks, publish gates and failure analysis are pathway-only.",
]}
/>

<Callout title="Where tests live">
  Open the agent from **My Agents** and click **Tests** at the top of its edit page. The **Testing** page in the sidebar shows pass rates for every agent and pathway with tests. Availability depends on your plan, and runs consume credits like any other conversation.
</Callout>

## Writing a test

A test has the same three parts on an agent as on a pathway: a **caller profile** (who's calling and how they behave), a **caller name**, and the **checks** that decide whether it passed. The [pathway testing guide](/docs/pathways/testing#writing-a-test) covers how to write each one well, and it applies here unchanged.

The **template gallery** works here too. Templates that rely on pathway steps are left out of the gallery on a prompt-based agent.

You can also **turn a real call into a test**. In Conversations, open a call this agent handled and choose **Create a test from this call**. Review the simulated caller it drafts, add your checks, and save.

## What a test runs against

Every run uses the agent's **current instructions and first sentence**, as last saved. A prompt-based agent has no staging or production versions, so there is nothing to choose: save your edit, then run your tests.

Two parts of the agent are **not** used in a test run, and this affects which checks are worth writing:

* **Knowledge bases.** The simulated conversation can't look anything up in a knowledge base. Don't write a check that depends on a fact only the knowledge base holds; it will fail even when the agent is fine.
* **Tools, including appointment booking.** These are left out on purpose. A tool in a test would run for real, so a booking tool would put an appointment that nobody asked for on your calendar.

<Key>
  **Test the conversation, not the integrations.** A test answers whether the agent says the right things in the right order: how it opens, handles pushback, and ends. To check that it answers from your knowledge base or books correctly, place a real test call to yourself.
</Key>

## What's different from a pathway

A prompt-based agent has no steps and no publish step, so a few parts of testing only exist on pathways:

|                                                | Pathway | Prompt-based agent                   |
| ---------------------------------------------- | ------- | ------------------------------------ |
| Checks on which steps were reached             | Yes     | No (the agent has no steps)          |
| Checks on extracted variables                  | Yes     | No                                   |
| Start a test at a specific step                | Yes     | No                                   |
| Test staging or the live version               | Yes     | No (always the current instructions) |
| **Required to publish**                        | Yes     | No (there's no publish step to gate) |
| **Analyze failure** on a failed run            | Yes     | No                                   |
| Transcript, checks, natural conversation score | Yes     | Yes                                  |

Checks that judge the conversation itself, such as "the agent offered two appointment times" or "the agent never quoted a price", work the same on both.

<Callout title="An agent that follows a pathway">
  If an agent's prompt is set to a pathway, its calls follow that pathway, so there's no **Tests** button on its page. Test it in the pathway's own Tests panel. See [testing your pathway](/docs/pathways/testing).
</Callout>

## Trying it yourself

A test can't check your knowledge base, tools or bookings, so before an agent goes live, talk to it yourself. The editor gives each kind of agent a way in:

* **Inbound** — the **Test this agent** card on the right of the editor names the number to call. Unsaved changes take effect once you save. If no number is picked yet, it tells you to pick one in **Agent Information** first.
* **Outbound** — **Test Call** at the top of the editor rings a US number you enter, from the agent's own numbers. The call uses the agent's **last saved** settings, so save first; a brand-new agent has to be created before it can call. The call appears in Conversations once it ends, and costs credits like any other call.
* **An agent that follows a pathway** — in the new editor, **Test chat** at the top opens a text chat with the version of the pathway your calls use. Webhooks, tools and bookings in that pathway run for real here; transfers need a real call. If the chat can't start, the panel says so and gives the reason, with **Restart chat** to try again.

## A practical routine

1. Before an agent takes its first real call, write tests for the **main job** and the **two or three ways it most often goes wrong**.
2. Add the templates that match your reality — voicemail if it dials out, frustrated callers if it handles complaints.
3. After every instruction edit, **save, then run all tests**. A change that fixes one conversation often breaks another.
4. When a real call goes wrong, **make a test from it**, so the same mistake can't come back unnoticed.
