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

# Test your agent before callers hear it

> Test your draft with a browser call, a phone call or a chat, choose which environment's values the test reads, and set test values of your own.

Every agent has a **Test** menu in the editor header. Use it to talk to your draft in the browser, have the agent call your phone, or chat with it in text. Tests run your own draft, so you can try changes before anyone publishes them, and nobody else's tests or calls change.

## Before you start

* You need the Call permission to start a test. Owners, admins and members all have it by default. See [Roles and permissions](https://docs.tryhamsa.com/overview/projects/roles-and-permissions.md).
* Save your changes first. While the editor has unsaved changes, **Test** is disabled and its tooltip says "Please save changes before testing".
* For a phone call test, the agent needs a phone number. See [Phone numbers](https://docs.tryhamsa.com/agents/connect/phone-numbers.md).

## Start a test

**1. Open the Test menu**

In the editor header, click **Test**.

![The flow builder header with the Test menu open: Browser call, Phone call, Chat, Values from dev and Test values](https://mintcdn.com/hamsa-452fa79a/IyoYQ-nNrFRmlJOT/images/agents/release/test-menu-light.webp?fit=max\&auto=format\&n=IyoYQ-nNrFRmlJOT\&q=85\&s=afa5ed42fceb8c5fac959288eadb82ef)

**2. Choose how to test**

* **Browser call**: talk to the agent through your computer's microphone.
* **Phone call**: enter **Your phone number** and the agent calls you.
* **Chat**: the same agent in text, with the same prompts, tools and values.

**3. Fill in dynamic variables, if asked**

If the agent uses [dynamic variables](https://docs.tryhamsa.com/agents/variables/dynamic-variables.md), a dialog asks for a value for each one before the call starts. Every variable needs a value.

![The Phone call dialog with a UAE number in Your phone number and a value filled in for each dynamic variable](https://mintcdn.com/hamsa-452fa79a/2xrN5xxbhCUDZ-2o/images/agents/connect/test-phone-call-light.webp?fit=max\&auto=format\&n=2xrN5xxbhCUDZ-2o\&q=85\&s=cf6486053fece05e209d56cccb2029ea)

**4. End the test**

Click **End call**, or end the chat from the chat panel.

> [!TIP]
>
> Start or end a browser test call with Cmd+Shift+Enter on Mac or Ctrl+Shift+Enter on Windows. Start a test chat, or bring the open one back, with Cmd+Option+Enter on Mac or Ctrl+Alt+Enter on Windows.

If your browser blocks the microphone, the app says so. Allow the microphone for the site in your browser, and for your browser in your computer's settings, then try again.

### Chat with your agent

The chat opens in the panel beside the editor, so you can keep working while you chat. Type a message and press Enter to send it; Shift+Enter starts a new line. Each of the agent's replies shows how long it took ("Replied in \{seconds} s"), from the moment you sent your message to the reply.

* **Copy conversation** copies the whole chat as text, one line per message ("You: …", "Agent: …").
* **Restart chat** ends this chat and starts a fresh one with the same agent.
* **Logs** shows the test's logs, as for a call.

![The Chat panel during a test chat: the agent's greeting, two questions and answers each marked Replied in 1.4 s and 1.1 s, and Copy conversation and Restart chat above them](https://mintcdn.com/hamsa-452fa79a/IyoYQ-nNrFRmlJOT/images/agents/release/test-chat-panel-light.webp?fit=max\&auto=format\&n=IyoYQ-nNrFRmlJOT\&q=85\&s=9e326f212a640cceca5e3eb5b6d2b177)

## Choose which values your test reads

When an agent uses [environment variables](https://docs.tryhamsa.com/agents/variables/environment-variables.md), each test reads the values of one environment.

* With deployments on, the **Test** menu has **Values from \{env}** (for example **Values from dev**). Pick another environment there to test against its values. "Only your tests change": nothing is saved, and no colleague or real call is affected.
* With deployments off, tests read the prod values.

![The Test menu with Values from dev open, offering dev, staging and prod](https://mintcdn.com/hamsa-452fa79a/IyoYQ-nNrFRmlJOT/images/agents/release/test-menu-values-from-light.webp?fit=max\&auto=format\&n=IyoYQ-nNrFRmlJOT\&q=85\&s=5599bc37c143a0d8b97e65430c1d382f)

If you are viewing a version that runs in more than one environment, the menu shows **Choose whose values to test with**. Pick one; until you do, test calls can't start.

You can also start a test from **Releases**: open an environment's menu and click **Test with this environment**. See [Environments and releases](https://docs.tryhamsa.com/agents/release/environments.md).

## Use test values

**Test values** in the **Test** menu let you replace an environment's values for your own tests of this draft. "Your tests of this draft use these instead of \{env}'s values. Nobody else's tests change, and no environment does."

**1. Open Test values**

Click **Test** > **Test values**.

**2. Add a key and a value**

Click **Add a key**, type the key, then its value. Each key shows whether it is "Not in \{env} yet", "Differs from \{env}" or "Same as \{env}".

![The Test values dialog with the key LOYALTY\_API\_URL marked Not in dev yet, its test value, and Save test values](https://mintcdn.com/hamsa-452fa79a/IyoYQ-nNrFRmlJOT/images/agents/release/test-values-light.webp?fit=max\&auto=format\&n=IyoYQ-nNrFRmlJOT\&q=85\&s=f39ec8ae0d07a427764684d1345a082b)

**3. Save**

Click **Save test values**. Your next test uses them.

Test values are also how you add a new environment variable without access to Releases: add the key here with a value, use it as `{{KEY}}` in a prompt or tool, and test. When your changes are merged, the person merging chooses which test values to add to the environment. See [Merge requests](https://docs.tryhamsa.com/agents/release/merge-requests.md).

| Rule | Limit |
| - | - |
| Key | Starts with a capital letter; capital letters, numbers and underscores only; at most 64 characters |
| Value | 1 to 4,000 characters |
| Test values per draft | At most 50 |
| Names you can't use | A system variable the agent fills in during a call, or a variable the agent already has |

To stop using one, clear it. "Cleared. Your next test uses \{env}'s values."

## Follow a test while it runs

In the flow builder, the **Live call logs** panel shows what happens during the call: the conversation, step changes, tool runs and system events. Open it from the **⋯** menu in the editor header. Search the logs, filter by type (**Error**, **Warning**, **Information**, **Debug**) or **Category**, or export them.

![Live call logs during a test call, filtered by node to Verify the order, with Follow canvas switched on and the Locate node button in the filter bar](https://mintcdn.com/hamsa-452fa79a/2654KIaxnTY04VOj/images/agents/release/live-call-logs-follow-light.webp?fit=max\&auto=format\&n=2654KIaxnTY04VOj\&q=85\&s=fc3ea242fca1bd94315fb2ce2189cfe1)

While a call runs, the step it is in is highlighted on the canvas, and the log list scrolls so the latest line for that step stays in view.

| Control | What it does |
| - | - |
| **Follow canvas** | "Pan the flow so the active node stays centered in the visible area." Off by default. |
| **Open groups** | Shown while **Follow canvas** is on and the flow has [groups](https://docs.tryhamsa.com/agents/flow/flow-builder.md#group-steps). "While following, open the group the active step is in and follow it there, instead of showing it on the group card." |
| **Node** | Shows only the lines from the steps you pick. A bar reads "Filtered by node:" with the step's name; click the X (**Show all**) to see every step again. |
| **Locate node on canvas** | In the filter bar, moves the canvas to the filtered step. Each log line also has **Locate node**, which moves the canvas to the step that line came from. |

Your choice of **Follow canvas** and **Open groups** is kept in this browser, for every flow you open.

* Every test call is saved with the agent's other calls. Open **Calls** in the editor header to find it, then open it in [call details](https://docs.tryhamsa.com/agents/monitor/call-details.md). From there, [**Debug mode**](https://docs.tryhamsa.com/agents/monitor/debug-mode.md) steps through the call on its flow, with its recording, visits and logs.

## Test someone else's merge request

Owners and admins can test a member's merge request before merging it. Click **Test** on the request. A banner says "Test calls and chats run \{name}'s merge request, not your draft." and its test values are used. Click **Back to my draft** to return to your own draft. See [Merge requests](https://docs.tryhamsa.com/agents/release/merge-requests.md).

## Good to know

* A test runs the agent's draft as you saved it. Save before you test.
* Test calls never see another member's test values, and real calls never see test values at all.
* Test calls are left out of A/B test comparisons.
* Phone numbers aren't part of a version. Changing which number the agent uses doesn't need a publish.

## Related

> [card] [Test values and undefined variables](https://docs.tryhamsa.com/agents/variables/test-values.md)
>
> Preview values in the editor and spot variables with no value.

> [card] [Drafts and versions](https://docs.tryhamsa.com/agents/release/drafts-and-versions.md)
>
> Your private draft, publishing and version history.

> [card] [Environments and releases](https://docs.tryhamsa.com/agents/release/environments.md)
>
> dev, staging and prod, and what each one runs.

> [card] [Call details](https://docs.tryhamsa.com/agents/monitor/call-details.md)
>
> Transcript, recording and debug mode for any call.


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