Sub topic 15
Human approval for high-impact actions
This chapter assumes you can call an LLM through a chat-style API, read Python, and understand why untrusted input is dangerous. It also assumes you know the least privilege idea from the previous chapter: give an agent only the tools it needs.
Why approval belongs outside the model
Least privilege limits what an agent can do. Some useful tools still carry real risk, such as sending email, issuing refunds or deleting records. A successful injection can ask the model to call them. Human approval puts a person between the model's request and the action.
The check must run in your code, not in the prompt. A system prompt that says "ask the user before sending email" is an instruction, and an injected instruction can override it. A code path that refuses to run the tool until a person confirms cannot be talked out of it.
Deciding what needs approval
Sort each tool by the damage a wrong call could do.
| Tool type | Example | Policy |
|---|---|---|
| Read-only, low sensitivity | `search_docs`, `get_order_status` | Run freely |
| Reversible write | Create a draft | Run, log it |
| Irreversible or external | `send_email`, `issue_refund` | Require approval |
| Not on any list | Anything else | Deny |
The last row matters most. Use deny-by-default, so a new tool is blocked until someone classifies it.
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 function is a callback that asks a person and returns True or False. The model never sees or controls it.
The approval flow
Common errors
- Showing a vague prompt. "Allow the agent to continue?" tells the reviewer nothing. Show the tool name and the exact arguments, such as the recipient and the full message body. An injected call often hides in the arguments.
- Approving model-written summaries. Show the real call, not the model's description of it. A compromised model can describe a call as harmless.
- Approval fatigue. If people approve dozens of prompts a day, they click yes without reading. Keep the approval list short and reserve it for actions that matter.
- Checking once, then reusing. An approval covers one call with those arguments. Do not cache it as "always allow" for the whole session.
- Letting the model edit the call after approval. Execute exactly what was approved.
Limits
Approval does not stop an injection. It limits the impact of one. A reviewer can still miss a subtle malicious argument, so combine this control with scoped credentials, output sanitization and logging.
Exercise
An agent has a send_email tool gated by approval. The approval prompt reads "The assistant wants to send a summary email. Approve?" Name two problems with this design and how to fix each.
Show answer
The prompt hides the recipient and body, so a reviewer cannot spot an injected address or leaked data. Show the exact arguments (to, subject, full body). Also, if the text is generated by the model, an injection can make it misleading. Build the prompt from the real tool call in your code, not from model-written text.