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:
Creates a per-request response
Queue.Writes the request payload to DDict (for in-runtime logging).
Updates the agent’s status to
WAITING.Puts
(request, response_queue)on the sharedhitl_queue.await``s ``response_queue.get()(suspends the coroutine).Writes the operator’s response to DDict (for in-runtime logging).
Restores status to
PROCESSINGand 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).