Sub topic 12
Aligning Actions with Topic Instructions
This chapter assumes you have read the earlier chapters on action metadata, required inputs, output design, output visibility, and error reporting. It also assumes you can open a topic in Agentforce Builder and edit its instructions. The chapter covers how the topic's instructions and the action definitions work together, and what goes wrong when they disagree.
Two sets of text, one decision
An agent does not read an action definition alone. When a customer sends a message, the agent works within a topic. It reads the topic's classification description, scope, and instructions. It also reads the labels, descriptions, and input and output metadata of every action assigned to that topic. It then decides what to say or which action to call.
So two sources of text guide each action call:
- Action metadata travels with the action. It describes one capability: what it does, what each input means, and what each output contains.
- Topic instructions belong to the topic. They describe how to handle a category of requests: the order of steps, what to say, and what to avoid.
If the two agree, the agent has one consistent picture. If they conflict, the agent has to pick one, and you cannot predict which it will follow. Most "the agent ignores my action" reports come from this kind of conflict, not from a defect in the action.
Deciding where each piece of guidance lives
A useful rule is that the action describes itself, and the topic describes how to use it in context.
| Guidance | Where it belongs | Example |
|---|---|---|
| What the action does and when it applies in general | Action description | "Looks up the status of one order by its order number." |
| What an input means and its format | Input description | "The order number the customer provided, for example 00000101." |
| What an output contains, including when it is empty | Output description | "Empty if no order was found." |
| The sequence of steps across several actions | Topic instructions | "Look up the order before offering a return." |
| Tone, wording, and policy for this category of request | Topic instructions | "Never promise a delivery date." |
| What to do after a specific result | Topic instructions | "If the message says no order was found, ask the customer to re-check the number." |
Keep each fact in one place. If the format of the order number appears in both the input description and the topic instructions, someone will change one and forget the other. Then the agent sees two formats.
Aligning on inputs
The input description in the earlier Apex example already says: "Ask the customer if it was not given. Do not guess." The topic instructions should support that rule, not weaken it.
A conflicting instruction would look like this:
When the customer asks about an order, call Get Order Status right away.
Use the most recent order if no number is given.The input is marked required, and its description says not to guess. The topic tells the agent to guess. The agent may follow either one, and the result can be the status of the wrong order, shown to the wrong customer.
A better version states the collection step and refers back to the same concept the action uses:
When the customer asks where their order stands:
1. If they have not given an order number, ask for it.
2. Call Get Order Status with that number.
3. Tell the customer the status in one sentence.Three habits help here:
- Use the same names. If the input label is "Order Number", write "order number" in the topic. Do not alternate with "order ID" or "reference". The agent matches meaning from words, so inconsistent words weaken the match.
- Do not restate defaults you have already set. If an input is required, the topic does not need to say "always collect the order number". It only needs to cover what the action cannot know, such as which question to ask first when two inputs are missing.
- Mention inputs the agent can take from context. If another action or the conversation already supplies a value, say so, for example "Use the account from the conversation. Do not ask for it again." Otherwise the agent may ask for something it already has.
Aligning on outputs and visibility
Output visibility settings decide what the agent can see and what appears in the conversation. Topic instructions should match those settings.
Suppose the message output is visible to the agent, and a second output holding internal notes is hidden from the user. The topic should not tell the agent to quote the internal notes. Likewise, if an output is displayed to the user automatically, an instruction such as "Repeat the full result to the customer" produces the same text twice.
Write instructions about outputs by role:
After Get Order Status returns:
- Use the Order Status value to answer the question.
- Do not mention internal field names such as OrderNumber.
- Do not add details that are not in the result.The last line matters. An agent that has a status but no delivery date may try to be helpful and estimate one. A short instruction to stay within the returned data reduces that risk. It does not remove it, so the action should also return only what you are willing to have repeated.
Aligning on errors and empty results
The error chapter showed that the action should return a plain-language message for the not-found case. The topic instructions decide what the agent does next. The action reports the situation, and the topic supplies the recovery step.
If Get Order Status reports that no order was found:
- Say that no order matches that number.
- Ask the customer to check the number and try once more.
- If the second attempt also finds nothing, offer to connect them to a person.
- Do not retry the action with a different number you made up.Two details are worth noting. First, a limit on retries ("once more") keeps the agent from looping. Second, the final line addresses a failure mode where the agent invents a plausible number after an empty result.
The topic cannot fix an action that returns nothing useful. If the response has no message and the status is empty, the topic instruction "if no order was found" has no signal to match. The action must make the not-found case visible, and the topic then reacts to it.
The flow of a single request
The diagram shows where each source of text is used during one customer request.
Both decision points use both sources of text. If either source is vague or contradicts the other, that decision becomes unreliable.
Common misalignments
| Symptom | Likely cause | Fix |
|---|---|---|
| Agent guesses a required value | Topic tells it to use a default, or a description does not forbid guessing | Remove the default from the topic and add "Do not guess" to the input description |
| Agent asks for a value it already has | Topic does not say where the value comes from | Add an instruction naming the source |
| Agent never calls the action | Topic scope does not include the request, or instructions describe a different workflow | Align the topic description and instructions with the action's description |
| Agent calls the wrong action | Two actions have overlapping descriptions and the topic does not separate them | Distinguish them in their descriptions and state in the topic when to use each |
| Agent repeats information twice | Topic says to repeat a result that is already shown | Match the instruction to the visibility setting |
| Agent invents data after an empty result | Topic has no recovery step | Add a not-found branch and a "do not make up values" line |
Keeping instructions short
Topic instructions are read on every turn within the topic. Long instruction lists dilute the important lines and raise the chance of internal conflicts. Some practical limits:
- Write one instruction per behavior. Split compound sentences.
- Describe the normal path first, then the exceptions.
- Delete instructions that only repeat an action description.
- Prefer concrete conditions ("if no order was found") over vague ones ("if something goes wrong").
If you find yourself writing long instructions to compensate for an action, fix the action first. Moving a rule into the input or output description is usually more reliable than adding another topic sentence.
Checking alignment before you test
Before you run conversations, read the topic instructions and the action metadata side by side and check four things:
- Every input name used in the topic matches an input label.
- Every output the topic refers to exists and is visible to the agent.
- No topic instruction contradicts a "required" setting or an input description.
- Every empty or error result the action can return has a matching recovery line in the topic.
Then run test conversations in the builder's preview and look at how the agent used the action. Compare which values it passed in with what you expected, and note any where it deviated. Change one thing at a time, either an action description or a topic line, so you can tell which change fixed the behavior. The next chapter covers this testing loop in detail.
Exercise
A topic's instructions say "If the customer does not give an order number, use their most recent order." The Order Number input is required and its description says "Do not guess." Name the problem and rewrite the instruction.
Show answer
The topic contradicts the input description, so the agent may guess and return the status of the wrong order. Rewrite it to match the action, for example: "If the customer has not given an order number, ask for it before calling Get Order Status." If you really want a most-recent-order behavior, build it as a separate action with its own description instead of overriding the required input.
Exercise
The action returns an empty status and a message, "No order was found with number 00000999." The agent then tells the customer their order is "probably being processed." Which two places should you check, and what would you change?
Show answer
Check the topic instructions and the output descriptions. The topic probably lacks a not-found branch, so add one that says to report that no order matches, ask the customer to check the number, and not to make up a status. Also confirm the Result Message output is visible to the agent and that the Order Status description says "Empty if no order was found," so the agent can recognize the empty case.