Variables
Variables are named configuration values that can differ per environment. Define them once and reuse them across your agents and actions for non-sensitive settings.
Variables vs. Secretsโ
| Variables | Secrets | |
|---|---|---|
| Purpose | Non-sensitive configuration | Sensitive credentials |
| Visibility | Values visible to team members | Values hidden after creation |
| Example | Tenant ID, default language, support email | API key, OAuth client secret, auth token |
| Per-environment | Yes | Yes |
Use variables for values that are safe to display and share within your team. Use secrets for anything that should remain hidden.
Managing variablesโ
Creating a variableโ
- Navigate to Manage > Variables in Studio
- Click Add variable
- Enter a Variable name (e.g.,
TENANT_ID,DEFAULT_LANGUAGE) - Enter a value for each environment (Development, Staging, Production)
- Click Save
Naming best practices:
- Use uppercase with underscores (e.g.,
TENANT_ID) - Be descriptive (e.g.,
DEFAULT_LANGUAGEnotLANG1) - Include the service name when relevant (e.g.,
CRM_TENANT_ID)
Editing a variableโ
- Find the variable in the list
- Click Edit
- Update the values for the relevant environments
- Click Save
Deleting a variableโ
- Find the variable in the list
- Click Delete
- Confirm deletion
If the variable is still referenced in any agent state instructions or email agent configurations, the deletion will be blocked and you'll see which agents are using it. Remove the references first, then retry the deletion.
Using variables in state instructionsโ
You can reference variables directly in your state instructions using the @ mention feature:
- While editing state instructions, type
@ - Select a variable from the dropdown (variables are shown with a variable icon)
- The variable appears as a highlighted chip in the editor
When the agent resolves the instructions, the variable mention is replaced with the Go template syntax {{.static_variables.VARIABLE_NAME}}, which is then filled in with the environment-specific value when the conversation starts.
Using variables in actionsโ
Reference variables in your action request body templates using Go template syntax:
{{.static_variables.VARIABLE_NAME}}
Example: Environment-specific tenant ID
With a variable TENANT_ID set to:
- Development:
acme-dev - Staging:
acme-staging - Production:
acme
Your action request body template can reference it:
{
"tenant": "{{.static_variables.TENANT_ID}}",
"order_id": "{{.parameters.order_id}}"
}
When values are filled inโ
Variable values are filled in when the conversation starts based on the environment, and stay the same throughout the call. This differs from other template values:
| Template syntax | When it's filled in | Use for |
|---|---|---|
{{.static_variables.NAME}} | When conversation starts | Environment-specific config |
{{.parameters.NAME}} | During the conversation | Values collected from the caller |
{{.variables.NAME}} | During the conversation | Conversation state and context |
Because variable values are set at the start, they cannot depend on conversation state โ they are fixed for the duration of the call based on the environment.
Per-environment valuesโ
Each variable can have a different value per environment. The correct value is automatically resolved based on the conversation's environment:
- Playground sessions: Uses the environment selected in the environment selector.
- Phone calls: Uses the environment configured on the connector.
This lets you use different identifiers or settings depending on the environment โ without changing your action configuration.