> ## 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 values and the undefined variable chip

> Try your own environment values in draft test calls without changing any environment, add a new key that way, and fix variables marked as not defined.

Test values let you try different environment values in your own test calls, without changing dev, staging or prod and without affecting anyone else's tests. They're also how you add a new environment variable from your draft. This page also covers the amber chip the editor shows on a variable that isn't defined, and how to fix it.

To try different values for [dynamic variables](https://docs.tryhamsa.com/agents/variables/dynamic-variables.md), use the form that opens when you start a **Browser call** or **Phone call** from the **Test** menu. Test values are for [environment variables](https://docs.tryhamsa.com/agents/variables/environment-variables.md).

## Set test values

**1. Open Test values**

In the agent editor, open the **Test** menu and choose **Test values**. A badge shows how many you have.

**2. Change a value**

Each environment key your draft reads is listed with the value it has now. Type your own value next to the key you want to try.

**3. Add a new key (optional)**

Click **Add a key**, type the key in capital letters and click **Add**, then give it a value. Use it in a prompt or tool as `{{NEW_KEY}}`.

**4. Save**

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

![The Test values dialog with values for API\_HOST and SUPPORT\_NUMBER, and a new key LOYALTY\_API\_KEY\_HEADER marked Not in dev yet](https://mintcdn.com/hamsa-452fa79a/7GY0-8K2sfzXu6G7/images/agents/variables/test-values-light.webp?fit=max\&auto=format\&n=7GY0-8K2sfzXu6G7\&q=85\&s=9e105fe50c6abec11fcce65235f2ccdb)

Your tests read the values of one environment: dev when the agent has deployments on, prod when it doesn't. The dialog names it: "Your tests of this draft use these instead of dev's values. Nobody else's tests change, and no environment does." The examples below say dev.

Each row shows how your value relates to that environment:

| Label | Meaning |
| - | - |
| **Not in dev yet** | A new key. It's added to the environment when your changes are merged. |
| **Differs from dev** | Your tests use your value instead of the environment's. |
| **Same as dev** | Your value matches the environment's. |

To go back to the environment's value, clear your value for that key.

The editor also offers keys you've written in your draft that no environment defines yet (capital-letter names such as `{{NEW_KEY}}`), so you can give them a value right away.

### Rules

| Rule | Message |
| - | - |
| Capital letters, numbers and underscores, starting with a letter | "Start with a letter. Use capital letters, numbers and underscores." |
| Up to 64 characters per key, 4,000 per value, and a value can't be empty | |
| Up to 50 test values | |
| Not a system variable | "The agent fills this one in during a call, so it cannot be a test value." |
| Not the name of a variable on the agent | "The agent already has a variable with this name. Pick another key." |

## How test values reach a call

* Only test calls on your own draft use your test values. They read the environment's values, with your test values on top.
* Calls to a version, calls in an environment and real calls never see test values.
* When someone tests your [merge request](https://docs.tryhamsa.com/agents/release/merge-requests.md), the Test menu shows your test values under your name ("Sara's test values"), and their test calls use them.
* When your changes are merged, the person merging chooses which test values to set in the environment (**Add test values to dev**). New keys start ticked: "without a value there, the version reads them empty."

"Test values alone can't be merged. Change the agent too, or ask an owner or admin to set the values in Releases." See [Environment variables](https://docs.tryhamsa.com/agents/variables/environment-variables.md#who-can-change-values).

The **Test** menu also has **Values from**, followed by an environment name: "Which environment's variable values your tests use. Only your tests change." See [Test your agent](https://docs.tryhamsa.com/agents/release/test-your-agent.md).

## The not defined chip

In flow steps, a variable shows as an amber chip when nothing defines its name: no step, live variable, dynamic variable, environment variable or system variable in the app's list. Hover over it to see "customer\_tier isn't defined in this agent."

![A step message with \{\{customer\_tier}} marked as not defined, and its tooltip with the Add as dynamic variable button](https://mintcdn.com/hamsa-452fa79a/7GY0-8K2sfzXu6G7/images/agents/variables/undefined-variable-chip-light.webp?fit=max\&auto=format\&n=7GY0-8K2sfzXu6G7\&q=85\&s=fb41b8b09bc22a341ed10ab0f6fbdb75)

How to fix it:

| Cause | Fix |
| - | - |
| A typo | Correct the name. In the **Jinja2 template editor**, the warning "Variable 'custmer\_name' is not defined. Did you mean 'customer\_name'?" offers to change it for you. |
| A value you'll send when the call starts | Click **Add as dynamic variable** in the tooltip. The **Dynamic variables** view opens with the name filled in; add a default and click **Add**. |
| A value per environment | Add it as an [environment variable](https://docs.tryhamsa.com/agents/variables/environment-variables.md) or as a test value. |
| A value collected later in the call | Add it to the step that collects it. See [Extracted variables](https://docs.tryhamsa.com/agents/variables/extracted-variables.md). |

**Add as dynamic variable** appears only for snake\_case names, in text you can edit.

A few names work on calls even though the editor marks them: `agent_language`, `agent_dialect` and `sip.headers`. See [System variables](https://docs.tryhamsa.com/agents/variables/system-variables.md).

### May be undefined

In the variable picker, a **May be undefined** section lists variables that are "only set on some paths into this node". They're defined, but a call that reaches the step another way hasn't set them, so they render empty there. Give them a fallback with `{{ name | default("...", true) }}`, or set them on every path. See [Jinja](https://docs.tryhamsa.com/agents/variables/jinja.md#when-a-variable-has-no-value).

## Good to know

* Test values don't change what callers hear. Nothing reaches an environment until a merge.
* A variable that's not defined doesn't break a call: it renders empty. The chip is there so you notice before a caller does.

## Related

> [card] [Test your agent](https://docs.tryhamsa.com/agents/release/test-your-agent.md)
>
> Browser calls, phone calls and debug mode.

> [card] [Environment variables](https://docs.tryhamsa.com/agents/variables/environment-variables.md)
>
> Values per environment, and who can change them.

> [card] [Merge requests](https://docs.tryhamsa.com/agents/release/merge-requests.md)
>
> Get your draft, and its test values, into dev.

> [card] [Dynamic variables](https://docs.tryhamsa.com/agents/variables/dynamic-variables.md)
>
> Values you send when the call starts.


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