Sub topic 5
Topics and Instructions in Brief
This chapter assumes you know what an Agentforce agent is and have opened Agent Builder at least once. It also assumes you have seen a Flow or an Apex invocable method. Later chapters add confirmation to actions. Here you learn the two building blocks that confirmation is attached to: topics and topic instructions.
What a topic is
A topic is a group of related work that an agent can handle. It bundles three things: a description of the kind of request it covers, natural-language instructions for handling those requests, and the actions the agent may run while it is in that topic.
An agent for a support team might have a topic for case management, another for order status, and another for general questions about store policies. Each topic limits what the agent talks about and which actions it can reach. If an action is not assigned to the active topic, the agent will not run it in that conversation turn.
This is why topics matter for data safety. A topic is the first boundary around an action. An action that updates cases belongs in the case topic and nowhere else.
The parts of a topic
The labels in Agent Builder can change between releases. The roles below stay the same.
| Part | What it does | Who reads it |
|---|---|---|
| Name | A short label for the topic. | You, and the agent as a hint. |
| Classification description | Says what requests belong to this topic. | The agent, when it chooses a topic. |
| Scope | Says what the agent does and does not do in this topic. | The agent, while it works inside the topic. |
| Instructions | Rules for how to handle requests, in plain language. | The agent, at each reasoning step in the topic. |
| Actions | The Flows, Apex methods, and prompt templates the agent may run. | The agent, which picks among them. |
Two of these are easy to mix up. The classification description decides whether the agent enters the topic. The instructions decide how the agent behaves after it is in the topic. A confirmation rule belongs in the instructions, because it governs behavior inside the topic.
How a request moves through a topic
The agent does not run one fixed script. It reasons in steps. For each user message it first decides which topic fits, then reads that topic's instructions and actions, and then decides what to do next: ask a question, answer directly, or run an action. After an action returns, the agent reasons again with the result.
The loop from "Action returns a result" back to "Agent decides next step" explains one common surprise. After one action finishes, the agent may choose another one in the same turn. A rule that only says "confirm before updating" has to hold on every pass through that loop, not just the first.
What instructions are
Instructions are sentences you write in plain language. In Agent Builder you add them as separate entries in a topic, and the agent reads them as part of its reasoning input. They can describe:
- When to use an action ("Use Get Case Details when the user gives a case number").
- What to collect first ("Ask for the case number if the user has not given one").
- How to talk ("Keep answers under three sentences").
- What not to do ("Do not discuss refunds in this topic").
Instructions guide the agent. They do not enforce anything. The agent is driven by a large language model, so it follows instructions most of the time, but nothing in the platform guarantees it. A well-written instruction makes the desired behavior very likely. It does not make the undesired behavior impossible.
The distinction between guidance and enforcement shapes the rest of this tutorial. The action setting is enforced by the platform: the user is asked before the action runs. Instruction wording is read by the model and can fail in unusual conversations. The two controls complement each other.
Writing instructions that work
Use these practices. They are consistent with Salesforce's published guidance on topic instructions, and they hold up in testing.
- One idea per instruction. Short, separate entries are easier for the agent to apply than one long paragraph. They are also easier for you to debug.
- Say what to do, then what to avoid. "Ask for the case number before looking up a case" is clearer than "Never look up a case without a number."
- Use the exact action names. If the action is called Update Case Status, write that. A paraphrase such as "the update thing" can make the agent pick the wrong action.
- Avoid contradictions. If one instruction says "Always reply briefly" and another says "Always explain your reasoning in detail," the agent has to guess.
- State conditions explicitly. "If the user asks to change a case, then..." beats a vague sentence with no trigger.
- Keep the topic small. A topic with many actions and many instructions dilutes each one. If the instruction list keeps growing, split the topic.
Avoid pasting your internal procedure documents into the instructions field. The agent needs short behavioral rules. It does not need the background history of why a process exists.
A small worked example
Here is a topic for case work. The instructions below are plain text you would enter one at a time in Agent Builder.
Topic name: Case Management
Classification description: Handle requests to look up, summarize, or change the status of a customer support case.
Scope: Your job is to help the user with existing cases. You do not create new cases or handle billing questions.
Instructions:
1. If the user does not give a case number, ask for it before using any action.
2. Use Get Case Details to read a case. Do not change anything when the user only wants information.
3. Use Update Case Status only when the user asks to change the status of a case.
4. After an action runs, tell the user what happened in one or two sentences.
Actions:
- Get Case Details
- Update Case StatusRead the example as an agent would. A request such as "What's the status of case 00001234?" matches the classification description. Instruction 2 points to Get Case Details, which only reads. A request such as "Close case 00001234" matches instruction 3 and leads to Update Case Status, which modifies data.
Notice what is missing. Nothing in this topic asks the user to approve the change. The agent might run the update as soon as it has a case number and a new status. The next chapters fix that gap with the action setting and with a confirmation instruction. The gap is the reason this tutorial exists.
Common errors
These problems appear often when people first write topics.
| Symptom | Likely cause | Fix |
|---|---|---|
| The agent never enters the topic. | The classification description is too narrow or too vague. | Describe the requests in the user's own words. Test with several phrasings. |
| The agent enters the wrong topic. | Two classification descriptions overlap. | Make each description distinct, and state what each topic does not cover. |
| The agent ignores an instruction. | The instruction is buried in a long paragraph, or conflicts with another one. | Split it into its own short entry and remove the conflict. |
| The agent picks the wrong action. | Action names or descriptions are alike, or an instruction uses a different name. | Use clear, distinct action names and quote them exactly in instructions. |
| The agent cannot find an action. | The action is not assigned to the active topic. | Add the action to the topic that needs it. |
| Behavior changes between runs. | Instructions leave room for interpretation. | Make conditions explicit, then retest several times. |
The last row has a practical consequence. Run each important conversation more than once in testing. A single successful run does not show that an instruction is reliable.
Where topics fit in the confirmation story
Topics matter for confirmation in three ways.
- Grouping. Keeping data-changing actions in a small, dedicated topic makes it simple to attach confirmation wording to exactly those actions.
- Placement. A confirmation instruction goes in the topic that holds the action. An instruction in a different topic will not be loaded while the agent works in the topic that runs the update.
- Layering. The instruction tells the agent how to behave in conversation. The action setting makes the platform stop and ask. You usually want both for actions that change data.
Exercises
Exercise
A topic's classification description says "Handle anything about customers." Another topic's description says "Handle questions about orders." Users asking about order delays sometimes land in the wrong topic. What is the likely cause, and what would you change?
Show answer
The descriptions overlap. An order delay is also "something about customers," so the agent cannot reliably tell the topics apart. Rewrite each description to be distinct and say what the topic does not cover, for example "Handle lookups of customer contact details and account information. Do not handle order status." Then test with several phrasings of an order delay question.
Exercise
A teammate writes this single instruction: "Be helpful and always explain everything in detail but keep replies short, and use Update Case Status when needed and never change data without being sure." List two problems with it and show a better version.
Show answer
The instruction packs several ideas into one entry, and parts of it conflict ("explain everything in detail" versus "keep replies short"). It is also vague about when to use the action ("when needed," "being sure"). A better version splits it into separate entries, for example: "Keep replies under three sentences." and "Use Update Case Status only when the user asks to change the status of a specific case." Each entry now has one idea and a clear condition.
Exercise
Why is an instruction like "Ask the user before updating a case" not enough on its own to guarantee that the user is always asked?
Show answer
Instructions are guidance that the language model reads. The model usually follows them, but the platform does not enforce them, so an unusual conversation can still lead to the action running without a question. An action-level setting is enforced by the platform, which is why the confirmation setting and the instruction are used together.