Sub topic 6
Writing Clear, Specific, Testable Instructions
This chapter assumes you can open Agentforce Builder, find a topic, and preview a conversation. It also assumes you know what a classification description and a scope are, from earlier chapters. Here the focus is the instructions field. Instructions are the text that shapes how the agent behaves after it has chosen your topic.
Why instruction wording decides behavior
Once the agent selects a topic, a large language model reads that topic's instructions together with the conversation so far. It then decides what to say and which action to run. The model does not execute your instructions like code. It treats them as guidance, and it follows guidance better when the guidance is concrete.
Vague instructions fail in a predictable way. "Be helpful and accurate" gives the model nothing to act on, so it falls back on its defaults. Those defaults vary from one conversation to the next. That variation is why a topic can look fine in one preview and fail in the next.
A good instruction has four properties:
- Specific. It names what the agent does, in words a reviewer can point to in a transcript.
- Observable. You can tell from the conversation whether the agent followed it.
- Conditional where needed. It says when it applies.
- Single-purpose. It asks for one behavior, so a failure points to one sentence.
If you can't check an instruction against a transcript, it isn't testable yet. Rewrite it.
Replace goals with behaviors
A goal says what you want to be true. A behavior says what the agent does. The model can only act on behaviors.
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 weak version contains two goals, "helpful" and "no mistakes". Neither can be checked. The stronger version has four steps. Each one can be checked in a test conversation:
- Did the agent ask for the order number when the customer omitted it?
- Did the lookup happen before the status was stated?
- Is the answer one or two sentences, with both status and date?
- When the number was wrong, did the agent decline to guess?
Notice that step 4 pairs a failure condition with an exact response. That pairing matters. Most real defects come from unhandled cases, not from the happy path.
The properties in practice
Be specific about the verb
Replace soft verbs such as "handle", "help with", "consider", and "try to" with a verb that names an action: ask, look up, tell, offer, confirm, transfer, refuse.
| Vague | Specific |
|---|---|
| Handle shipping questions well. | Give the carrier name and the expected delivery date. |
| Try to confirm the customer's identity. | Ask for the email address on the order before sharing any order details. |
| Consider offering a transfer. | If the customer asks for a refund, offer to transfer them to a human agent. |
| Keep answers short. | Answer in one or two sentences unless the customer asks for more. |
The last row shows a useful rule for style instructions. Replace an adjective ("short") with a limit the model can measure ("one or two sentences").
Make each instruction observable
Ask of every sentence: what would I see in a transcript if the agent obeyed this? "Understand the customer's frustration" produces nothing you can see. "If the customer says the order is late, acknowledge the delay in one sentence before giving the status" does.
Tone instructions are the exception that needs care. You can't fully observe "friendly". Either define it through behavior ("Greet the customer by first name once, at the start") or move tone guidance to agent-level instructions, where it applies everywhere. A later chapter covers that split.
Order steps that depend on each other
When a sequence matters, number the steps and keep the dependency explicit. Step 2 above says "before describing its status". Without that phrase, the model may state a status from earlier conversation context and skip the lookup. Order words such as "first", "before", and "only after" are cheap and effective.
Keep one behavior per instruction
Compare these two versions:
Combined:
Ask for the order number, look up the order, and if it is delayed apologize and offer a discount code, otherwise give the delivery date.
Split:
1. Ask the customer for their order number if they have not provided one.
2. Look up the order using the order number.
3. If the order is delayed, apologize once and give the new delivery date.
4. If the order is not delayed, give the delivery date.The combined version also contains a quiet error. It tells the agent to offer a discount code that no action or policy supports. Splitting the sentence exposed that, because the split version had no natural place for the offer. When instructions are short and separate, unsupported promises are easier to spot.
State conditions as if-then pairs
Write conditional behavior as "If X, then Y". Give each condition one outcome.
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 name. In your org, use the exact name of an action assigned to the topic. The first instruction names an action and the input it needs. The second names a refusal, an exact alternative, and the reason the topic is declining. Referencing actions is covered fully in the next chapter. For now, note that a condition without a defined outcome ("If the customer is upset...") leaves the model to improvise.
Say what to do, not only what to avoid
Negative instructions have a place. "Do not guess a status" is a clear prohibition tied to a specific risk. But a prohibition alone leaves a gap, because the agent still has to say something. Pair each "do not" with the replacement behavior.
Gap:
Do not discuss refunds.
Filled:
If the customer asks about a refund, say that refunds are handled elsewhere and offer to transfer them to a human agent. Do not state refund eligibility or amounts.Also avoid long lists of prohibitions. Each extra "never" adds a rule the model must weigh against the others, and lists of them tend to contradict each other. If you find yourself writing many, check whether the topic's scope is too broad.
Avoid conflicting and duplicated rules
Conflicts are the second most common cause of erratic behavior. They tend to appear when several people edit the same topic.
Conflict:
1. Always ask for the order number first.
2. If the customer gives a tracking number, look up the shipment immediately.If a customer opens with a tracking number, the two lines disagree, and the model will pick one without telling you. Resolve it by stating the precedence: "Ask for the order number first, unless the customer has already provided a tracking number."
Duplicates are a milder problem. If the same rule appears in the topic and at the agent level with slightly different wording, you now have two sources to keep in sync. State each rule in one place.
Write the test next to the instruction
The practical method is to draft each instruction together with the utterance that would prove it works. If you can't think of such an utterance, the instruction is probably too vague.
A small table of pairs makes a handy test plan for the order status topic:
| Instruction | Test utterance | Expected observation |
|---|---|---|
| Ask for the order number if not provided. | "Where is my stuff?" | The agent asks for the order number and does not state a status. |
| Look up the order before describing status. | "Order 10482, has it shipped?" | The lookup runs, then the status is given. |
| Give status and date in one or two sentences. | "Order 10482, when will it arrive?" | Reply is short and includes both. |
| If not found, say so and don't guess. | "Order 00000" | The agent says it can't find the order and asks the customer to check the number. |
Edge cases to test deliberately
Realistic utterances are not enough. Add inputs that stress the wording:
- Missing information. The customer leaves out a required input, as in "Where is my stuff?"
- Wrong or malformed input. An order number with a typo, or one that belongs to no order.
- Mixed requests. "Where is my order, and can I return it?" This tests whether the topic's redirect instruction fires for the part it can't handle while still answering the part it can.
- Pushback. The customer repeats a request after the agent declined. Check that the agent holds its position and doesn't drift.
- Phrasing variants. Say the same intent three ways, including short and sloppy versions such as "order 10482 status".
Test one change at a time. If you rewrite three instructions and the behavior improves, you won't know which edit worked, and if it worsens you won't know which one broke it. Keep a note of each wording change and its result.
Output from a language model can vary between runs. Run an important test utterance more than once before you decide an instruction works. An instruction that passes once and fails twice is not reliable.
A review checklist
Before you save a topic, check each instruction against these questions:
- Does it start with a concrete verb?
- Could you point to a transcript line that proves it was followed?
- Is any condition paired with exactly one outcome?
- Does each prohibition have a replacement behavior?
- Does it contradict another instruction in this topic or at the agent level?
- Does it refer to an action by its exact name, and does that action exist on the topic?
- Do you have at least one normal and one edge-case utterance for it?
Exercise
Rewrite this instruction so it is specific, observable, and testable, then name one test utterance for it: "Handle delayed orders with empathy and offer a good solution."
Show answer
One valid rewrite is: "If the order status is delayed, apologize once in one sentence, give the new expected delivery date, and offer to transfer the customer to a human agent if they ask for compensation." The vague parts, "empathy" and "good solution", became a one-sentence apology, a named piece of information, and a defined offer. A test utterance is "Order 10482 was supposed to arrive Monday. Where is it?" using an order that is in a delayed state. You would check for a single apology, the new date, and no invented compensation. Other rewrites are fine if they name behaviors you can see in a transcript.
Exercise
These two instructions are in the same topic. Identify the problem and fix it. (1) "Always answer in one sentence." (2) "When giving shipping details, list the carrier, the tracking number, and the delivery date, with a short explanation of each."
Show answer
They conflict. A single sentence can't hold a list with explanations, so the model will follow one and drop the other unpredictably. Fix it by stating precedence or by narrowing one rule, for example: "Answer in one or two sentences, except when giving shipping details. For shipping details, list the carrier, tracking number, and delivery date, one per line." The fix also removes the vague phrase "short explanation" and replaces it with a defined format.