Agent Script Reference
Use this reference to look up Agent Script syntax, keywords, and concepts. For common patterns and examples, see Agent Script Patterns.
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 |
@topic.name | Delegate to another topic. For example: consult: @topic.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 topic. For example: @utils.transition to @topic.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 topic. | 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 |
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 topic. | 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 topic classification and routing. For example: start_agent topic_selector: | Start Agent Block |
system | Top-level block for agent instructions and messages. | System Block |
system.instructions | Override system instructions for a specific topic. | System Overrides |
target | The flow or action target for an agent action. For example: target: "flow://Get_Order" | Actions |
topic | Top-level block defining a topic's instructions and actions. For example: topic Order_Management: | Topic Blocks |
transition to | Move to a different topic from logic instructions. For example: transition to @topic.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 |
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 topic.
-
After Reasoning - Optional block inside a topic 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.
-
Reasoning Instructions - Instructions that Agentforce resolves into a prompt for the LLM.
-
Start Agent Block - A special topic used for topic 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.
-
Topics - 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 topics or setting variable values.
-
Variables - Let agents track information across conversation turns.