Sub topic 5
Topics and Instructions in Brief
This chapter assumes you know what an Agentforce agent is, can open Agent Builder, and have a basic grasp of Salesforce records and of Flow or Apex invocable methods. It covers how topics and topic instructions shape what an agent does. A later chapter uses them to reinforce confirmation.
What a topic is
A topic is a group of related work that the agent can handle. Each topic has these parts:
- A name and a classification description. The agent uses these to decide which topic fits the user's request.
- A scope. This states what the topic does and does not cover.
- Instructions. These are plain-language rules for how the agent behaves inside the topic.
- Actions. These are the Flows, Apex invocable methods, and prompt templates the agent may run in this topic.
When a user sends a message, the agent first picks a topic. It then reasons using only that topic's instructions and actions. An action that is not attached to the selected topic is not available to the agent for that turn.
What topic instructions do
Topic instructions are natural-language guidance. They tell the agent when to use an action, in what order to do things, and how to talk to the user. Examples:
- "Always look up the case before changing it."
- "Use a polite, brief tone."
- "Never share the internal notes field."
Instructions are read by a language model. The agent weighs them when it reasons, but they are not code. This has a practical consequence. The agent usually follows an instruction, but the wording can be interpreted, and the result can vary between conversations. A clear, specific instruction is followed more reliably than a vague one.
Writing useful instructions
Good instructions are short, concrete, and about one behavior each. Compare these two:
| Weak instruction | Better instruction |
|---|---|
| Be careful with cases. | Before running Update Case Status, tell the user which case will change and what the new status will be. |
| Handle updates properly. | Run Update Case Status only after the user clearly agrees. |
The better versions name the action, state the condition, and say what the user will see. Keep these habits:
- Use the exact action names as they appear in Agent Builder.
- Describe one rule per instruction.
- State the condition, then the behavior.
- Avoid absolute words you do not mean. "Never" and "always" are read literally.
Instructions versus action settings
Instructions and action settings both influence behavior, but they work differently.
| Row | Topic instructions | Action settings |
|---|---|---|
| Form | Natural-language text | A configured option on the action |
| Enforced by | The agent's reasoning | The platform |
| Predictability | Usually followed, can vary | Applied consistently |
| Good for | Tone, ordering, wording | Behavior that must always happen |
This difference matters for the rest of the tutorial. The "Require user confirmation" setting is an action setting. Confirmation wording in instructions is the reasoning layer. They work together, and neither fully replaces the other.
Where actions get their meaning
An action brings its own text with it. The agent reads the action's name and description, and the labels and descriptions of its inputs. For an Apex invocable method, these come from the annotations:
@InvocableMethod(
label='Update Case Status'
description='Changes the Status field of one case. This modifies data.'
)
public static List<Result> updateStatus(List<Request> requests) {
// method body omitted
}The phrase "This modifies data" is a signal to the agent that the action has side effects. Instructions in the topic can then refer to the action by its label, "Update Case Status", and the two pieces of text support each other.
Common mistakes
- Instructions that name an action incorrectly. If the topic says "Close Case" but the action is labelled "Update Case Status", the agent has to guess that they match.
- Putting too many rules in one topic. Long instruction lists dilute each rule. Split unrelated work into separate topics.
- Relying on instructions alone for rules that must never be broken. Instructions guide the agent. They do not guarantee the outcome.
- Vague scope. If two topics overlap, the agent may select the wrong one, and then the wrong instructions apply.
Check your understanding
Exercise
A topic contains the instruction "Be careful when changing cases." Name two problems with this instruction and rewrite it so it is more reliable.
Show answer
It is vague, because it does not say what "careful" means, and it does not name an action or a condition. A better version is: "Before running Update Case Status, tell the user which case will change and the new status, then run the action only after the user clearly agrees." It names the action, states the condition, and describes what the user will see.
Exercise
Why can an instruction not replace an action setting for a rule that must always hold?
Show answer
Instructions are interpreted by the agent's reasoning, so they are usually followed but can vary. An action setting is applied by the platform, so it behaves consistently.