> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform/console/agent-builder/build/secrets-and-variables.md). Agents can also search and read this documentation through its [MCP server](https://docs.uptiq.ai/~gitbook/mcp).

# Secrets & Variables

Manage encrypted secrets and runtime variables used throughout your agent.

**Secrets & Variables** is the agent's keychain and configuration store. The page has three tabs: **Secrets** (API keys, tokens, credentials — encrypted when **Secured** is on), **Variables** (general-purpose values like base URLs, IDs, default parameters — stored in clear), and **Built-in** (values the platform provides when the agent runs). **Secrets** opens first.

Everywhere else in the builder that needs a value the agent resolves at runtime references the value from this page. Examples are a skill's API endpoint, a credential in an instruction, and an integration's auth header. The reference is a `$secret.` or `$agent.` reference, not the value pasted inline. Reach this page from **Agent Config → Secrets & Variables** in the left navigation.

<figure><img src="https://1326225582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0qmgQjJ5aArDTj2ACFHG%2Fuploads%2Fgit-blob-b5ae29009dd5f1842074b367d8b84e6276479be2%2Fqore_agent-builder_manage-agent-secrets-and-variables_rounded_shadow.png?alt=media" alt="The Secrets and Variables page in Agent Config, with the Secrets table and its Text or JSON type menu open, the Variables table, and the Built-in section"><figcaption><p>Secrets &#x26; Variables.</p></figcaption></figure>

### Secrets <a href="#secrets" id="secrets"></a>

The **Secrets** tab stores API keys, tokens and other sensitive credentials the agent uses when it runs. Turn on **Secured** to store a secret in encrypted format. Leave it on for any value that would be a problem if it leaked.

**Usage syntax:** `$secret.{variable_name}` — for example, `$secret.API_URL`, `$secret.STRIPE_SECRET_KEY`.

Reference a secret by its `$secret.{name}` form anywhere the platform accepts dynamic values: skill configurations, trigger descriptions, instructions, integration settings.

<table><thead><tr><th width="229.99993896484375">Field</th><th>What it holds</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>The identifier you reference. Becomes <code>$secret.{name}</code>.</td></tr><tr><td><strong>Type</strong></td><td><strong>Text</strong> or <strong>JSON</strong>. A Text value can't contain spaces; a JSON value must be valid JSON.</td></tr><tr><td><strong>Value</strong></td><td>The secret's value.</td></tr><tr><td><strong>Secured</strong></td><td>When ticked, the value is stored encrypted and shows as <code>******</code> after you save. Off by default, so tick it for anything sensitive.</td></tr></tbody></table>

To add a secret, select **Add Secret**, fill in the row, and select **Save**.

A secret's name can't be changed once it's saved; delete the row and add it again under the new name. A secured value can't be edited in place either. To change one, untick **Secured** (this clears the value), enter the new value, tick **Secured** again, and save.

### Variables <a href="#variables" id="variables"></a>

The **Variables** tab stores general-purpose values the agent uses when it runs: non-sensitive values that change between environments or use cases, but don't need encryption.

**Usage syntax:** `$agent.{variable_name}` — for example, `$agent.BASE_URL`, `$agent.DEFAULT_REGION`.

<table><thead><tr><th width="225.20001220703125">Field</th><th>What it holds</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>The identifier you reference. Becomes <code>$agent.{name}</code>.</td></tr><tr><td><strong>Description</strong></td><td>A short note on what the variable is for. Useful when another team member opens the agent later.</td></tr><tr><td><strong>Default Value</strong></td><td>The value <code>$agent.{name}</code> resolves to when the caller doesn't supply one. It can be left empty.</td></tr></tbody></table>

To add a variable, select **Add Variable**.

**Save**, at the top of the page above the tabs, keeps your changes on either tab.

#### Setting a variable from the caller <a href="#setting-a-variable-from-the-caller" id="setting-a-variable-from-the-caller"></a>

An application that triggers the agent through the Agent API can pass values for the agent's variables in the `variables` object of the trigger request. A value passed this way replaces the variable's **Default Value** for that run. A variable the request doesn't name keeps its **Default Value**.

```json
"variables": { "customerName": "John", "region": "US" }
```

* Every key must be a variable declared in this table. A request that names an undeclared variable is rejected with `AGENT_VARIABLES_NOT_FOUND`.
* Values are strings.

For the full request, see [Agent Integration](https://docs.uptiq.ai/platform/console/agent-builder/deploy/agent-integration/agent-api.md#passing-variables-and-a-business-id).

#### Variables in MCP server connections <a href="#variables-in-mcp-server-connections" id="variables-in-mcp-server-connections"></a>

On an agent that runs on executor version 1.5, an MCP server's URL and header values can reference the agent's variables as `$agent.{name}`. The reference resolves on every run, to the value the caller passed or to the **Default Value**. Each caller can send its own value, such as an access token or an account ID. For example, a header with the value `$agent.accessToken` carries the `accessToken` the caller passed in `variables`.

* `$secret.` values are never sent to an MCP server.
* A reference to a variable the agent doesn't have resolves to an empty value.
* If a passed value would change the server's address, the run stops with `MCP_SERVER_HOST_CHANGED`.
* On executor version 1.4, the reference isn't resolved: the server receives the text `$agent.{name}` as written. See [Runtime & Versioning](https://docs.uptiq.ai/platform/console/agent-builder/build/runtime-and-versioning.md#when-the-executor-version-matters).

### Field rules for secrets and variables <a href="#obligation-across-the-two-tables" id="obligation-across-the-two-tables"></a>

| Field                  | Obligation | Notes                                                  |
| ---------------------- | ---------- | ------------------------------------------------------ |
| Secret Name            | Mandatory  | See the naming rules below.                            |
| Secret Type            | Mandatory  | **Text** (no spaces) or **JSON** (must be valid JSON). |
| Secret Value           | Mandatory  |                                                        |
| Secret Secured         | Optional   | Off by default. Tick it for anything sensitive.        |
| Variable Name          | Mandatory  | See the naming rules below.                            |
| Variable Description   | Optional   | Recommended.                                           |
| Variable Default Value | Optional   |                                                        |

**Naming rules.** A name starts with a letter or an underscore and contains only letters, numbers and underscores, so no spaces. Two secrets, or two variables, can't share a name.

### When to use a secret versus a variable <a href="#when-to-use-a-secret-versus-a-variable" id="when-to-use-a-secret-versus-a-variable"></a>

{% columns %}
{% column %}
Use a **secret** for anything that would be a problem if it leaked: API keys, OAuth client secrets, database passwords, internal endpoints not meant for public exposure.
{% endcolumn %}

{% column %}
Use a **variable** for anything that's safe to expose but useful to centralize. Examples are base URLs that differ between staging and production, default region or locale codes, and identifiers that other parts of the agent reference repeatedly.
{% endcolumn %}
{% endcolumns %}

A useful rule: if you'd hesitate to paste the value into a public Slack channel, it belongs in Secrets. If you wouldn't hesitate, it belongs in Variables.

### How references resolve at runtime <a href="#how-references-resolve-at-runtime" id="how-references-resolve-at-runtime"></a>

When the agent runs, the platform resolves `$secret.{name}` and `$agent.{name}` references to their stored values before passing the substituted content to skills or to the model. The reference syntax stays in the *stored* configuration; only the runtime sees the resolved value.

This means:

* A skill configuration that references `$secret.STRIPE_SECRET_KEY` shows the literal `$secret.STRIPE_SECRET_KEY` in the configuration form, not the actual key.
* The same reference resolves to the real key when the skill executes.
* Updating the secret's value updates every skill that references it, immediately, without re-editing each skill.
* When the trigger request passes a value for a variable, `$agent.{name}` resolves to that value for the run. This applies in instructions, skill configurations and, on executor version 1.5, MCP server connections. Otherwise it resolves to the **Default Value**.

This is the main reason secrets and variables belong on a single page rather than scattered through the skills that use them. There is one place to rotate a key when it changes.

### Built-in values <a href="#built-in-values" id="built-in-values"></a>

The **Built-in** tab lists values the platform provides when the agent runs. There's nothing to store for them.

* `$auth.token`: the verified caller's token, once the agent has [Authentication](https://docs.uptiq.ai/platform/console/agent-builder/deploy/authentication-1.md) turned on. It resolves **only in MCP connection configurations**; skills don't receive it. When a request carries no token, it resolves empty.

### Why this matters <a href="#why-this-matters" id="why-this-matters"></a>

{% hint style="info" %}
This page is the boundary between *configuration* (what the agent's been told to do) and *credentials* (what the agent needs to actually do it). Keeping that boundary clean — every credential here, every reference elsewhere — gives you three things the alternative doesn't. First, secrets don't appear in Instructions, trigger descriptions, or skill configs that may be visible in traces or shared with other team members. Second, rotating a credential is a one-row edit rather than a scavenger hunt. Third, the same agent can be promoted across environments by changing the values here without touching anything else. Treat this page as the canonical source for anything the agent needs to authenticate or address an external system.
{% endhint %}

## What's next

{% content-ref url="/pages/re2eRT4yR6XTEPkZmPWt" %}
[Authentication](https://docs.uptiq.ai/platform/console/agent-builder/deploy/authentication-1.md)
{% endcontent-ref %}

***

{% columns %}
{% column width="83.33333333333334%" %}

<p align="right"><em>Maintained by</em> <mark style="color:green;">Abhishek Paul</mark><br><code>AI-assisted, human-approved</code></p>
{% endcolumn %}

{% column width="16.666666666666664%" %}

<div align="left"><img src="https://1326225582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0qmgQjJ5aArDTj2ACFHG%2Fuploads%2Fgit-blob-d034645b4f8f8ee661985f5306b60ded3289653c%2Fmaintainer-abhishek-paul.png?alt=media" alt="" width="60"></div>
{% endcolumn %}
{% endcolumns %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uptiq.ai/platform/console/agent-builder/build/secrets-and-variables.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
