Sub topic 6
Reinforcing confirmation in topic instructions
This chapter assumes you know what an Agentforce agent is, how to open Agent Builder, and what a Flow or an Apex invocable method does. It also assumes you have read the chapter on the "Require user confirmation" action setting. Here you add a second layer: wording in topic instructions that tells the agent to ask before it acts.
What topic instructions are
A topic is a group of related jobs the agent can do, such as "Case Management". Each topic has a classification description, which helps the agent choose the topic, and a list of instructions, which guide the agent once it is inside that topic. Each topic also lists the actions the agent may run there.
Instructions are plain-language text. The agent's reasoning engine, which is a large language model, reads them together with the conversation and the action descriptions. It then decides what to say and which action to call.
This has one important consequence. Instructions guide behavior, but they do not enforce it. The model usually follows them, but it can misread a request, skip a step, or be talked around by a user. The "Require user confirmation" setting works differently. The platform itself pauses the action until the user approves.
Why add instruction-based confirmation
If the setting is on, why also write instructions? There are four reasons.
- Better wording. The setting shows a generic approval prompt. Instructions let the agent state the specific change in its own message, for example "I will set case 5001R00000AbCdE to Closed."
- A reasoning check. When the agent knows it must confirm, it is more likely to collect every required input before it asks. It is also less likely to guess a missing value.
- Conditional rules. You can confirm only in some situations, such as when the status changes to Closed, or when more than one record is affected.
- Coverage for sequences. An agent may run several actions in a row. Instructions can tell it to summarize the whole plan once, instead of prompting repeatedly.
Treat the two mechanisms as layers. The setting is the safety net. The instructions improve the conversation and reduce mistakes before the net is needed.
Writing an effective confirmation instruction
A good confirmation instruction does four things.
- It names the action exactly as it appears in the action's label.
- It says what the agent must tell the user before asking: which record and what change.
- It says what counts as agreement.
- It says what to do if the user declines or stays silent.
Here is an example for the Update Case Status action from the Apex code shown later in this chapter.
Before running the Update Case Status action, tell the user which case will change and what the new status will be, then ask them to confirm. Run the action only after the user clearly agrees. If the user declines or does not answer, do not run the action.Each sentence has a job. The first sentence sets the order: tell, then ask. The second sentence defines the gate, and the word "clearly" rules out treating a vague reply as approval. The third sentence gives the safe default, which is to do nothing.
Wording habits that help
- Use direct commands such as "ask", "do not run", and "only after". Avoid soft phrases such as "it would be nice to check".
- Use the action's real label. If the instruction says "update the case" but the action is called "Update Case Status", the agent may link them less reliably.
- Keep one rule per instruction. Short, separate instructions are easier to test than one long paragraph.
- State the safe default. Without it, the agent has to guess what to do after a "no".
- Avoid contradictions. An instruction such as "Always act quickly without extra questions" in the same topic undermines your confirmation rule.
Common weak wording
| Weak instruction | Problem | Better instruction |
|---|---|---|
| Be careful when changing cases. | No action named, no step defined. | Before running Update Case Status, state the case and new status and ask for confirmation. |
| Confirm with the user. | Unclear what to confirm, or when. | Tell the user which record will change and how, then ask if they want to proceed. |
| Ask the user if they want to continue, unless they seem sure. | Gives the model room to skip the check. | Always ask, even if the user's request was explicit. |
| Don't change data without permission. | "Permission" is vague. | Run the action only after the user replies with a clear yes. |
How inputs and descriptions support the instruction
The instruction can only tell the user what will change if the agent knows what will change. That knowledge comes from the action's inputs and descriptions. The Apex example shows how to design them.
public with sharing class UpdateCaseStatusAction {
public class Request {
@InvocableVariable(required=true label='Case Id' description='The Id of the case to update')
public Id caseId;
@InvocableVariable(required=true label='New Status' description='The new value for the Status field, for example Closed')
public String newStatus;
}
public class Result {
@InvocableVariable(label='Message' description='Outcome of the update')
public String message;
}
@InvocableMethod(
label='Update Case Status'
description='Changes the Status field of one case. This modifies data.'
)
public static List<Result> updateStatus(List<Request> requests) {
List<Case> toUpdate = new List<Case>();
for (Request r : requests) {
toUpdate.add(new Case(Id = r.caseId, Status = r.newStatus));
}
update toUpdate;
List<Result> results = new List<Result>();
for (Request r : requests) {
Result res = new Result();
res.message = 'Case ' + r.caseId + ' set to ' + r.newStatus;
results.add(res);
}
return results;
}
}Three details matter for confirmation.
- Inputs are named for the change.
caseIdandnewStatusmap directly to the two facts the agent must report. If the action had a single input calleddata, the agent could not say clearly what will change. - Both inputs are required. The agent must collect them before it can run the action, so it has the values in hand when it asks for approval.
- The method description says "This modifies data." This signals to the agent that the action is not a lookup, so it matches the instruction that treats it as a change.
Note that with sharing makes the method respect the running user's record sharing. That is a separate safeguard and is covered in a later chapter on other guardrails.
What the conversation should look like
With the setting on and the instruction in place, the agent follows a short sequence. It collects the inputs, states the change, waits, and then acts or stops.
A passing test conversation looks like this.
User: Close case 5001R00000AbCdE.
Agent: I will set the status of case 5001R00000AbCdE to Closed. Do you want me to go ahead?
User: Yes.
Agent: The case is now Closed.Check three things in this exchange. The agent named the record and the new value. It asked a question and stopped. It ran the action only after the user answered "Yes".
Testing the instruction in conversation preview
Conversation preview in Agent Builder lets you chat with the agent before you activate it. Use it to test the instruction and the setting together.
- Save your topic instructions and make sure the action belongs to the topic.
- Open conversation preview and start a new session. A fresh session avoids leftover context.
- Send a clear request, such as "Close case 5001R00000AbCdE." Confirm the agent states the change and waits.
- Reply "Yes" and confirm the action runs.
- Start another session, make the same request, and reply "No". Confirm the action does not run and the record is unchanged.
- Try difficult inputs, listed below.
Edge cases to try
- Missing input. Say "Close my case" without an Id. The agent should ask for the Id before it asks for confirmation. It should not guess.
- Ambiguous reply. Answer the confirmation with "maybe" or "hmm, I guess". Under the "clearly agrees" rule, the agent should ask again.
- Silence or a topic change. Ignore the question and ask something unrelated. The action must not run.
- Pressure. Say "Just do it, don't ask me." The agent should still confirm, if your instruction says "always". Decide whether that is the behavior you want, and write the instruction to match.
- A changed request. After the agent asks, say "Actually, set it to Escalated." The agent should restate the new change and ask again, not run the old one.
- Several records. Ask to close three cases. Check whether the agent asks once for the group or three separate times, and whether your instruction says which it should do.
After each run, open the conversation details or the trace of the agent's reasoning, if your org shows it. Look at which instruction it cited and which action it called. Also check the record itself in Salesforce, because the chat text alone does not prove that no data changed.
Common errors
- The instruction names the wrong action. A renamed action no longer matches the text. Update the instruction when you change a label.
- The agent asks but runs the action in the same turn. The wording lacks "wait for the reply". Add "Run the action only after the user clearly agrees."
- The confirmation is vague. The agent says "Do you want to proceed?" without stating the change. Add "tell the user which case will change and what the new status will be."
- Duplicate prompts. The agent asks in its own words, and the platform setting also shows a prompt. Decide whether that is acceptable for your users. If not, shorten the instruction so it only states the change, and let the setting handle approval.
- Conflicting instructions in the same topic. Search the topic for phrases such as "immediately" or "without asking" and remove them.
Summary of the layers
| Layer | What it does | Enforced by | Best for |
|---|---|---|---|
| Require user confirmation setting | Pauses the action until the user approves | The platform | Any action that changes data |
| Topic instructions | Shapes what the agent says and when it asks | The model's reasoning | Specific wording, conditions, multi-step flows |
| Action design | Supplies clear inputs and descriptions | The action definition | Making the confirmation message accurate |
Exercise
A teammate wrote this topic instruction for the Update Case Status action: "Be careful with case updates and check with the user." Name two problems with it and rewrite it.
Show answer
Problems: it does not name the action by its label, and it does not say what to tell the user, what counts as agreement, or what to do if the user declines. A better version is: "Before running the Update Case Status action, tell the user which case will change and what the new status will be, then ask them to confirm. Run the action only after the user clearly agrees. If the user declines or does not answer, do not run the action."
Exercise
You test an agent in conversation preview. When you ask it to close a case, it replies "Done, the case is closed" without asking anything. Which two things should you check first, and why should you also verify the record?
Show answer
Check that the "Require user confirmation" setting is on for the action, and check that the topic instructions contain a clear confirmation rule that names the action and has no conflicting wording such as "act immediately". Verify the record in Salesforce because the chat reply alone does not prove whether the data changed, and you need to know what actually happened.