|
|
CrewAI Sequential and Hierarchical Process
Author: Venkata Sudhakar
CrewAI supports two process types that control how tasks are assigned and executed across agents: sequential and hierarchical. In the sequential process, tasks run one after another in the order they are defined - the output of each task is passed as context to the next. In the hierarchical process, a manager agent (backed by an LLM) orchestrates the other agents, deciding who does what and in what order.
Sequential process is the default and easiest to reason about. Hierarchical process is more flexible and handles dynamic delegation - the manager can reassign tasks, request retries, and combine results intelligently. For ShopMax India, sequential process fits a fixed pipeline (research then write then review), while hierarchical suits open-ended tasks where the manager must decide which specialist to call.
The following example shows the same ShopMax India product report task implemented first with sequential process and then with hierarchical process, so you can compare the two approaches.
It gives the following output,
Sequential result:
1. Samsung Galaxy S24 FE - 6.7-inch display, Exynos 2500, 8GB RAM, 128GB storage.
2. OnePlus 13 - Snapdragon 8 Elite, 12GB RAM, 256GB, 6000mAh battery.
3. Realme 14 Pro+ - 6.83-inch AMOLED, 50MP camera, 12GB RAM, 512GB.
Samsung Galaxy S24 FE delivers premium features at a mid-range price, making it a top pick for
To switch to hierarchical process, set process=Process.hierarchical and provide a manager_llm parameter (an LLM instance that will act as the manager). You do not assign tasks to specific agents - the manager decides. This adds flexibility at the cost of an extra LLM call per delegation step. For ShopMax India's fixed reporting pipeline, sequential is faster and cheaper; use hierarchical when the workflow varies based on input.
|
|