Sub topic 6
Topic instructions: guiding the agent's reasoning
This chapter assumes you know basic Salesforce concepts (objects, fields, records), can find your way around Setup, and have a general idea of what a large language model does. You should also have read the earlier chapters on topics, classification descriptions, and scope.
What topic instructions do
Once the agent has picked a topic, the topic's instructions tell it how to handle the request. The classification description and scope decide whether a request belongs to the topic. The instructions decide what the agent does next.
The agent reads the instructions together with the conversation and the list of available actions. It then plans its next step: ask a question, run an action, or reply. The instructions are guidance for a language model, not code. The agent follows them closely, but it interprets them, so vague text gives uneven results.
Instructions compared with scope
Scope states what the topic is for and what it cannot do. Instructions state the steps for the work that is in scope. Keep the two separate. If you put "never cancel orders" in the instructions and also in the scope, you now have two places to update when the rule changes.
An example
This is the instruction set for the Order Status topic:
1. Ask the customer for their order number if they have not given one.
2. Use the Get Order Status action with that order number.
3. If the action returns 'Not found', tell the customer you could not find the order and ask them to check the number.
4. Otherwise, state the status in one sentence.
5. Never share details about orders that belong to other customers.Each line does one job:
- Step 1 handles missing input before any action runs.
- Step 2 names the action and the value to pass to it.
- Step 3 handles a failure result with a specific reply.
- Step 4 sets the format of a normal reply.
- Step 5 is a guardrail. It applies at every step, not only the last one.
Common errors
| Problem | Example | Fix |
|---|---|---|
| Vague wording | "Be helpful with orders." | Say what to do: "State the status in one sentence." |
| No result handling | Runs the action, says nothing about errors | Add a step for each result you expect, such as "Not found". |
| Several rules in one line | "Ask for the number, look it up, and reply." | Split into one step per line so each can be tested. |
| Action named loosely | "Check the order." | Use the exact action label, such as Get Order Status. |
| Rules that contradict the scope | Instructions describe refunds in an order status topic | Move that work to its own topic. |
| Too long | Dozens of steps and edge cases | Keep the core path short. Move rarely used cases to their own topic. |
Checking your instructions
Read each step and ask three questions:
- Can the agent tell when this step applies?
- Does the step name the action or the information it needs?
- Could a tester tell from a conversation whether the agent followed it?
If the answer to any of these is no, rewrite the step. Later chapters cover how to run these checks in Builder's testing tools.
Exercise
An Order Status topic has this instruction: "Look up the order and tell the customer about it." Name two problems with it and rewrite it as ordered steps.
Show answer
It does not say what to do when no order number is given or when the lookup finds nothing, and it does not name the action or the reply format. A better version: 1. Ask for the order number if the customer has not given one. 2. Use the Get Order Status action with that number. 3. If it returns 'Not found', say you could not find the order and ask the customer to check the number. 4. Otherwise, state the status in one sentence.