Cert++
Close

Template expressions in agent instructions

Key Takeaway

Agentforce replaces {!@variables.name} in prompt text with the variable's actual value before the LLM reasons. Instructions resolve from top to bottom, so run the action that sets a variable in the logic section above the prompt line that references it.

Reasoning instructions tell an Agentforce agent how to handle a conversation inside a subagent. They mix deterministic logic with natural language prompts. In the prompt text, references such as {!@variables.name}, {!@actions.name} and {!@subagents.name} insert real data or point the LLM to a specific resource. Agentforce resolves these references before any LLM reasoning starts, so the LLM receives concrete, predictable instructions.

Logic instructions and prompt instructions

Reasoning instructions have two parts: logic instructions and prompt instructions.

Logic instructionsPrompt instructions
What it isDeterministic or conditional expressionsNatural language for the LLM
What it doesChecks requirements, runs actions and sets variablesPassed to the LLM if its conditions are met
When it appliesBefore reasoning: what the agent must doDuring reasoning: what the agent should take into account
StrengthReliably handles workflow and business rulesMore flexibly guides conversation
How it's writtenExpressions such as if, run and setText after the | (pipe) command
Variable referenceBare, as in @variables.postal_codeWrapped, as in {!@variables.postal_code}

The pipe command allows indented multiline text. Prompt instructions can come before or after the logic instructions.

Agentforce Specialist Study Guide

Checklist progress

0/204Learned

Given a use case, manage deterministic behavior for the agent using mechanisms like filters, variables, and template expressions.

0/8

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Agentforce Specialist studiers.