mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-05 06:59:23 +00:00
* feat: adopt directory-based docs versioning with Edge channel Switch docs.crewai.com from navigation-only versioning (every version selector entry rendered the same docs/<lang>/* source files) to Mintlify's directory-based versioning so each version selector entry renders its own snapshot. Add an "Edge" channel under docs/edge/<lang>/* that always reflects main HEAD for unreleased work, eliminating pre-release leakage onto frozen release labels. External links to canonical /<lang>/* URLs are preserved via wildcard redirects that always land on the current default version. Layout: - docs/edge/<lang>/* rolling source (you edit here) - docs/edge/enterprise-api.*.yaml - docs/v<X.Y.Z>/<lang>/* frozen, immutable snapshots - docs/v<X.Y.Z>/enterprise-api.*.yaml - docs/images/ shared, append-only - docs/docs.json nav + redirects URLs follow the Mintlify-idiomatic shape: /edge/<lang>/<page> for Edge, /v<X.Y.Z>/<lang>/<page> for every frozen snapshot. The wildcard redirects /<lang>/:slug* -> /<default>/<lang>/:slug* keep stale links working, and every freeze rewrites them (plus all per-section/per-page redirects) so destinations always resolve to the current default without depending on a second redirect hop. Release flow integration (devtools release): - New module crewai_devtools.docs_versioning.freeze() materialises docs/v<X.Y.Z>/ from docs/edge/, rewrites openapi: refs inside the snapshot, inserts the version into every language block in docs.json, and refreshes all redirect destinations. - _update_docs_and_create_pr() in cli.py now calls that freeze during Phase 2 of devtools release. Edge changelogs are updated first (so the snapshot freeze picks them up), then the snapshot is staged alongside docs.json, branched as docs/freeze-v<X.Y.Z>, and the PR is titled [docs-freeze] docs: snapshot and changelog for v<X.Y.Z> — the title prefix the new CI guard reads. - The PR still gates tag, GitHub release, PyPI publish, and the enterprise release as before; no new PRs are added. - Pre-releases (1.X.YaN, 1.X.YbN, ...) skip the snapshot — they ride Edge — and the docs PR title omits the [docs-freeze] prefix. - docs_check (AI-generated docs scaffolding) writes to docs/edge/<lang>/* so newly-generated unreleased docs land in Edge and never accidentally touch a frozen snapshot. Migration scripts (one-shot): - scripts/docs/freeze_historical_versions.py reconstructs all 16 historical snapshots (v1.10.0 .. v1.14.7) from git tags via git archive | tar, rewriting openapi: MDX refs so each snapshot reads its own enterprise-api YAML rather than the live one. - scripts/docs/prefix_version_paths.py one-shot-migrates docs.json: rewrites every page path in 16 versioned blocks to point under docs/v<X.Y.Z>/, inserts a new Edge entry per language, tags v1.14.7 as Latest (default), prunes pages whose target file doesn't exist in the snapshot (e.g. docs/ar/ didn't exist before v1.12.0), and writes the wildcard + per-section redirects. - scripts/docs/freeze_current_edge.py is now a thin CLI wrapper around docs_versioning.freeze for manual one-off freezes (e.g. retroactively snapshotting a forgotten release). CI guards (.github/workflows/docs-snapshots.yml): - Frozen snapshots under docs/v[0-9]*/ are immutable; only PRs whose title contains [docs-freeze] (i.e. release-cut PRs generated by devtools release or the manual wrapper) may modify them. - Images under docs/images/ are append-only since snapshots share a single image directory. Deleting or renaming an image breaks every historical snapshot that still references it. Restored docs/images/crewai-otel-export.png from PR #3673; it was deleted in PR #4908 but v1.10.0 / v1.10.1 snapshots still reference it. Restoring instead of editing the snapshots preserves historical rendering fidelity and validates the new append-only rule retroactively. Tests: - lib/devtools/tests/test_docs_versioning.py covers the freeze: file copy, openapi rewrite, version insertion, default demotion, redirect upserts, per-section redirect rewriting, idempotency, and invalid inputs. Verified locally with mintlify broken-links: 0 broken links across the full site (Edge + 16 frozen versions, 4 locales). AGENTS.md (repo root) is the contributor guide for the new model; RELEASING.md is the release-cut runbook; README's Contribution section links to both. Co-authored-by: Cursor <cursoragent@cursor.com> * style: resolve linter issues --------- Co-authored-by: Cursor <cursoragent@cursor.com>
158 lines
6.9 KiB
Plaintext
158 lines
6.9 KiB
Plaintext
---
|
|
title: "HITL Workflows"
|
|
description: "Learn how to implement Human-In-The-Loop workflows in CrewAI for enhanced decision-making"
|
|
icon: "user-check"
|
|
mode: "wide"
|
|
---
|
|
|
|
Human-In-The-Loop (HITL) is a powerful approach that combines artificial intelligence with human expertise to enhance decision-making and improve task outcomes. This guide shows you how to implement HITL within CrewAI Enterprise.
|
|
|
|
## HITL Approaches in CrewAI
|
|
|
|
CrewAI offers two approaches for implementing human-in-the-loop workflows:
|
|
|
|
| Approach | Best For | Version |
|
|
|----------|----------|---------|
|
|
| **Flow-based** (`@human_feedback` decorator) | Production with Enterprise UI, email-first workflows, full platform features | **1.8.0+** |
|
|
| **Webhook-based** | Custom integrations, external systems (Slack, Teams, etc.), legacy setups | All versions |
|
|
|
|
## Flow-Based HITL with Enterprise Platform
|
|
|
|
<Note>
|
|
The `@human_feedback` decorator requires **CrewAI version 1.8.0 or higher**.
|
|
</Note>
|
|
|
|
When using the `@human_feedback` decorator in your Flows, CrewAI Enterprise provides an **email-first HITL system** that enables anyone with an email address to respond to review requests:
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Email-First Design" icon="envelope">
|
|
Responders receive email notifications and can reply directly—no login required.
|
|
</Card>
|
|
<Card title="Dashboard Review" icon="desktop">
|
|
Review and respond to HITL requests in the Enterprise dashboard when preferred.
|
|
</Card>
|
|
<Card title="Flexible Routing" icon="route">
|
|
Route requests to specific emails based on method patterns or pull from flow state.
|
|
</Card>
|
|
<Card title="Auto-Response" icon="clock">
|
|
Configure automatic fallback responses when no human replies within the timeout.
|
|
</Card>
|
|
</CardGroup>
|
|
|
|
### Key Benefits
|
|
|
|
- **External responders**: Anyone with an email can respond, even non-platform users
|
|
- **Dynamic assignment**: Pull assignee email from flow state (e.g., `account_owner_email`)
|
|
- **Simple configuration**: Email-based routing is easier to set up than user/role management
|
|
- **Deployment creator fallback**: If no routing rule matches, the deployment creator is notified
|
|
|
|
<Tip>
|
|
For implementation details on the `@human_feedback` decorator, see the [Human Feedback in Flows](/en/learn/human-feedback-in-flows) guide.
|
|
</Tip>
|
|
|
|
## Setting Up Webhook-Based HITL Workflows
|
|
|
|
For custom integrations with external systems like Slack, Microsoft Teams, or your own applications, you can use the webhook-based approach:
|
|
|
|
<Steps>
|
|
<Step title="Configure Your Task">
|
|
Set up your task with human input enabled:
|
|
<Frame>
|
|
<img src="/images/enterprise/crew-human-input.png" alt="Crew Human Input" />
|
|
</Frame>
|
|
</Step>
|
|
|
|
<Step title="Provide Webhook URL">
|
|
When kicking off your crew, include a webhook URL for human input:
|
|
<Frame>
|
|
<img src="/images/enterprise/crew-webhook-url.png" alt="Crew Webhook URL" />
|
|
</Frame>
|
|
</Step>
|
|
|
|
<Step title="Receive Webhook Notification">
|
|
Once the crew completes the task requiring human input, you'll receive a webhook notification containing:
|
|
- **Execution ID**
|
|
- **Task ID**
|
|
- **Task output**
|
|
</Step>
|
|
|
|
<Step title="Review Task Output">
|
|
The system will pause in the `Pending Human Input` state. Review the task output carefully.
|
|
</Step>
|
|
|
|
<Step title="Submit Human Feedback">
|
|
Call the resume endpoint of your crew with the following information:
|
|
<Frame>
|
|
<img src="/images/enterprise/crew-resume-endpoint.png" alt="Crew Resume Endpoint" />
|
|
</Frame>
|
|
|
|
<Warning>
|
|
**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.
|
|
</Warning>
|
|
|
|
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"
|
|
}'
|
|
```
|
|
|
|
<Warning>
|
|
**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.
|
|
</Warning>
|
|
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.
|
|
</Step>
|
|
<Step title="Handle Negative Feedback">
|
|
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.
|
|
</Step>
|
|
|
|
<Step title="Execution Continuation">
|
|
When you submit positive feedback, the execution will proceed to the next steps.
|
|
</Step>
|
|
</Steps>
|
|
|
|
## 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
|
|
|
|
## Learn More
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Flow HITL Management" icon="users-gear" href="/en/enterprise/features/flow-hitl-management">
|
|
Explore the full Enterprise Flow HITL platform capabilities including email notifications, routing rules, auto-response, and analytics.
|
|
</Card>
|
|
<Card title="Human Feedback in Flows" icon="code" href="/en/learn/human-feedback-in-flows">
|
|
Implementation guide for the `@human_feedback` decorator in your Flows.
|
|
</Card>
|
|
</CardGroup>
|