Build a Complete Deterministic Agent Using Agent Script | Agentforce | Salesforce
Автор: Salesforce Dev
Загружено: 2026-01-17
Просмотров: 30
In this in‑depth salesforce agentforce lecture, the focus is on turning a non‑deterministic agent into a more deterministic and reliable order management assistant that safely handles order status queries. The session starts from an existing version of an agent that can already accept an order number and return the order status, and then evolves it into a second version where the agent follows a procedural, controlled flow instead of guessing values or invoking actions too early.
The lecture walks through the complete agent script definition, explaining how system variables, config, and custom variables work together inside salesforce agentforce. You will see how to define a dedicated order_number variable, mark it as mutable, assign a default value of 0, and use this initialization as a clear indicator that the user has not yet provided an order number. This pattern is then used to control when actions are visible and when they can execute, removing a large amount of llm guesswork from the flow.
A significant part of the video is dedicated to working with variables in agent script: how to declare them, how to choose the correct data type (text/string, number/integer, boolean, object), and how mutable variables can be updated either by the agent or by actions. The lecture also touches on linked variables and context variables that come from the messaging session, such as details about logged‑in community users, and why those should not be modified by the agent itself.
Once the variable is defined, the instructor adds filters on the order status action so that it is only available when variable.order_number is not equal to zero. This simple condition ensures that the action cannot run when the user has not yet shared an order number, which prevents null bindings, runtime errors, or empty SOQL queries in downstream apex or flow actions. The lecture demonstrates how to configure this in both canvas mode and script mode, and explains how the same logic appears in the underlying YAML‑like agent script.
The core procedural logic is implemented using if/else blocks inside the topic instruction. The video shows how to add a conditional statement that checks if the order number is equal to zero. If it is zero, the agent is explicitly instructed that the order number has not been provided yet, must ask the user for the order number, and must invoke a dedicated action to set the variable. This action uses the standard utils.set_variables capability in agentforce to update the order_number variable with the value given by the user, with ... indicating that the llm should fill the input from the conversation.
You will also learn how to write template instructions that combine static strings with dynamic variables and actions. The lecture explains the arrow symbol used for template instructions and the pipe (|) symbol used for multi‑line instructions, showing how all pipe‑prefixed lines that are “reached” at runtime are concatenated into a single final instruction. This pattern allows the agent to build rich, dynamic instructions that depend on current variable values and conditional branches.
From there, the session demonstrates how to call actions from inside these instructions using merge tags such as {{!@actions.order_status}}, and how to reference variables using @variables.order_number. The difference between accessing variables (@variables) and actions (@actions) is carefully explained, along with how to write conditions such as == 0, != 0, and how to reason about null or none checks.
The lecture highlights that, in version one, the agent directly invoked the order status action using llm slotting for the order number. In version two, the flow is redesigned so that the agent first collects the order number, sets it into the variable, and only then exposes and executes the order status action. This reduces guesswork, ensures more deterministic behavior, and creates a hybrid reasoning agent that combines free‑text instructions with structured procedural logic, filters, and variable‑driven decisions.
salesforce agentforce course, salesforce ai agents, salesforce genai agents, salesforce order tracking, salesforce order status chatbot, salesforce apex integration, salesforce flow orchestration, salesforce omni channel bots, customer support automation, customer service chatbot, deterministic ai workflows, agent scripting best practices, agent reasoning engine, hybrid reasoning chatbot, guided conversation flow, context aware agents
#salesforceagentforce #agentforce #salesforceagents #salesforceai #salesforcetutorial #salesforcelearning #salesforceorderstatus #salesforceordermanagement #ordersatusbot #customerserviceautomation #customersupportchatbot #llmslotting #deterministicagents #mutablevariables #agentscript #salesforceapex #salesforceflow #aiagents #genaichatbot
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: