Sub topic 6
Writing Clear, Specific, Testable Instructions
Once the agent has selected a topic, the topic's instructions shape what it says and does. This chapter covers how to write instructions you can check in a test conversation.
This chapter assumes you know what an Agentforce topic is, you can open Agentforce Builder and preview a conversation, and you have already written a classification description and scope for your topic.
Why vague instructions fail
An instruction like "Be helpful with orders and don't make mistakes" gives the agent nothing to act on. It names no behavior, so you cannot tell from a conversation whether the agent followed it. Two people reading it would also disagree about what it requires.
A useful instruction has three properties:
- Specific: it names the behavior, such as "ask for the order number" instead of "gather information".
- Ordered: when steps depend on each other, the order is written down.
- Testable: you can read a test conversation and say yes or no to "did it do this?"
Compare weak and strong wording
Here is the same goal written two ways.
Weak:
Be helpful with orders and don't make mistakes.
Stronger:
1. Ask the customer for their order number if they have not provided one.
2. Use the order number to look up the order before describing its 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.The stronger version has four changes:
- Each line is one behavior. Step 1 only asks for the number. Step 2 only does the lookup.
- The order is explicit. The lookup comes before the description of the status, so the agent does not describe an order it has not found.
- Output is bounded. "One or two sentences" is something you can count.
- The failure case is covered. Step 4 says what to do when the lookup finds nothing, and forbids guessing.
If you can draw your instructions as a flow like this one, they are probably specific enough. If a step cannot become a box or a branch, it is probably too vague.
Write conditions and behaviors in pairs
Many instructions work best as "if this, then that." State the condition and the one expected behavior.
If the customer asks for the status of an order, use the Get Order Status action with the order number.
If the customer asks to return an item, tell them you can't process returns in this topic and offer to transfer them to a human agent."Get Order Status" is a hypothetical action name. In your own topic, use the exact name of an action assigned to that topic. Referencing actions is covered in more detail in a later chapter.
The second line is worth noticing. It tells the agent what to do at the edge of the topic's scope, instead of leaving it to improvise a refusal or attempt something the topic should not do.
Practical rules for wording
- Use plain verbs. "Ask", "look up", "tell", "offer", "transfer".
- Say what to do, not only what to avoid. "Do not guess a status" works because step 4 also says what to do instead.
- Keep one idea per instruction. If a line contains "and" joining two different behaviors, consider splitting it.
- Use numbers for sequences and plain lines for independent rules. Numbering tells the agent that order matters.
- Replace adjectives with observable limits. Change "keep it short" to "one or two sentences".
- Avoid contradictions. "Always confirm before looking up an order" and "Look up the order immediately" cannot both be followed.
Check that each instruction is testable
For every instruction, write the test conversation that would show it working, and one that would show it failing.
| Instruction | Passing test | Failing test |
|---|---|---|
| Ask for the order number if not provided | "Where is my order?" leads to a request for the number | The agent describes a status without asking |
| Look up the order before describing its status | The action runs, then the status is given | The status is stated before any lookup |
| Do not guess a status for an unknown order | Number "000" gets a not-found reply | The agent invents a plausible status |
If you cannot describe a failing test, the instruction is probably too loose to enforce. Rewrite it until you can.
Common errors
- Goals instead of behaviors: "Provide excellent service" cannot be checked.
- Hidden order: steps are listed in a paragraph with no sequence, so the agent may act in a different order.
- No failure path: the instructions describe only the case where everything works.
- Overlong lists: many marginal rules can bury the important ones. Keep what changes behavior.
Exercise
Rewrite this instruction so it is specific, ordered, and testable: "Handle return questions well and be polite." Assume the topic can explain the return window (30 days) but cannot process returns. Then name one test utterance that would check your rewrite.
Show answer
One possible answer: 1. If the customer asks about returning an item, tell them returns can be requested within 30 days of delivery. 2. If the customer asks you to start or process a return, tell them you can't process returns in this topic and offer to transfer them to a human agent. 3. Keep each reply to three sentences or fewer. Test utterance: "Please start a return for my order." Expected result: the agent says it cannot process returns here and offers a transfer, rather than attempting the return. Any rewrite is acceptable if each step names an observable behavior, the order or conditions are clear, and the out-of-scope request has a defined response.
Exercise
A topic instruction says "Look up the order. Always ask for the order number first." What is wrong, and how would you fix it?
Show answer
The two lines conflict about order: a lookup needs the number, but the lookup is listed first. Fix it by putting them in sequence: "1. Ask for the order number if the customer has not provided one. 2. Use the order number to look up the order."