Workflow:CrewAIInc CrewAI Hierarchical Crew Execution
| Knowledge Sources | |
|---|---|
| Domains | Multi_Agent_Systems, Task_Delegation, LLM_Orchestration |
| Last Updated | 2026-02-11 18:00 GMT |
Overview
End-to-end process for configuring a CrewAI crew with hierarchical task management where a manager agent automatically coordinates, delegates, and validates work across specialized worker agents.
Description
This workflow covers the hierarchical execution process in CrewAI, where a designated manager agent orchestrates task completion by dynamically delegating work to specialized agents. Unlike sequential execution where tasks follow a fixed order, the hierarchical process gives the manager agent autonomy to decide which agent handles each task, review intermediate results, re-delegate when needed, and synthesize final outputs. The manager agent uses delegation tools to assign work, receives results, and applies its own judgment to ensure quality. This pattern is ideal for complex workflows where optimal task assignment depends on intermediate results, or where a coordination layer improves output quality.
Usage
Execute this workflow when the task assignment cannot be predetermined, when you need quality review between steps, or when the complexity of coordination benefits from an autonomous manager. Typical triggers include: multiple agents with overlapping capabilities where dynamic assignment improves results, tasks that may need re-delegation based on output quality, or workflows where a senior coordinating intelligence improves the overall output.
Execution Steps
Step 1: Specialist Agent Definition
Define the pool of specialist agents that the manager will coordinate. Each specialist should have a clearly differentiated role, goal, and backstory that defines their area of expertise. Equip specialists with domain-specific tools. Unlike sequential crews, agents in a hierarchical crew do not need to be pre-assigned to specific tasks since the manager handles assignment dynamically.
Key considerations:
- Agents should have distinct, non-overlapping specializations
- Equip agents with tools relevant to their specialty
- Agent descriptions help the manager make delegation decisions
- More agents provide the manager with more delegation options
Step 2: Manager Agent Configuration
Configure the manager agent that will coordinate the crew. Provide a dedicated manager_agent with a coordination-focused role, or specify a manager_llm to use the default manager behavior. The manager agent receives delegation tools automatically and uses them to assign tasks to the most suitable specialist based on its understanding of each agent's capabilities.
Key considerations:
- manager_agent allows full customization of the coordinator
- manager_llm uses a default manager with the specified LLM
- The manager receives DelegateWorkTool and AskQuestionTool automatically
- A more capable LLM (e.g., GPT-4) is recommended for the manager role
Step 3: Task Definition
Define tasks as in any crew, but the agent parameter is optional. When tasks have no pre-assigned agent, the manager decides which specialist to delegate to. Tasks can still specify expected_output, output_pydantic, guardrails, and context dependencies. The manager considers these requirements when choosing which agent to assign.
Key considerations:
- Tasks without an agent are delegated dynamically by the manager
- Tasks with a pre-assigned agent bypass manager delegation for that task
- Context dependencies still control execution ordering
- Expected output descriptions guide the manager's quality assessment
Step 4: Hierarchical Crew Assembly
Create the Crew with process=Process.hierarchical. Provide either manager_agent or manager_llm (required for hierarchical mode). The crew automatically equips the manager with delegation tools and sets up the coordination pipeline. Optional settings include memory for cross-task context, planning for upfront strategy generation, and verbose mode for debugging delegation decisions.
Key considerations:
- Process.hierarchical is required to enable manager coordination
- Either manager_agent or manager_llm must be specified
- Memory is especially valuable in hierarchical mode for maintaining context
- Planning mode generates a strategy before the manager begins delegation
Step 5: Managed Execution
Call crew.kickoff(inputs={...}) to start the hierarchical workflow. The manager agent evaluates each task, selects the best specialist, delegates the work, reviews the output, and either accepts it or re-delegates. The manager synthesizes a final output incorporating results from all delegated tasks. The execution may involve multiple rounds of delegation and review.
Key considerations:
- The manager may delegate the same task multiple times if output quality is insufficient
- Delegation decisions are logged when verbose mode is enabled
- The manager uses its own LLM to reason about delegation and review
- Total token usage includes both manager and specialist agent calls