dragon.ai.agent.hitl.approval.request_human_approval

async request_human_approval(ddict: Any , hitl_queue: Any , task_id: str , agent_id: str , dispatch_id: str , tool_name: str , tool_args: dict [str , Any ], context: str = '') HumanApprovalResponse[source]

Pause the current coroutine until a human operator approves or rejects.

This function:

  1. Creates a per-request response Queue.

  2. Writes the request payload to DDict (for in-runtime logging).

  3. Updates the agent’s status to WAITING.

  4. Puts (request, response_queue) on the shared hitl_queue.

  5. await``s ``response_queue.get() (suspends the coroutine).

  6. Writes the operator’s response to DDict (for in-runtime logging).

  7. Restores status to PROCESSING and cleans up.

The HITL client only interacts via Queues — it never touches DDict. This is required because DDict/FLI are incompatible with the Dragon Runtime Proxy (see module docstring).

Parameters

ddict:

Shared Dragon Distributed Dictionary for the current run.

hitl_queue:

Dragon Queue used to send (request, response_queue) pairs to the HITL client.

task_id:

Current pipeline run identifier.

agent_id:

Identifier of the agent requesting approval.

dispatch_id:

Identifier of the specific dispatch (supports concurrent dispatches).

tool_name:

Name of the tool the LLM wants to call.

tool_args:

Arguments the LLM wants to pass to the tool.

context:

Human-readable explanation of why the tool is being called.

Returns

HumanApprovalResponse

The operator’s decision (approved/rejected + optional reason).