Topic 1 of 5 · 4 min read
Approval gates for risky actions
Goal: Classify an agent's tools by risk and specify which calls run freely, which need approval and which are blocked.
Sort every tool an agent can call into three bins: run freely, ask a person first, or never allow. The bin depends on what a wrong call costs and whether you can undo it, not on how clever the agent seems.
Check yourself · 1 of 3
Which tool call is the best candidate for a free, no-approval setting?
Why it matters
An agent acts on its own guesses. A model can misread a ticket, follow an instruction hidden in a web page, or pick the wrong record, and then call a tool with full confidence. A gate turns a possible incident into a question on a screen. OWASP lists excessive agency (too much functionality, permission or autonomy) as a core risk for LLM apps, and asking a human before high-impact actions is one of its listed mitigations.
How to classify
Ask three questions about each tool call:
- Can it change anything? Reading a file or running a search is low risk. Writing, sending, paying and deleting are not.
- Can you undo it? Editing a draft is reversible. Sending an email, dropping a table or charging a card is not.
- Who is affected? A change in a scratch folder touches you. A message to a customer, or a write to a shared database, touches others.
Then assign a bin:
- Allow: read-only, local, cheap to repeat. Example: list files, search docs, run unit tests in a sandbox.
- Ask: changes state, or reaches people or money, but is reversible or bounded. Example: edit a file outside the working folder, post a message, refund under a set limit.
- Deny: irreversible and not needed for the job. Example: drop a table, force-push, read the secrets directory.
Most agent products let you write these rules. Claude Code, for example, has allow, ask and deny rules per tool and pattern, and deny wins over the others. Write the policy in config, not in the prompt: a prompt line like "never delete data" is a request, a deny rule is enforced by code.
Show the exact action
An approval is only worth something if the person sees what will happen. Show the tool name, the real arguments and the effect: "Refund 240.00 USD to order 8841 (customer Kim R.)", not "Agent wants to use payments tool. Allow?"
Before and after
Weak: one switch, "auto-approve all tools", turned on because the prompts were annoying.
Better: reads and tests run freely, writes inside the repo are allowed, shell commands that touch the network or the system ask, and rm -rf, git push --force and secrets access are denied.
What goes wrong
- Gating by tool name only. A "shell" tool covers both
lsandrm -rf. Match on the command or arguments, not just the tool. - A gate in the prompt only. The model can be talked out of it, or skip it. Enforce the gate outside the model.
- Approving a vague summary. If the person cannot see the arguments, they are guessing too.
Examples
A support agent's tool table
| Tool | Bin | Why |
|---|---|---|
search_orders |
Allow | Read-only, no personal data leaves the system |
draft_reply |
Allow | Saved as a draft, a person sends it |
refund up to 50 USD |
Ask | Money moves, but the amount is bounded |
refund over 50 USD |
Deny | Needs a manager through another channel |
delete_customer |
Deny | Irreversible and never needed for support |
The same tool, refund, lands in two bins because the argument changes the risk.
Rules in config
{
"permissions": {
"allow": ["Read(./src/**)", "Bash(npm test)"],
"ask": ["Bash(git push:*)"],
"deny": ["Bash(rm -rf:*)", "Read(./.env)"]
}
}
The rules are checked by the harness before a command runs, so the model cannot argue its way past them.
Key points
- Classify each tool as allow, ask or deny by what a wrong call costs and whether it can be undone.
- Enforce gates in code or config, not in the prompt, because a prompt rule is only a request to the model.
- Gate on the tool arguments, not just the tool name, since one shell tool can run both a harmless and a destructive command.
- An approval prompt must show the exact action, its target and its effect.
- Deny irreversible actions the job does not need; a deny rule is stronger than any ask rule.
Common mistakes
- Turning on auto-approve for everything because the prompts are annoying, instead of widening the allow list for safe calls.
- Writing "ask me before deleting" in the system prompt and treating it as a control.
- Showing the person a summary written by the agent instead of the real tool call and arguments.
- Classifying by tool name, so a shell or SQL tool is either fully open or fully blocked.
Check yourself · 2 of 3
A prompt says "Never run destructive commands without asking." What is the weakness of relying on this alone?
Check yourself · 3 of 3
A shell tool can run any command. How should a policy gate it?
Practice items, not counted towards your mastery.
Start here
- Interrupts (LangGraph docs) (opens in a new tab)DocsFree
How an interrupt pauses a graph, stores state and resumes with the human's answer.
- Persistence (LangGraph docs) (opens in a new tab)DocsFree
Checkpoints and threads: the saved state that makes pause and resume possible.
- Configure permissions (Claude Code) (opens in a new tab)DocsFree
A working example of allow, ask and deny rules for an agent's tools.
More for this topic
- LLM06: Excessive Agency (OWASP Gen AI Security Project) (opens in a new tab)StandardFree
Names too much functionality, permission and autonomy as a risk and lists mitigations.