Skip to main content
User confirmation allows you to pause execution and require explicit user approval before proceeding with tool calls. This is useful for:
  • Sensitive operations
  • API calls that modify data
  • Actions with significant consequences

How It Works

When you mark a tool with @tool(requires_confirmation=True), your agent will:
  1. Pause execution when the tool is about to be called
  2. Set is_paused to True on the run response
  3. Wait for you to review the tool call and decide whether to approve or reject it
  4. Continue execution once you call continue_run() with your decision
This gives you complete control over which tools execute and when, making it perfect for production scenarios where you need human oversight.

Basic Example

The following example shows how to implement user confirmation with a custom tool:

Toolkit-Level Confirmation

You can also specify which specific tools in a toolkit require confirmation using the requires_confirmation_tools parameter. This is super useful when you want to protect only certain operations in a toolkit while allowing others to run freely:

Providing Rejection Feedback

When rejecting a tool call, you can provide feedback to the agent using the confirmation_note property. This helps the agent understand why the operation was rejected and potentially choose a better approach:

Mixed Tool Scenarios

You can mix tools that require confirmation with tools that don’t. The agent will execute the non-confirmation tools automatically and only pause for those that need approval:

Async Support

User confirmation works seamlessly with async agents. Just use arun() and acontinue_run():

Streaming Support

User confirmation also works with streaming responses. The agent will pause mid-stream when it encounters a tool that requires confirmation:
Remember that tools marked with @tool(requires_confirmation=True) are mutually exclusive with @tool(requires_user_input=True) and @tool(external_execution=True).A tool can only use one of these patterns at a time.

Usage Examples

Basic Confirmation

Simple user confirmation flow

Async Confirmation

Using confirmation with async agents

Mixed Tools

Combining confirmation and non-confirmation tools

Multiple Tools

Handling multiple confirmations

Streaming Async

Confirmation with streaming responses

Toolkit Confirmation

Using confirmation with toolkits

With History

Confirmation with chat history

With Run ID

Resume confirmation using run_id