@tool decorator; every runtime honours it.
delete_account runs.
One vocabulary:
approval= is the same word you already use on the agent — Agent(name="…", approval="high"). See Agent Approval. requires_approval= still works as a deprecated alias (below).Quick Start
1
One-line, high-risk default
approval=True registers the tool at "high" risk:2
Explicit risk level
Pass a string to choose the level explicitly:
3
Renamed tool
Registration keys off the resolved tool name — not the function name:
How It Works
Registration happens once at import time; enforcement happens on every call.Choose your level
Configuration Options
Accepted values forapproval (canonical):
Deprecated alias: requires_approval
requires_approval= is the old spelling. It still works but emits a DeprecationWarning — migrate to approval=.
Attributes on the returned
FunctionTool:
Common Patterns
Mark one tool critical alongside safe tools
Rename a tool and keep it gated
Compose with agent-level approval config
The decorator declares what needs approval; the agent config decides how to ask.User interaction flow
A real run looks like this:- You run the agent:
agent.start("Delete account u_42"). - The LLM decides to call
delete_account. - The console approval prompt appears with four choices:
[o] once,[s] session,[a] always,[n] no. - You pick — the tool runs, or is skipped.
Best Practices
Gate anything that writes or deletes
Gate anything that writes or deletes
Prefer
approval=True for any tool that writes, mutates, or deletes state. True registers at "high" — safe default for destructive actions.Reserve 'critical' for irreversible operations
Reserve 'critical' for irreversible operations
Use
'critical' only for irreversible operations. Critical tools always re-prompt regardless of the argument cache, so they never slip through a cached grant. See the approval cache.Keep the parameter on the definition, not the agent
Keep the parameter on the definition, not the agent
Declare approval on the tool itself. The tool then travels safely between agents — no agent can accidentally use it ungated.
Use a non-console backend for async agents
Use a non-console backend for async agents
approval on the decorator does not wire a backend — console stays the default. For async agents, combine with Agent(approval={"backend": "slack"}) or another non-console backend.Related
Approval
Agent-level approval config and the dangerous-tools registry
Interactive Approval
The console prompt UX and scope choices
Approval Backends
Slack, HTTP, webhook, and other channels
Tool Retry Policy
A sibling decorator-level knob for retries

