Skip to main content
User Confirmation allows you to mark tools as requiring explicit user approval before execution. The agent pauses when it invokes such a tool; you present the pending call to the user, then call confirm() or reject() and resume with continue_run_async(). Ideal for sensitive operations like deletions, deployments, or payments.

Quick Start

Core Concepts

Defining Tools That Require Confirmation

Use the @tool(requires_confirmation=True) decorator:

Resolving Requirements

Each requirement exposes confirm() and reject(). Use them after you have output from agent.do_async(task, return_output=True):
  • confirm(): Injects approval; the tool runs with the planned arguments when you resume.
  • reject(note=”…”): Injects rejection; the agent receives the note and continues without executing the tool.

HITL Handler

Use a unified callback to resolve confirmation (and other HITL types) during continuation:

Continuation Methods

Resume with run_id (Same Agent)

Resume with task (Same Agent)

Rejecting a Tool Call

The agent receives the rejection note and completes without executing the tool:

Resume with run_id (New Agent - Cross-Process)

Use persistent storage and pass requirements when resuming with a new agent:

Resume with task (New Agent - Cross-Process)

Multiple Confirmation Tools

Loop-Based Handling

When the agent invokes multiple confirmation tools, loop until there are no active requirements:

Using hitl_handler for Multiple Tools

Resolve the first pause yourself, then pass hitl_handler so subsequent confirmation pauses are handled automatically:

Cross-Process Confirmation

Full pattern: one process runs the agent and pauses; another (or same) process resolves confirmation and resumes with a new agent:

Important Notes

  • Direct Call Mode Only: HITL continuation only supports direct call mode. Streaming is not supported for continuation.
  • Requirements Parameter: When resuming with a new agent, pass requirements=output.requirements so the resolved confirm/reject state is applied.
  • Persistent Storage: For cross-process scenarios, use persistent storage (e.g. SqliteDatabase).
  • pause_reason: When paused for confirmation, output.pause_reason == "confirmation" and output.is_paused is True.