---
schema_version: "1"
id: 629d14029212acf9f3a37111cc4dc837385c12d7c108f6bf876061dbf1cf3807
title: Create Variables in Agentforce Builder
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/agent_builder_variables_create.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.agent_builder_variables_create.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 0fc1f021c02273780119643875c3b960589ae931065a36d3e144ffc8ae9134bc
description: Use variables to store and reuse values in your agent’s reasoning and control how an agent makes decisions. For example, when you assign a variable to an action input, your agent can use only the assigned variable to fill the value of the input.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Create Variables in Agentforce Builder

Use variables to store and reuse values in your agent’s reasoning and control how an agent makes decisions. For example, when you assign a variable to an action input, your agent can use only the assigned variable to fill the value of the input.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions. <a href="https://help.salesforce.com/s/articleView?id=ai.agent_setup_explore_types.htm&amp;release=264.0.0&amp;type=5" title="Learn about agent types and default templates for specific clouds and common use cases.">Required add-on licenses vary by agent type.</a></td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d216590e80">User
              Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d216590e80 ">To create a variable:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d216590e80 ">Manage AI Agents AND <a href="https://help.salesforce.com/s/articleView?id=ai.agent_setup_explore_types.htm&amp;type=5&amp;language=en_US" target="_blank">the required permissions for your agent
                type</a></td>

          </tr>
        </tbody>
      </table>

1. From the App Launcher, enter Agent, and then select the **Agentforce Studio** app.
2. On the Agents tab, click the name of your agent.
3. On the Explorer panel, click **Variables**.
4. On the Variables page, click **New**.
    1. To create a custom variable, click **Create Custom Variable**. In the New Variable window, define the variable's settings. By default, variables can only be set in the agent. To set the value of a variable with an API, select **Enable API write access**.
    2. To add a context variable that's mapped to a Messaging Session object field, click **Add Messaging Session Variable**. Select the variables that you want to add and then click **Add to Agent**.

To create a variable that's set to an action output, select an action in the Actions Available For Reasoning section of a subagent. Next to an action output, click **Select Variable** and then select **Create a variable**. In the New Variable window, define the variable's settings.

By default, action inputs are agent populated. To assign a specific variable to an action input, select an action in the Actions Available For Reasoning section of a subagent. Then, next to an action input, click **Select Variable**.

To use a variable in subagent instructions, use this format in natural language prompts: `{!@variables.VariableName}`. And use this format in logical expressions: `@variables.VariableName`.