Requests human approval before executing an action.
The action requiring approval
Human's approval decision
const decision = await hitl.requestApproval({
actionId: 'delete-records',
description: 'Delete inactive user accounts older than 2 years',
severity: 'high',
category: 'data_modification',
agentId: 'cleanup-agent',
context: { accountCount: 5000, criteria: 'inactive > 2y' },
reversible: false,
potentialConsequences: ['Data loss', 'User complaints'],
});
Submits an approval decision (typically called by UI/webhook handler).
The approval decision
Requests clarification from a human for ambiguous situations.
The clarification request
Human's clarification response
Submits a clarification response.
The clarification response
Requests human review and potential editing of agent output.
The draft output to review
Edited output (may be unchanged)
Submits an edited output.
The edited output
Escalates a situation to human control.
Escalation context
Human's decision on how to proceed
Submits an escalation decision.
The escalation identifier
The human's decision
Creates a checkpoint for human review during long-running tasks.
The checkpoint state
Human's checkpoint decision
Submits a checkpoint decision.
The checkpoint decision
Records human feedback for agent improvement.
The feedback to record
Gets feedback history for an agent.
Agent identifier
Optional options: { Query options
Optional limit?: numberOptional since?: DateOptional type?: "correction" | "praise" | "guidance" | "preference" | "complaint"Feedback history
Gets all pending requests awaiting human response.
Pending requests by type
Gets HITL interaction statistics.
Current statistics
Sets the notification handler for outgoing requests.
Handler function
Interface for the AgentOS Human-in-the-Loop Manager.
The HITL Manager enables structured collaboration between AI agents and human operators, ensuring human oversight for critical decisions while maintaining efficient autonomous operation.
Key capabilities:
Example