Sub topic 1
Why Agents Need Both Fixed Rules and Model Judgement
Prerequisites
You should understand LLM-based agents, prompts, tools or actions, and conversation turns. You should also be comfortable with variables, if/else conditions, and indentation-based configuration.
Fixed Rules and Model Judgement
An LLM-based agent is probabilistic: it generates a likely response, so the same request can produce different wording or actions. Prompt text can guide the model, but it cannot guarantee that the model will ask for required information, call tools in order, or avoid an unsafe action.
Fixed rules provide deterministic behaviour. They are useful for steps that must always happen, such as checking an order number before looking up an order. Model judgement remains useful for interpreting the customer’s intent and producing a natural response.
What Agent Script Is
Agent Script is the scripting language used to define Salesforce Agentforce agents. It combines natural-language instructions with structured elements such as variables, conditions, actions, and topic transitions. The script defines the boundaries and required sequence; the model handles flexible conversation inside those boundaries.
A script can therefore make an agent partly deterministic without turning every response into a rigid decision tree.
Anatomy of an Agent Script File
An Agent Script file commonly contains:
- Configuration and system instructions that apply across the agent.
- Variables that hold state during a conversation.
- Topics that scope the work the agent can perform.
- A starting topic that routes the first request.
- Instructions, conditions, actions, and transitions inside topics.
Configuration and System Settings
Configuration establishes agent-wide behaviour. System instructions can define the agent’s role, communication style, and broad limits. Keep these settings general. Put workflow-specific requirements inside the relevant topic so they are easier to test and change.
Variables: Giving the Agent Memory
A variable is a named value that stores state across conversation turns. For example, order_id can hold the order number after the customer provides it. Later instructions can test whether that value is empty and either request it or continue with the lookup.
Variables connect fixed logic to the conversation. They let the script remember facts instead of relying on the model to reconstruct them from context.
Exercise
Why should an order-number requirement be implemented with a condition instead of only a prompt?
Show answer
A condition checks the variable deterministically, so the agent cannot skip the required check merely because the model produced a different response.