Sub topic 3
Topics and instructions: defining what an agent handles
An Agentforce agent is organized into topics. A topic is a unit of work the agent can take on, such as checking an order or summarizing open cases. This chapter assumes you know basic Salesforce concepts (objects, records, permission sets) and have a general idea of what a large language model does. It covers how to write a topic and its instructions. Actions are covered in the next chapter.
What a topic contains
Each topic has four parts:
- Name. A label for you and other admins.
- Classification description. A short sentence that helps the agent decide when this topic applies to a customer or employee request.
- Scope. A statement of what the topic does and does not cover.
- Instructions. Natural-language rules that tell the agent how to behave once the topic is selected, including which actions to call.
The classification description and the instructions do different jobs. The description is used to choose a topic. The instructions are used after a topic has been chosen.
Example: an Order Status topic
Topic: Order Status
Classification description: Customer asks where an order is or what state it is in.
Scope: Look up the status of a single order using the Get Order Status action.
Instructions:
- Ask for the order number if the customer has not given one.
- Call the Get Order Status action with that order number.
- Report only the status returned by the action.
- If the action returns 'Order not found', ask the customer to check the number once, then offer to connect them with a human agent.
- Do not discuss refunds or cancellations in this topic.Each line does a specific job:
- The first instruction handles missing input before the action runs.
- The second names the action to call, so the agent does not guess.
- The third limits the reply to returned data and discourages invented details.
- The fourth defines a failure path with a retry limit and an exit to a human.
- The last sets a boundary that keeps refund questions out of this topic.
Same structure for employee agents
An employee agent uses the same topic structure. The difference is the audience, not the format.
Topic: My Open Cases
Classification description: An employee asks about support cases assigned to them or their team.
Scope: Summarize cases the employee already has permission to view.
Instructions:
- Use the Get Open Cases action to retrieve cases for the current user.
- Present each case with its number, subject, and status.
- If the employee asks about data they cannot access, say that you cannot show it and suggest contacting their administrator.The instructions assume an internal user whose own permissions govern what the action can return. The instruction about inaccessible data describes how the agent should talk about a limit. It does not enforce the limit. Access is enforced by permissions and by how the action is built, a point the identity chapter returns to.
Common errors
- Overlapping descriptions. If two topics could both match a request, the agent may pick the wrong one. Write descriptions around distinct customer intents.
- Vague scope. A topic with no stated limits tends to absorb unrelated requests. State what is out of scope.
- Instructions that rely on rules for security. Text such as "never show other customers' orders" is guidance for the model. Enforce it in the action and in permissions.
- Too many instructions. Long, overlapping lists give the agent more chances to contradict itself. Keep each instruction to one behavior.
- Unnamed actions. If an instruction says "look up the order" without naming the action, the agent has to infer which one you mean.
Exercise
A customer asks about a refund, but the agent answers from the Order Status topic and starts discussing cancellations. Name two changes to the topic text that would help, and explain why an instruction alone is not enough to guarantee the agent never reveals another customer's order.
Show answer
First, add an out-of-scope line to the Order Status scope and instructions, such as "Do not discuss refunds or cancellations", and create or refine a separate topic whose classification description covers refunds so the request is routed there. Second, tighten the classification description so it covers only order location and state. An instruction alone is not enough for data protection because it only guides the model's wording. The real limit must come from the action (for example, a with sharing Apex class) and the permissions of the user the agent runs as.