Skip to main content
By default, all tool calls are allowed. To gate tool execution — for example, prompting a user for confirmation — pass an approve callback to the agent.

Basic Approval

ToolCallInfo

The approval callback receives a ToolCallInfo object:

Denied Tool Calls

When a tool call is denied, a ToolDeniedError is thrown and surfaced to the model as a tool error. This lets the model adjust its approach — for example, by trying a different tool or asking the user for guidance.

Async Approval

The callback can be async, enabling a variety of approval patterns:
  • Terminal prompts — ask the user in a CLI
  • Web UI modals — show a confirmation dialog
  • External services — call an approval API or workflow system
Subagents run autonomously without prompting for permission by design. If you need to control subagent tool access, limit the tools you pass to the subagent.