Sub topic 11
Choosing the Right Control for Each Action
What this chapter assumes
This chapter pulls together the earlier ones. It assumes you can already do the following:
- Tell an action that reads data from one that changes it.
- Turn on Require user confirmation for an action in Agent Builder.
- Write topic instructions that mention a confirmation step.
- Run a test conversation in conversation preview.
The question now is which control to use for which action. Confirmation is one control among several. It suits some actions well and others poorly.
The controls you have
An agent action can be protected at four levels. They differ in who enforces them.
| Control | Enforced by | What it does | What it cannot do |
|---|---|---|---|
| Require user confirmation setting | The platform, when the action is about to run | Pauses the action until the user approves | Check that the request was understood correctly, or that the user read the summary |
| Confirmation wording in topic instructions | The language model, by following guidance | Shapes how the agent summarizes and asks | Guarantee the agent asks every time |
| Permissions and sharing | The platform, on every data operation | Limits which records and fields the running user or agent can touch | Distinguish a good request from a bad one by someone who has access |
| Validation and action design | Your Flow, Apex or validation rules | Rejects bad values and limits what the action can do at all | Ask the user anything |
The first two are about intent: did the user mean this? The last two are about limits: what can happen even if the intent was wrong or the agent made a mistake. A complete design usually needs both kinds.
Settings are deterministic, instructions are not
The setting is a platform feature. When it is on, the action does not run until the user approves. Instructions are text that the model reads and interprets. A model that follows instructions well will usually comply, but "usually" is the wrong standard for a delete action.
This gives a practical rule:
- If skipping confirmation would be a real problem, use the setting. Instructions can reinforce it, but they cannot be the only control.
- Use instructions for things the setting cannot express: which details to include in the summary, how to phrase the question, what to do when the user declines.
Permissions apply whether or not anyone confirms
Confirmation does not change what an action is allowed to do. If the action runs with broad access, a confirmed request can still change records you never meant the agent to touch. Limits on access are the safety net behind the confirmation step.
Criteria for deciding
Ask these questions about each action, in this order.
- Does it change data? A read-only action usually needs no confirmation. Check that it is truly read-only. An Apex method that looks like a lookup but also writes a log record or updates a "last viewed" field is a data-changing action.
- Can the change be undone? Changing a case status can be reversed by changing it back. A hard delete, a sent email, a payment, or a record owner change that triggers notifications cannot be reversed so easily.
- How far does one call reach? An action that updates one record by Id has a small blast radius. An action that accepts a filter and updates every match has a large one.
- Who is the user? An employee using an internal agent can be trusted to read a summary. A customer-facing agent may need stricter limits, because customers can phrase requests in unexpected ways and you control the agent's permissions, not the customer's intent.
- How often does the action run? If an action runs ten times in one task, confirming each time wears users down. They start clicking yes without reading, and the control stops working.
- Can the inputs be wrong in a way the user will not notice? If the agent guesses an Id or picks one of several similar records, the confirmation must show enough to expose the mistake.
Decision flow
The "lighter control" branch is a judgment call. Many teams turn on the setting for every data-changing action. That is a safe default, and you only need to relax it when confirmation prompts become a measurable annoyance.
Applying the criteria to real actions
| Action | Changes data? | Reversible? | Reach | Suggested controls |
|---|---|---|---|---|
| Look up case details | No | Not applicable | Read of one record | None beyond field and record access |
| Draft a reply with a prompt template | No (draft only) | Not applicable | None | None. Confirm separately before any send action |
| Update case status | Yes | Yes | One record | Setting on, instructions to name the case and new status |
| Reassign case owner | Yes | Partly, notifications may fire | One record | Setting on, summary names old and new owner |
| Delete a record | Yes | No | One record | Avoid exposing it. If needed: setting on, restricted permission, narrow Apex |
| Update all open cases for an account | Yes | Hard to reverse in bulk | Many records | Setting on, cap the number of records, summary states the count |
Two points are worth drawing out.
A prompt template that drafts text is not the same as sending it. Keep the draft and the send as separate actions, and confirm the send. That way the user reviews the actual text before it leaves.
Deleting is often better removed than confirmed. If the business case for agent-driven deletion is weak, do not build the action. An action that does not exist cannot be misused, and it is the strongest least-privilege control available.
Limiting what the action can do
Confirmation checks the user's intent. The code behind the action should still refuse anything outside its purpose. The Apex method from earlier in the tutorial accepts any string as a status. The version below narrows it, and runs the update with the user's permissions.
public with sharing class UpdateCaseStatusAction {
private static final Set<String> ALLOWED_STATUSES =
new Set<String>{ 'Working', 'Escalated', 'Closed' };
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='One of: Working, Escalated, 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 to Working, Escalated or Closed. This modifies data.'
)
public static List<Result> updateStatus(List<Request> requests) {
List<Result> results = new List<Result>();
List<Case> toUpdate = new List<Case>();
for (Request r : requests) {
Result res = new Result();
if (!ALLOWED_STATUSES.contains(r.newStatus)) {
res.message = 'Status ' + r.newStatus + ' is not allowed. No change made.';
} else {
toUpdate.add(new Case(Id = r.caseId, Status = r.newStatus));
res.message = 'Case ' + r.caseId + ' set to ' + r.newStatus;
}
results.add(res);
}
if (!toUpdate.isEmpty()) {
update as user toUpdate;
}
return results;
}
}Three changes matter here:
- The allowed list means a confused agent cannot set a status you never intended it to use.
update as userenforces the running user's object and field permissions. It throws an exception if they lack access, instead of silently writing the data.- Each result matches its request in order, so the agent can report accurately what happened to each case.
The description also lists the allowed values. The agent reads descriptions when it decides what to collect, so the description and the validation should agree.
Combining controls
Layers add up. For the case status action, a reasonable stack looks like this:
- The action exists only because the business needs it (design).
- Its code allows three statuses and one record per request (validation).
- It runs with the permissions of a user who can edit cases but not delete them (permissions).
- Require user confirmation is on (platform setting).
- The topic instruction says to name the case and the new status before asking (wording).
- Conversation preview tests confirm the sequence, including the decline path (testing).
If one layer fails, another still holds. If the model ignores the wording, the setting still pauses the action. If the user approves a wrong summary, the allowed list and permissions still limit the damage.
Failure modes to watch for
- Confirmation fatigue. If every small step asks for approval, users stop reading. Group related changes into one action with one summary where it makes sense, and save prompts for changes that matter.
- Vague summaries. A prompt that says "Update the record?" confirms nothing. The summary must name the record, the field, and the new value. That depends on action inputs that carry that information, as covered in the chapter on action design.
- Hidden side effects. A Flow that updates a case and also sends an email asks the user about only one of the two. Describe all effects in the action description, or split the Flow.
- Chained actions. An agent may run a lookup, then an update. The lookup needs no confirmation, but the update does. Check that the confirmation shows the values the lookup returned, not just what the user typed.
- Instruction-only designs. If the only control is a sentence in a topic, a changed prompt, a model update, or a long conversation can weaken it. Keep the setting on for anything that matters.
- Untested decline path. Teams test that approval works and forget that declining must stop the action. Test both.
- Drift over time. Someone adds an input to the Flow, or widens its filter, and the confirmation summary no longer reflects what happens. Retest after each change to the action.
A short review process
Before releasing an agent that can change data, walk through each data-changing action with this list:
- What exactly can this action change, in the worst case?
- Does the action's code or Flow enforce that limit, or does it only rely on the agent behaving?
- Which permission set does the agent run with, and could it be narrower?
- Is Require user confirmation on? If not, write down why.
- Does the summary name the record, the field, and the new value?
- Have you tested approve, decline, silence, and a changed mind in conversation preview?
The answers go into your release notes, so the next person to change the action knows which controls the design depends on.
Exercise
An agent has three actions: "Get Order Status" (reads one order), "Cancel Order" (sets the order to Cancelled and triggers a refund), and "Update Shipping Notes" (appends text to a notes field on one order). Which controls would you choose for each, and why?
Show answer
Get Order Status: no confirmation, because it only reads. Keep record and field access narrow. Cancel Order: the change triggers a refund, so it is hard to undo. Turn on Require user confirmation, add topic instructions that name the order and say a refund will start, restrict the action to a single order Id, and run it with a user who has only the permissions needed. Update Shipping Notes: low risk and reversible, but it still changes data, so the setting is a reasonable default. If confirmation prompts are too frequent for this action, you could rely on a clear description, a length limit in the code, and instructions, as long as you document the choice.
Exercise
A teammate says: "We wrote in the topic instructions that the agent must always ask before deleting a record, so we don't need to turn on the setting." Give two reasons this is risky and one fix.
Show answer
First, instructions are guidance to the language model, not a platform rule, so the agent may occasionally skip the step. Second, instructions do not limit what the action can do, so a mistaken or approved request can still delete data the agent should never reach. A fix: turn on Require user confirmation for the delete action, keep the instruction to shape the wording, and either remove the delete action or restrict it with permissions and a narrowly scoped Apex method.
Exercise
Why does the Apex example use both an allowed-status list and update as user, when the action already asks for confirmation?
Show answer
Confirmation checks that the user meant the change. It does not stop a wrong value from being used or a user from changing data they lack access to. The allowed list limits which values can be written, and update as user makes the update respect the running user's permissions. They protect against errors that the confirmation step cannot catch.