Human-in-the-Loop (HITL)
Human-in-the-Loop enables workflows to pause and wait for human decisions, approvals, or input before continuing.
For full documentation, see Human-in-the-Loop (Full Guide).
Quick Overview
Why Human-in-the-Loop?
Not everything should be fully automated:
- High-stakes decisions: Approve large purchases, sensitive operations
- Quality control: Review AI-generated content before publishing
- Compliance: Ensure human oversight for regulated processes
- Exception handling: Escalate edge cases humans handle better
How HITL Works
Workflow → Human Task Created → Human Reviews → Response → Workflow Continues
Basic Example
Add a human node to your workflow:
{
id: 'approval-step',
type: 'human',
prompt: 'Please review and approve this expense report',
approvers: ['manager@company.com'],
inputFields: [
{
name: 'approved',
type: 'boolean',
label: 'Approve this expense?',
required: true
},
{
name: 'comments',
type: 'text',
label: 'Comments (optional)'
}
],
timeoutMs: 86400000 // 24 hours
}
Respond to Task
await client.workflows.respondToTask('task-123', {
status: 'approved',
data: {
approved: true,
comments: 'Looks good, approved!'
}
});
Full documentation: Human-in-the-Loop (Complete Guide)