Sub topic 17
Human approval for high-impact actions
This chapter assumes you can call a chat-style LLM API and have read the earlier chapters on tools, excessive agency, and least privilege. Least privilege limits what an agent can do. Human approval covers the actions that must stay available but are too risky to run without a person confirming them.
Why approval is a control, not a feature
An injected instruction can make the model request any tool call that the application exposes. You cannot reliably stop the model from being persuaded. You can stop the application from executing the request without a decision from a person.
Approval works because it sits outside the model. The model proposes an action. Ordinary code decides whether the action runs. A person makes the decision for high-impact cases. Text in a document cannot talk the approval gate into skipping the check, because the gate is not reading the document.
Deciding which actions need approval
Not every tool call needs a person. If everything asks for confirmation, users stop reading the prompts. Classify each tool by its worst-case effect.
| Class | Examples | Policy |
|---|---|---|
| Read-only, low sensitivity | search public docs, get order status | Run automatically |
| Read-only, sensitive data | read a mailbox, fetch customer records | Run, but log. Consider approval if the result can leave the system |
| Reversible writes | create a draft, add a label | Run automatically, with an undo path |
| Irreversible or external | send email, issue refund, delete data, change permissions, deploy | Require approval |
| Not needed by the app | shell access, arbitrary HTTP | Do not expose |
Two questions help with classification. Can the action be undone? Does it send data or money outside your trust boundary? A "yes" to the second or a "no" to the first usually means approval.
A deny-by-default gate
The policy must be enforced in code that the model cannot influence. This version refuses unknown tools by default.
READ_ONLY_TOOLS = {"search_docs", "get_order_status"}
NEEDS_APPROVAL = {"send_email", "issue_refund"}
def run_tool_call(name, args, tools, approve):
"""Run a model-requested tool call under a deny-by-default policy."""
if name in READ_ONLY_TOOLS:
return tools[name](**args)
if name in NEEDS_APPROVAL and approve(name, args):
return tools[name](**args)
raise PermissionError(f"Tool call not permitted: {name}")The approve callback is where the person enters the loop. It receives the exact tool name and arguments that will run. It returns True only after an explicit decision.
What the approval prompt must show
A confirmation is only as good as the information in it. Common mistakes make approval useless.
- Showing the model's description instead of the real arguments. If the dialog says "Send a summary to the team" but the recipient is
[email protected], the user approves an attack. Render the actual recipient, amount, and body from the arguments. - Showing a summary written by the model. The model may be under the attacker's influence, so its summary can lie. Generate the display text from structured fields in code.
- Hiding the reason. Show which input led to the request when you can, such as "triggered while reading
invoice.pdf". An unexpected source is a strong warning sign. - Truncating the dangerous part. Long email bodies and URLs hide payloads at the end. Show the full value or make it one click away.
A minimal terminal implementation builds the display from the arguments:
import json
def approve_cli(name: str, args: dict) -> bool:
"""Ask a human to confirm a tool call, showing the real arguments."""
print(f"Tool requested: {name}")
print(json.dumps(args, indent=2, ensure_ascii=True))
answer = input("Run this action? [y/N] ").strip().lower()
return answer == "y"Using ensure_ascii=True escapes non-ASCII characters. This prevents look-alike characters in a domain name from appearing identical to a trusted one. The default answer is "no", so pressing Enter denies the action.
Binding approval to the exact action
Approval must apply to one specific call. Otherwise an attacker can change the arguments after the person has agreed.
- The model proposes a call.
- The application freezes the arguments and shows them.
- The person approves.
- The application executes those same frozen arguments, not a fresh model output.
Do not let the model re-issue the call after approval and treat the earlier "yes" as covering it. Avoid blanket approvals such as "always allow send_email". A standing permission turns a single injection into a repeated one.
Failure modes
Approval is weaker than it looks. Plan for these problems.
- Approval fatigue. People click "yes" on repeated prompts. Keep prompts rare by reserving them for real high-impact actions, and make the risky details visible.
- Confused context. The person approves because the action looks plausible for the task. An injected "send the report to [email protected]" looks routine. Show the recipient prominently and consider allowlists for destinations.
- Chained low-risk actions. A sequence of automatic calls can add up to a high-impact result, such as reading private data and then fetching a URL that contains it. Gate the step where data leaves the system, not just the final write.
- Time of check versus time of use. If the approved arguments reference something that changes, such as a file path or a URL that redirects, the action can differ from what was approved. Resolve references before showing them.
- The approver is the attacker. If the approval message goes to the same channel the attacker controls, such as a chat thread the model summarizes, the attacker can answer it. Send approvals through a separate, authenticated interface.
Combining approval with other controls
Approval is one layer. Pair it with narrower tools, so the person reviews a small, understandable action. A tool refund_order(order_id, amount) with a hard cap is easier to review and safer than a general run_sql tool. Log every request, decision, and execution so that you can reconstruct an incident later. Add rate limits, so a burst of approval requests is itself a signal worth investigating.
Exercise
An email assistant has the tools search_mail (read-only), create_draft (reversible), and send_email (external). It summarizes an inbox, and one email contains a hidden instruction to forward the user's password-reset emails to an outside address. Which tools should require approval, and what must the approval prompt show to give the user a real chance to catch this?
Show answer
Only send_email needs approval. search_mail can run automatically with logging, and create_draft is reversible. The prompt must display the real recipient address, subject, and full body generated from the tool arguments in code, not a model-written summary. It should also name the message that triggered the request. A forward to an unfamiliar outside address would then be visible. The approved arguments must be frozen and executed exactly as shown.
Exercise
A developer adds the system prompt line "Ask the user before doing anything dangerous" and removes the code check, saying the model will handle it. Why is this unsafe?
Show answer
The instruction is only text in the same context as the attacker's text. An injected instruction can tell the model not to ask, or to claim approval was already given. The gate must be enforced in application code, which the model cannot change.