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.

SymbolDescriptionMore Info
#Single-line comment. For example: # This is a commentComments
...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 > 0Supported Operators
@actions.nameReference an action. For example: run @actions.get_orderActions
@outputs.nameReference an action's output value. For example: set @variables.status = @outputs.statusActions
@topic.nameDelegate to another topic. For example: consult: @topic.specialistTools
@utils.escalateDefine a tool that escalates to a human service rep. For example: escalate: @utils.escalateUtils
@utils.setVariablesDefine a tool that instructs the LLM to set variable values. For example: set_name: @utils.setVariablesUtils
@utils.transition toDefine a tool that transitions to a different topic. For example: @utils.transition to @topic.Order_ManagementUtils
@variables.nameReference a variable from logic instructions. For example: @variables.order_idVariables
actionsDefine agent actions or tools available from a topic.Actions, Tools
after_reasoningRun logic after the reasoning loop exits.After Reasoning
available whenConditionally show or hide a tool. For example: available when @variables.verified == TrueTools
configTop-level block for agent configuration.Config Block
connectionTop-level block for external connections like Enhanced Chat. For example: connection messaging:Connection Block
if / elseConditional branching. For example: if @variables.is_member == True:Conditional Expressions
instructionsGuidance for the LLM within system or reasoning blocks.Reasoning Instructions
languageTop-level block for supported languages.Language Block
linkedDeclare a variable whose value comes from an external source. For example: session_id: linked stringVariables
messagesSystem messages like welcome and error prompts.System Block
mutableAllow a variable's value to be changed. For example: order_id: mutable string = ""Variables
reasoningBlock containing instructions and tools for the LLM.Reasoning Instructions
reasoning.actionsTools the LLM can choose to call within a topic.Tools (Reasoning Actions)
reasoning.instructionsPrompt and logic instructions sent to the reasoning engine.Reasoning Instructions
runExecute an action deterministically. For example: run @actions.get_orderActions
setStore a value in a variable. For example: set @variables.status = @outputs.statusVariables, Actions
start_agentEntry point block for topic classification and routing. For example: start_agent topic_selector:Start Agent Block
systemTop-level block for agent instructions and messages.System Block
system.instructionsOverride system instructions for a specific topic.System Overrides
targetThe flow or action target for an agent action. For example: target: "flow://Get_Order"Actions
topicTop-level block defining a topic's instructions and actions. For example: topic Order_Management:Topic Blocks
transition toMove to a different topic from logic instructions. For example: transition to @topic.wrap_upUtils
variablesTop-level block for global agent variables.Variables
withBind an input parameter. For example: with order_id = @variables.order_idActions

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.