Sub topic 5
What Instructions Do Once a Topic Is Selected
This chapter assumes you know the following:
- You can open Agentforce Builder and preview a conversation.
- You know that an agent has topics and that topics have actions.
- You have seen the three text fields on a topic: the classification description, the scope, and the instructions.
The earlier chapters covered how the agent picks a topic. This chapter covers what happens after that choice, and what the instructions field does and does not do.
The job of instructions
Instructions are natural-language guidance that the agent reads while it handles a request inside a selected topic. The classification description answers "is this request mine?" Instructions answer "now that it is mine, how do I handle it?"
Instructions play no part in choosing the topic. If a request lands in the wrong topic, rewriting that topic's instructions will not fix it. The cause is in the classification descriptions and scopes, which earlier chapters cover. Instructions come into play only after the choice is made.
Once a topic is selected, the agent works from a prompt built from several pieces:
- The topic's scope.
- The topic's instructions.
- The actions assigned to the topic, with their names and descriptions.
- The agent-level instructions.
- The conversation so far.
The language model reads all of these and decides what to do next. It might ask the customer a question, run an action, or write a reply. After an action returns, the model reads the result and decides again, until it has a reply to send.
The diagram shows that instructions steer several decisions in one turn: what to ask, when to run an action, and how to word the answer. They are guidance for the model, not a program that runs.
What instructions can control
Well-written instructions influence these things:
- Order of steps. For example, collect the order number before looking anything up.
- When actions run. For example, look up the order before describing its status.
- What to do with missing or unexpected information. For example, ask again, or say the order was not found.
- Boundaries inside the topic. For example, decline to promise a delivery date that the system did not return.
- Form of the reply. Length, tone, and which details to include.
- Handoff behavior. For example, offer a human agent when the customer asks for something outside the scope.
A single instruction usually pairs one condition with one behavior. That makes it easy to test later: you can write a conversation that triggers the condition and check for the behavior.
What instructions cannot guarantee
A language model reads instructions as guidance. It usually follows them, but it does not execute them like code. Three consequences matter in practice.
- Compliance is likely, not certain. The same instruction can be followed in nine test conversations and missed in the tenth, especially when the customer's wording is unusual.
- More instructions dilute each one. A long list gives the model more to weigh. Important rules can get less attention when they are buried among minor ones.
- Instructions cannot force an outcome the system does not support. If no action can cancel an order, an instruction saying "cancel the order" gives the agent nothing to do it with. The agent may then invent a plausible but false reply.
The chapter on deterministic logic covers how to decide where a rule belongs. For now, remember the split: instructions shape behavior, and logic enforces rules.
Instructions compared with neighboring fields
Each field on a topic has a different job. Mixing them up is a common source of confusing behavior.
| Field | Question it answers | Used when |
|---|---|---|
| Classification description | Is this request about this topic? | Choosing the topic |
| Scope | What will this topic do and not do? | Choosing the topic and bounding the work |
| Instructions | How should the agent handle the request? | After the topic is selected |
| Actions | What can the agent actually do or look up? | When the model decides to run one |
Two points follow from the table. First, instructions should not repeat the scope. If the scope already says the topic does not process refunds, the instructions only need to say what to do when a customer asks for one. Second, instructions can only direct the agent toward actions that are assigned to the topic.
A worked example
Here is a topic for order status, written the way the spine recommends. The classification description and scope are already set. Only the instructions are shown.
Topic name: Order Status
Instructions:
1. Ask the customer for their order number if they have not provided one.
2. Use the Get Order Status action with the order number before describing the order's status.
3. Give the current status and the expected delivery date in one or two sentences.
4. If the order cannot be found, say so and ask the customer to check the number. Do not guess a status.
5. If the customer asks to cancel, change, or return an order, tell them you can't do that in this topic and offer to transfer them to a human agent.Walk through what each line does.
- Line 1 sets the order of steps and handles missing information.
- Line 2 names an action and says when to run it. Get Order Status is a hypothetical name here. In your org, use the exact name of an action assigned to the topic.
- Line 3 sets the form of the reply, with an observable limit: one or two sentences.
- Line 4 covers a failure case and prohibits one specific bad behavior, guessing.
- Line 5 handles out-of-scope requests and gives the agent something to do instead of just refusing.
Every line can be checked in a test conversation. Compare this with the weak version, "Be helpful with orders and don't make mistakes." A reviewer cannot tell from a transcript whether that instruction was followed.
How the agent reads a list of instructions
Several habits make instructions easier for the model to follow and for you to maintain.
One idea per instruction
If a line contains three conditions and two behaviors, the model may apply only part of it, and you will not know which part failed. Split it into separate lines.
Hard to test:
If the customer gives an order number and the order has shipped but the delivery date is missing, or the order is delayed, explain the status and apologize and offer to transfer.
Easier to test:
1. If the order has shipped but no delivery date is returned, say the date is not available yet.
2. If the order status is Delayed, apologize once and give the new delivery date if one is returned.
3. If the customer asks for more detail than the action returns, offer to transfer them to a human agent.Name the condition and the behavior
"Handle returns carefully" has neither. "If the customer asks to return an item, tell them you can't process returns in this topic" has both.
Avoid conflicts
Conflicting instructions are a frequent cause of erratic behavior. Two lines such as "Always answer in one sentence" and "Explain the full shipping history" cannot both be satisfied. The model resolves the conflict in ways you cannot predict, and the result can change from one conversation to the next. Conflicts can also exist between a topic and the agent-level instructions, for example a topic that says to be casual while the agent-level instructions require formal language. Read both sets together when you review.
Describe behavior, not internals
Instructions should say what the agent does in the conversation. They should not describe how the system works behind it. The customer-facing outcome is what you can observe and test.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Agent describes a status without looking it up | No instruction ties the lookup to the reply | Add "use the action before describing the status" |
| Agent invents a status when the order is missing | No failure-case instruction | State what to say and add "Do not guess" |
| Agent runs the wrong action | Condition is vague, or the action name does not match | Name the exact action and the condition |
| Agent ignores one rule in a long list | Too many instructions, or a conflict | Shorten the list and remove contradictions |
| Agent attempts something out of scope | Scope and instructions do not say what to do instead | Add an instruction that declines and offers a handoff |
| Topic never gets chosen | Problem is in the classification description | Fix the description, not the instructions |
The last row is worth remembering. When you are unsure whether a problem is routing or handling, check which topic was selected in the preview first. If the topic is right and the behavior is wrong, edit instructions. If the topic is wrong, edit descriptions.
A short checklist
Before you finish writing a topic's instructions, check each point.
- Every line states a condition and a behavior, or a step in a sequence.
- Every action named is assigned to this topic, and the name matches exactly.
- The failure case, such as not found or missing data, has its own line.
- No line restates the scope or contradicts it.
- No rule that must always hold is enforced only by an instruction.
- A test conversation exists for each line.
Exercise
A topic's instructions say "Look up the order and tell the customer the status." In preview, the agent sometimes answers with a status before running any action, and for an unknown order number it invents a status. Rewrite the instructions to fix both problems, and say which kind of problem this is: routing or handling.
Show answer
This is a handling problem. The topic was selected correctly, so the classification description is not at fault. A better version: 1. Ask the customer for their order number if they have not provided one. 2. Use the Get Order Status action with the order number before describing the status. 3. If the order cannot be found, say so and ask the customer to check the number. Do not guess a status. The first fix ties the lookup to the reply, and the second adds an explicit failure case with a prohibition.
Exercise
Your instructions include "Refund the customer if the order arrived damaged, up to $100." Why is this a poor use of an instruction, and where should the rule live?
Show answer
Instructions only guide the model, so the $100 limit can be missed or misapplied. The agent also may have no action that issues refunds. The limit should be enforced in deterministic logic, such as a Flow or Apex action that checks the amount and refuses anything above $100. The instruction can then say when to call that action and what to tell the customer when it declines.