Use this reference to look up Agent Script syntax, keywords, and concepts. For common patterns and examples, see Agent Script Patterns.
note: Beginning in April 2026, agent topics are now called subagents. There are no changes to functionality. During this transition, you may see a mix of the new and previous terms in our documentation
Syntax
This table lists some of the key terms used in an Agent Script file.
| Symbol | Description | More Info |
|---|---|---|
# |
Single-line comment. For example: # This is a comment |
Comments |
... |
Slot-fill token that instructs the LLM to set the value. For example: with order_id = ... |
Variables, Utils |
-> |
Begins logic instructions. For example: instructions: -> if @variables.verified: |
Reasoning Instructions |
| |
Begins prompt instructions. For example: | Help the customer with their order. |
Reasoning Instructions |
{!expression} |
Resolve a variable or resource in prompt instructions. For example: {!@variables.promotion_product} |
Reasoning Instructions |
==, !=, <, >, is None, etc. |
Comparison operators. For example: @variables.count > 0 |
Supported Operators |
@actions.name |
Reference an action. For example: run @actions.get_order |
Actions |
@outputs.name |
Reference an action's output value. For example: set @variables.status = @outputs.status |
Actions |
@subagent.name |
Delegate to another subagent. For example: consult: @subagent.specialist |
Tools |
@utils.escalate |
Define a tool that escalates to a human service rep. For example: escalate: @utils.escalate |
Utils |
@utils.setVariables |
Define a tool that instructs the LLM to set variable values. For example: set_name: @utils.setVariables |
Utils |
@utils.transition to |
Define a tool that transitions to a different subagent. For example: @utils.transition to @subagent.Order_Management |
Utils |
@variables.name |
Reference a variable from logic instructions. For example: @variables.order_id |
Variables |
actions |
Define agent actions or tools available from a subagent. | Actions, Tools |
after_reasoning |
Run logic after the reasoning loop exits. | After Reasoning |
available when |
Conditionally show or hide a tool. For example: available when @variables.verified == True |
Tools |
config |
Top-level block for agent configuration. | Config Block |
connection |
Top-level block for external connections like Enhanced Chat. For example: connection messaging: |
Connection Block |
if / else |
Conditional branching. For example: if @variables.is_member == True: |
Conditional Expressions |
instructions |
Guidance for the LLM within system or reasoning blocks. | Reasoning Instructions |
language |
Top-level block for supported languages. | Language Block |
linked |
Declare a variable whose value comes from an external source. For example: session_id: linked string |
Variables |
messages |
System messages like welcome and error prompts. | System Block |
modality voice |
Top-level block that defines how an Agentforce Voice agent speaks, including the voice persona and voice model. | Configure Voice Models |
mutable |
Allow a variable's value to be changed. For example: order_id: mutable string = "" |
Variables |
reasoning |
Block containing instructions and tools for the LLM. | Reasoning Instructions |
reasoning.actions |
Tools the LLM can choose to call within a subagent. | Tools (Reasoning Actions) |
reasoning.instructions |
Prompt and logic instructions sent to the reasoning engine. | Reasoning Instructions |
run |
Execute an action deterministically. For example: run @actions.get_order |
Actions |
set |
Store a value in a variable. For example: set @variables.status = @outputs.status |
Variables, Actions |
start_agent |
Entry point block for subagent classification and routing. For example: start_agent agent_router: |
Start Agent Block |
system |
Top-level block for agent instructions and messages. | System Block |
system.instructions |
Override system instructions for a specific subagent. | System Overrides |
target |
The flow or action target for an agent action. For example: target: "flow://Get_Order" |
Actions |
subagent |
Top-level block defining a subagent's instructions and actions. For example: subagent Order_Management: |
Subagent Blocks |
topic |
Deprecated. Use subagent instead. |
Subagent Blocks |
transition to |
Move to a different subagent from logic instructions. For example: transition to @subagent.wrap_up |
Utils |
variables |
Top-level block for global agent variables. | Variables |
with |
Bind an input parameter. For example: with order_id = @variables.order_id |
Actions |
Concepts
These reference topics cover key concepts and terms associated with Agent Script.
-
Actions - Define executable tasks that an agent can perform, such as running a flow or transitioning to a new subagent.
-
After Reasoning - Optional block inside a subagent that runs after the reasoning loop exits.
-
Blocks - The structural components of an Agent Script, where each block contains a set of properties that describe data or procedures.
-
Conditional Expressions - Deterministically specify what actions to take or which prompts to include based on the current context.
-
Configure Voice Models - Select and configure the text-to-speech voice model for an Agentforce Voice agent using the
modality voiceblock. -
Reasoning Instructions - Instructions that Agentforce resolves into a prompt for the LLM.
-
Start Agent Block - A special subagent used for subagent classification, filtering, and routing.
-
Supported Operators - The comparison, logical, and arithmetic operators you can use in Agent Script.
-
Tools (Reasoning Actions) - Executable functions that the LLM can choose to call, based on the tool's description and current context.
-
Subagents - A set of instructions, actions, and reasoning that defines a job that an agent can do.
-
Utils - Utility functions used as tools, such as transitioning to subagents or setting variable values.
-
Variables - Let agents track information across conversation turns.