1.3 Hybrid Reasoning: Agent Script in Canvas View and Script View
Key Takeaways
- Hybrid reasoning mixes deterministic logic and natural-language prompt text in the same Agent Script instruction block.
- Agentforce Builder opens agents in Canvas view, which summarizes Agent Script into blocks and uses / for inline actions and @ for resources.
- Script view lets advanced users edit Agent Script directly with syntax highlighting, autocompletion, and validation.
- Edits are consistent across Canvas and Script views, but Script view changes with errors can make Canvas view unavailable until fixed.
- An agent version must be committed before activation, and committed versions can't be edited; you create a new draft instead.
1.3 Hybrid Reasoning: Agent Script in Canvas View and Script View
Quick Answer: Hybrid reasoning is Salesforce's term for combining programmatic expressions (conditions, variables, transitions, deterministic actions) with natural-language instructions in the same Agent Script block. Logic handles workflow and business rules predictably, and the LLM handles conversation. Agentforce Builder exposes the same script in Canvas view (a visual, block-based editor) and Script view (direct code editing).
Why Hybrid Reasoning Exists
Prompt-only agents create a familiar enterprise problem. You can instruct an LLM to verify a customer before sharing order details, but you can't guarantee it will follow that sequence every time. Adding more instructions often makes things worse. Salesforce's context-engineering guidance names three failure patterns:
| Problem | What it looks like | Hybrid reasoning fix |
|---|---|---|
| Context clash | Conflicting instructions produce unexpected behavior | Use conditions so only the instructions that apply are resolved into the prompt |
| Context confusion | Too much irrelevant content or too many tools slows the agent and makes it inconsistent | Filter subagents and actions with variables, so the LLM sees only what's relevant now |
| Context poisoning | Incorrect or outdated information erodes trust | Load authoritative data with deterministic actions and store it in variables |
Components of hybrid reasoning
- Logic instructions (
->):if/elseconditions,runactions,setvariables, andtransition toanother subagent. They execute in order, exactly as written, before reasoning. - Prompt instructions (
|): natural-language guidance, personalized with template expressions such as{!@variables.member_name}. - Reasoning actions: tools and utilities the LLM may choose, including transitions, escalation, and setting variables. Each can carry a filter (
available when). - Variables: reliable state storage, so the agent doesn't depend on the LLM remembering a value.
after_reasoning: deterministic logic that runs after the reasoning loop, such as a mandatory transition.- Model override: a subagent can use a different model than the agent default. Model override is available only for agents created in the new builder.
Benefits the exam expects you to explain
- Predictability for critical steps. Identity verification, eligibility checks, and required lookups run every time.
- Smaller, more relevant prompts. Only the instructions that apply are resolved, which improves accuracy and reduces latency.
- Reliable sequencing (action chaining). You can guarantee action A runs before action B and pass A's output into B through variables.
- Flexible conversation. The LLM still handles phrasing, clarifying questions, and judgment where rules don't apply.
- Easier troubleshooting. Deterministic paths are visible in the script and in the trace.
A Before-and-After Example
Prompt-only instruction (fragile):
| If the customer is a Gold member and their order is more than 30 days old,
| offer store credit. Otherwise explain the return policy.
| Always check the loyalty tier first.
The LLM has to remember to check the tier, interpret "more than 30 days," and choose a branch.
Hybrid version (reliable):
reasoning:
instructions: ->
if @variables.loyalty_tier == None:
run @actions.get_loyalty_tier
with contact_id = @variables.ContactId
set @variables.loyalty_tier = @outputs.tier
if @variables.loyalty_tier == "Gold":
| Thank {!@variables.customer_name} for being a Gold member.
if @variables.days_since_order > 30:
| Explain that the order is outside the 30-day window and offer store credit.
else:
| Offer to start a return with @actions.create_return.
The lookup always happens and the date rule is applied by logic. The LLM receives only the one or two sentences that apply to this customer.
Canvas View
When you open an agent in Agentforce Builder, it opens in Canvas view. You see a view-only visual summary of the agent's details, router, and subagents. To edit, open a subagent or action page, or switch to Script view.
| Canvas feature | What it does |
|---|---|
| Blocks | Summarize Agent Script into readable pieces that expand to show the underlying script |
/ shortcut | Inserts inline actions: conditional statements, transitions, set a variable, run an action |
@ shortcut | Inserts resources: subagents, actions, and variables, which resolve like merge fields |
| Actions available for reasoning | Holds utilities (transition, escalate, set variables), filters ("Make this action available when:"), and follow-up actions ("After this action is run:") |
| Console | Lists errors and warnings. You can commit with warnings but not with errors |
| Agentforce assistant | Generates or refines Agent Script from natural-language requests; you accept or decline changes |
| Markdown | Formats instruction text; pasted Markdown is supported |
Script View
Script view is for advanced users who want to write Agent Script directly, with syntax highlighting, autocompletion, and validation. Key rules:
- Your configuration is consistent across both views; they're two representations of the same script.
- On save, the builder validates both views. Errors are underlined in Canvas, and Script view shows more detail.
- Some Script view changes can make Canvas view unavailable until you fix the errors in Script view.
- On macOS, Option+M switches between views.
- Developers can also work outside the browser: Agentforce DX retrieves the
.agentfile into a Salesforce DX project for VS Code, where the extension supports Agent Script editing and validation.
Versioning in the New Builder
| State | What you can do |
|---|---|
| Draft | Edit, save, preview in Simulate or Live Test mode. You can't activate a draft |
| Committed | A snapshot saved to metadata, similar to a Git commit. It can't be edited and can be activated |
| New draft from a committed version | Continue iterating; compare versions and copy improvements between them |
A version must be committed before it can be activated. To change a committed or active agent, create a new draft, test it, commit it, and then activate it.
Legacy Builder vs. New Builder
| Legacy Agentforce Builder | New Agentforce Builder | |
|---|---|---|
| Authoring model | Topic fields (classification description, scope, instructions) and action settings | Agent Script, shown in Canvas and Script views |
| Deterministic control | Filters and variables in a Context panel | Logic instructions, filters, transitions, follow-up actions, after_reasoning |
| Creating new agents | Not available starting the week of July 13, 2026 | Where new agents are built |
| Newer features | Limited (for example, voice agents, MCP tools, and multi-agent orchestration require the new builder) | Supported |
Exam Traps
- "Hybrid" doesn't mean two separate agents. It means logic and prompts in the same instruction block.
- Canvas and Script views aren't separate configurations. An edit in one appears in the other.
- You can't activate a draft. Commit first.
- Put sensitive business rules in logic or in the action itself, not in prompt text alone. Salesforce's guidance is that instructions are nondeterministic and don't replace coded business rules.
What does Salesforce mean by hybrid reasoning in Agentforce?
An admin editing in Canvas view wants to insert an if/else condition into a subagent's reasoning instructions. Which shortcut opens the inline actions menu?
A developer makes changes in Script view and can no longer open Canvas view. What is the most likely explanation?
An agent draft passes preview testing. What must happen before the agent can be activated?