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.
From the App Launcher, enter Agent, and then select the
Agentforce Studio app.
On the Agents tab, click the name of your agent.
On the Explorer panel, click Variables.
On the Variables page, click New.
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.
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.
Did this article solve your issue?
Let us know so we can improve!
Loading
Salesforce Help | Article
Cookie Consent Manager
Cookie Consent Manager
General Information
Required Cookies
Functional Cookies
Advertising Cookies
General Information
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.