Human In The Loop

Browse agent examples for confirmation, user input, external execution, and approval-backed HITL.

ExampleDescription
Agentic User InputLet the agent request missing fields at runtime with UserControlFlowTools, then continue the run.
Confirmation AdvancedConfirm or reject tool calls across a custom HackerNews tool and WikipediaTools in one run.
Confirmation RequiredGate a custom HackerNews tool behind requires_confirmation and resume the paused run with agent.continue_run().
Confirmation Required MCP ToolkitRequire confirmation for an MCP server tool and resume an async streamed run after approval.
Confirmation ToolkitGate a toolkit's web_search tool behind user confirmation with requires_confirmation_tools.
External Tool ExecutionPause the run for a shell tool marked external_execution, execute it yourself, and continue with the result.
User Input RequiredMark a tool with requires_user_input so the run pauses to collect the to_address field.
Approval AsyncAsync approval-backed HITL: @approval with async agent run.
Approval BasicApproval-backed HITL: @approval + @tool(requires_confirmation=True) with persistent DB record.
Approval External ExecutionApproval + external execution HITL: @approval + @tool(external_execution=True).
Approval List And ResolveFull approval lifecycle: pause, list, filter, resolve, delete.
Approval TeamTeam-level approval: member agent tool with @approval.
Approval User InputApproval + user input HITL: @approval + @tool(requires_user_input=True).
Audit Approval AsyncAsync audit approval: @approval(type="audit") + @tool(requires_confirmation=True) with async.
Audit Approval ConfirmationAudit approval with confirmation: @approval(type="audit") + @tool(requires_confirmation=True).
Audit Approval ExternalAudit approval with external execution: @approval(type="audit") + @tool(external_execution=True).
Audit Approval OverviewCompare pre-execution @approval records with audit-type approvals recorded after HITL resolution, including rejection in SQLite.
Audit Approval User InputAudit approval with user input: @approval(type="audit") + @tool(requires_user_input=True).
Confirmation with Session StatePause before changing session_state and apply the change only after approval.
Mixed External and Regular ToolsCombine a regular tool with an external_execution tool; the agent auto-runs one and pauses for the other.
User Feedback (Structured Questions)Pause a trip-planning agent with UserFeedbackTools and collect answers to multiple-choice questions.
Approval Post HookDemonstrates the post-hook reading the resolved approval record from run_output.metadata["approval"] after a paused run resumes via DB resolution.
Deterministic approval flow for a side-effecting toolThis example uses a local mock model, so it runs without provider credentials.
Place persistent approval tools on a team leader or memberAgentOS propagates approval pauses differently depending on where the tool lives.