Sub topic 7
Scoping an agent with topics
This chapter assumes you know basic Salesforce administration (users, profiles, permission sets), and that you know what an Agentforce agent, a topic, and an action are. It covers how topics set the boundaries of what an agent will try to do.
What a topic does
A topic is a category of work the agent can handle. Each topic has three parts:
- A name and classification description. The agent uses these to decide which topic fits the customer's message.
- Scope. This is a statement of what the topic covers.
- Instructions and actions. These are the rules the agent follows and the tools it can use once the topic is chosen.
The topic is the first guardrail. The agent can only use the actions attached to the topic it selected. If a request matches no topic, the agent should decline or escalate instead of improvising.
Topics limit behavior. They do not limit data access. The agent user's permission sets decide what the agent can read and change. A topic that is too broad on top of a permissive agent user gives the agent both the means and the room to do the wrong thing.
Designing a narrow topic
Start from the job the agent has to do, then write the smallest topic that covers it. For an order status agent, one topic is enough: "Order Status".
| Field | Weak choice | Better choice |
|---|---|---|
| Name | Customer Help | Order Status |
| Scope | Help with anything about the customer's account | Answer questions about the status of the customer's own orders |
| Actions | Every action in the org | Get Order Status |
Keep these points in mind:
- One topic should cover one job. If a topic needs many unrelated actions, split it.
- Write the scope as a boundary, not a theme. "Answer questions about order status" says what is in. Add what is out in the instructions.
- Make classification descriptions distinct. If two topics have overlapping descriptions, the agent may pick the wrong one, and the wrong topic can expose the wrong actions.
- Attach only the actions the topic needs. An action not attached to a topic cannot be called from it.
Out-of-scope requests
Plan what happens when a customer asks for something no topic covers. Refunds are a common example. You have two options:
- Leave refunds without a topic, so the agent has no way to act on them.
- Add an explicit topic whose only job is to tell the customer a human will take over, and route it to escalation.
The second option is more predictable, because the response is written by you instead of being left to the model.
The instructions for the Order Status topic can state the boundary directly:
Only answer questions about the status of the customer's own orders.
Never share information about other customers.
Never offer refunds, price changes, or account changes. If the customer asks for one, tell them you are transferring them to a human agent.
If you cannot find the order, say so and ask the customer to confirm the order number.The next chapter covers how to write instructions like these.
Common errors
- A catch-all topic. A topic such as "General Questions" invites the agent to answer anything. Remove it unless you want that behavior.
- Treating topics as security. A topic does not stop a user or an attacker from steering the conversation. Permissions on the agent user and user-mode checks in actions are the real enforcement.
- Overlapping topics. Two topics that both mention "orders" can split traffic unpredictably. Test with realistic wording.
- Too many actions per topic. Each extra action widens what a misrouted conversation can do.
Exercise
A support agent has one topic named "Customer Help" with the scope "Help with anything the customer asks". It has the Get Order Status action and an action that updates account details. Name two changes that would narrow the agent's scope.
Show answer
Split the topic so that order status and account changes are separate, with the scope of each written as a specific job (for example "Order Status" covering only the customer's own orders). Then attach only the needed action to each topic, and remove the account update action from any topic that does not need it. Add an instruction to escalate refund and account change requests to a human.