Human-in-the-Loop (HITL) Workflows ↗
noOriginal Documentation
Documentation Index#
Fetch the complete documentation index at: https://docs.crewai.com/llms.txt Use this file to discover all available pages before exploring further.
Learn how to implement Human-in-the-Loop workflows in CrewAI for enhanced decision-making
Human-in-the-Loop (HITL) is a powerful approach that combines artificial intelligence with human expertise to enhance decision-making and improve task outcomes. CrewAI provides multiple ways to implement HITL depending on your needs.
Choosing Your HITL Approach#
CrewAI offers two main approaches for implementing human-in-the-loop workflows:
| Approach | Best For | Integration | Version |
|---|---|---|---|
Flow-based (@human_feedback decorator) | Local development, console-based review, synchronous workflows | Human Feedback in Flows | 1.8.0+ |
| Webhook-based (Enterprise) | Production deployments, async workflows, external integrations (Slack, Teams, etc.) | This guide | - |
If you’re building flows and want to add human review steps with routing based on feedback, check out the Human Feedback in Flows guide for the @human_feedback decorator.
Setting Up Webhook-Based HITL Workflows#
Set up your task with human input enabled:

When kicking off your crew, include a webhook URL for human input:

Example with Bearer authentication:
curl -X POST {BASE_URL}/kickoff \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"inputs": {
"topic": "AI Research"
},
"humanInputWebhook": {
"url": "https://your-webhook.com/hitl",
"authentication": {
"strategy": "bearer",
"token": "your-webhook-secret-token"
}
}
}'
```
Or with Basic authentication:
```bash
curl -X POST {BASE_URL}/kickoff \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"inputs": {
"topic": "AI Research"
},
"humanInputWebhook": {
"url": "https://your-webhook.com/hitl",
"authentication": {
"strategy": "basic",
"username": "your-username",
"password": "your-password"
}
}
}'
```
<span class="step-end"></span>
<span class="step-marker" data-step-title="Receive Webhook Notification"></span>
Once the crew completes the task requiring human input, you'll receive a webhook notification containing:
* Execution ID
* Task ID
* Task output
<span class="step-end"></span>
<span class="step-marker" data-step-title="Review Task Output"></span>
The system will pause in the `Pending Human Input` state. Review the task output carefully.
<span class="step-end"></span>
<span class="step-marker" data-step-title="Submit Human Feedback"></span>
Call the resume endpoint of your crew with the following information:
<img src="https://mintcdn.com/crewai/5SZbe87tsCWZY09V/images/enterprise/crew-resume-endpoint.png?fit=max&auto=format&n=5SZbe87tsCWZY09V&q=85&s=1e1c2ca22a2d674426f8e663fed33eca" alt="Crew Resume Endpoint" data-og-width="624" width="624" data-og-height="261" height="261" data-path="images/enterprise/crew-resume-endpoint.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/crewai/5SZbe87tsCWZY09V/images/enterprise/crew-resume-endpoint.png?w=280&fit=max&auto=format&n=5SZbe87tsCWZY09V&q=85&s=09014207ae06e6522303b77e4648f0d4 280w, https://mintcdn.com/crewai/5SZbe87tsCWZY09V/images/enterprise/crew-resume-endpoint.png?w=560&fit=max&auto=format&n=5SZbe87tsCWZY09V&q=85&s=1ad53990ab04014e622b3acdb37ca604 560w, https://mintcdn.com/crewai/5SZbe87tsCWZY09V/images/enterprise/crew-resume-endpoint.png?w=840&fit=max&auto=format&n=5SZbe87tsCWZY09V&q=85&s=afb11308edffa03de969712505cf95ab 840w, https://mintcdn.com/crewai/5SZbe87tsCWZY09V/images/enterprise/crew-resume-endpoint.png?w=1100&fit=max&auto=format&n=5SZbe87tsCWZY09V&q=85&s=9bd69f0d75ec47ac2c6280f24a550bff 1100w, https://mintcdn.com/crewai/5SZbe87tsCWZY09V/images/enterprise/crew-resume-endpoint.png?w=1650&fit=max&auto=format&n=5SZbe87tsCWZY09V&q=85&s=f81e1ebcdc8a9348133503eb5eb4e37a 1650w, https://mintcdn.com/crewai/5SZbe87tsCWZY09V/images/enterprise/crew-resume-endpoint.png?w=2500&fit=max&auto=format&n=5SZbe87tsCWZY09V&q=85&s=b12843fa2b80cc86580220766a1f4cc4 2500w" />
<span class="callout-start" data-callout-type="warning"></span>
**Critical: Webhook URLs Must Be Provided Again**:
You **must** provide the same webhook URLs (`taskWebhookUrl`, `stepWebhookUrl`, `crewWebhookUrl`) in the resume call that you used in the kickoff call. Webhook configurations are **NOT** automatically carried over from kickoff - they must be explicitly included in the resume request to continue receiving notifications for task completion, agent steps, and crew completion.
<span class="callout-end"></span>
Example resume call with webhooks:
```bash
curl -X POST {BASE_URL}/resume \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"execution_id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
"task_id": "research_task",
"human_feedback": "Great work! Please add more details.",
"is_approve": true,
"taskWebhookUrl": "https://your-server.com/webhooks/task",
"stepWebhookUrl": "https://your-server.com/webhooks/step",
"crewWebhookUrl": "https://your-server.com/webhooks/crew"
}'
```
<span class="callout-start" data-callout-type="warning"></span>
**Feedback Impact on Task Execution**:
It's crucial to exercise care when providing feedback, as the entire feedback content will be incorporated as additional context for further task executions.
<span class="callout-end"></span>
This means:
* All information in your feedback becomes part of the task's context.
* Irrelevant details may negatively influence it.
* Concise, relevant feedback helps maintain task focus and efficiency.
* Always review your feedback carefully before submission to ensure it contains only pertinent information that will positively guide the task's execution.
<span class="step-end"></span>
<span class="step-marker" data-step-title="Handle Negative Feedback"></span>
If you provide negative feedback:
* The crew will retry the task with added context from your feedback.
* You'll receive another webhook notification for further review.
* Repeat steps 4-6 until satisfied.
<span class="step-end"></span>
<span class="step-marker" data-step-title="Execution Continuation"></span>
When you submit positive feedback, the execution will proceed to the next steps.
<span class="step-end"></span>
<span class="steps-end"></span>
## Best Practices
* **Be Specific**: Provide clear, actionable feedback that directly addresses the task at hand
* **Stay Relevant**: Only include information that will help improve the task execution
* **Be Timely**: Respond to HITL prompts promptly to avoid workflow delays
* **Review Carefully**: Double-check your feedback before submitting to ensure accuracy
## Common Use Cases
HITL workflows are particularly valuable for:
* Quality assurance and validation
* Complex decision-making scenarios
* Sensitive or high-stakes operations
* Creative tasks requiring human judgment
* Compliance and regulatory reviews
## Enterprise Features
<span class="card-start" data-card-title="Flow HITL Management Platform" data-card-icon="users-gear" data-card-href="/en/enterprise/features/flow-hitl-management"></span>
CrewAI Enterprise provides a comprehensive HITL management system for Flows with in-platform review, responder assignment, permissions, escalation policies, SLA management, dynamic routing, and full analytics. [Learn more →](/en/enterprise/features/flow-hitl-management)
<span class="card-end"></span>