Hybrid Reasoning, Filters, Variables
Agentforce Specialist · Lesson 7 of 14 · 1:00:43
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Salesforce Agentforce Specialist exam. In this lesson: hybrid reasoning, Canvas and Script View, logic resolved before the prompt, if and else, before and after reasoning, available when filters that gate actions, mutable and linked variables, and template expressions in prompt text. Includes three original practice questions, with Sunmeadow Solar, a fictional solar installer, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of December 2026.
Most of the time is not enough
Sunmeadow's rule is simple: a technician visit is never booked before the customer is verified. A prompt instruction that says so works most of the time. But for a business rule, most of the time is not enough, and this lesson shows how to make it hold every time.
Why hybrid reasoning
In the older model, the language model made every decision, with at least three model calls in each turn, and no state that persisted. The same request could take a different path each time, which made agents hard to predict and hard to audit. Hybrid reasoning keeps the model for judgment, and moves the rules into logic that runs the same way every time.
Components and benefits
Its components are the ones from the last lesson. Agent Script holds both the logic and the prompts, it compiles into an Agent Graph, and the Atlas Reasoning Engine runs that graph. The benefits follow: predictable paths, fewer model calls, so lower latency and cost, and a clear record of what ran. And the model still handles what it does best: understanding, judgment, and writing.
Logic or model
Here is the rule of thumb. Whatever you can express as code belongs in logic, such as a condition, a variable, or an action filter. Every model call you do not need adds latency, cost, and variability, so keep the model for understanding messages, judging ambiguous requests, and writing replies in the right tone.
Canvas and Script View
Agentforce Builder shows the same agent in two views. Canvas is visual: you work with blocks, type a slash for common patterns like if and else, and an at sign to refer to subagents, actions, and variables. Script View shows the Agent Script itself, with highlighting, completion, and validation. A change in one view appears in the other, because both edit the same script.
Logic around the model
Inside a subagent's instructions, logic lines and prompt text can be mixed. The logic is resolved first, from top to bottom: conditions, actions to run, variables to set, and transitions. Only the prompt text of the branch that matches is sent to the model, so it never sees the branches that do not apply. Conditions use if and else, without an else if.
Before and after reasoning
A subagent can also run logic before and after the model reasons. Before reasoning runs at the start of each pass through the subagent, before the model sees anything, for example to load context or to check authentication. After reasoning runs once the model has responded, to check results, transition, or clean up. Neither block calls the model, and a transition belongs after reasoning, because one placed before can loop.
Filters
An action filter, written as available when, removes an action from the model's list of tools while its condition is false. It is a gate enforced by the platform, not a request to the model. Never let the model set the variable that opens a gate, because then the model holds the key. And if an action should run only once, shut its gate after it runs.
Variables
Variables are declared with a type, a default value, and a description, and they keep their state for the whole conversation. A mutable variable can change, and the model can fill it from the conversation, guided by its description. A linked variable takes its value from a source, such as the messaging session or the customer's contact, and cannot be changed. Binding action inputs to variables passes exact values, instead of values the model restates.
Template expressions
In prompt text, a template expression places the current value of a variable, such as the customer's first name, or the status of the installation. The model then reads the real value, instead of guessing it. Logic, on the other hand, reads variables directly, without a template expression.
Recap
Let's recap. Hybrid reasoning puts rules in logic and judgment in the model, which makes agents predictable, faster, and auditable. Canvas and Script View edit the same Agent Script, which compiles into an Agent Graph. Logic is resolved first, and only the matching prompt text goes to the model, while before and after reasoning run without it. Available when filters are gates the platform enforces, and the model must never hold their key. Variables keep state, and template expressions put their values into the prompt.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Which of Sunmeadow’s requirements belongs MOST clearly in deterministic logic, rather than in a prompt instruction?
- Reply to worried customers in a warm tone
- Understand a vague description of a fault
- Explain warranty terms in simple words
- Orders above a set amount go to a manager
Show the answer
Orders above a set amount go to a manager
A fixed threshold that always routes to a manager is a rule, so a condition enforces it every time. “Reply to worried customers in a warm tone” is wrong, because a warm tone is a matter of writing, which is the model's job. “Understand a vague description of a fault” is wrong, since understanding a vague description needs the model's judgment. And “Explain warranty terms in simple words” is wrong, because explaining terms in simple words is generation, not a rule.
Each time the warranty subagent runs, the customer’s installation record must be loaded, before the model sees anything. Where should this go?
- In the subagent’s before reasoning
- In the subagent’s after reasoning
- In a prompt instruction to look it up
- In the system block’s welcome message
Show the answer
In the subagent’s before reasoning
Before reasoning runs at the start of each pass, without the model, which is the place to load context. “In the subagent’s after reasoning” is wrong, because after reasoning runs once the model has already responded. “In a prompt instruction to look it up” is wrong, since an instruction asking the model to look it up leaves the step to its judgment. And “In the system block’s welcome message” is wrong, because the welcome message is shown at the start of the conversation, and loads no data.
Book Visit must never be offered before the customer is verified, and the verification action sets a verified variable. Which mechanism fits?
- A prompt instruction to book only verified customers
- An available when filter on the verified variable
- Let the model set the verified variable itself
- A template expression that shows the verified status
Show the answer
An available when filter on the verified variable
An available when filter on the verified variable keeps the action out of the model's tools until verification succeeds. “A prompt instruction to book only verified customers” is wrong, because a prompt instruction is a request, which the model follows most of the time, not every time. “Let the model set the verified variable itself” is wrong, since a model that sets the gate variable could open the gate by itself. And “A template expression that shows the verified status” is wrong, because a template expression shows a value to the model, but does not block any action.