Become an Agentic Architect

CrewAI Sequential & Hierarchical Process

In CrewAI, a process defines how a crew runs its tasks and coordinates agents, not what the tasks do. Choosing the right process is like choosing a project management style for your AI team.


1. What Is a Process in CrewAI?

  • A process is the execution strategy that tells a crew in which order and under whose control tasks should run.
  • Processes make individual agents behave as a cohesive team instead of a collection of isolated workers.
  • In code, the process is chosen via the Process enum when you create the Crew.
# Python Code
from crewai import Crew, Process

crew = Crew(
    agents=my_agents,
    tasks=my_tasks,
    process=Process.sequential   # or Process.hierarchical
)

2. The Process Enum

CrewAI exposes processes as a type‑safe enum, so you can only pick supported values

  • Process.sequential
  • Process.hierarchical
  • Process.consensual (planned, not yet implemented)

This prevents typos and makes your orchestration behavior explicit and easy to read.


3. Sequential Process

Think of sequential as a classic pipeline.

  • Tasks run one after another in the order they are listed in the crew.
  • By default, the output of one task is available as context for the next; you can customize this with each task’s context parameter.
  • It mirrors many real‑world workflows: research → analyze → write → review.

Example:

crew = Crew(
    agents=my_agents,
    tasks=my_tasks,          # [task1, task2, task3] in order
    process=Process.sequential
)

When to use:

  • Your process is mostly linear and predictable.
  • Dependencies are simple: “B should see A’s output, C should see B’s output,” etc.
  • You are teaching or prototyping and want maximum clarity and debuggability.

4. Hierarchical Process

Think of hierarchical as a manager–worker model.

  • A manager agent coordinates the work: plans, delegates tasks to other agents, and validates results.
  • Tasks are not pre‑assigned in a fixed order; the manager decides what to do next and who should do it.
  • This enables flexible, adaptive workflows for complex projects.

To enable it you must provide either manager_llm or manager_agent:

# Python Code

from crewai import Crew, Process

# Using a manager LLM (CrewAI’s Manager agent is created for you)
crew = Crew(
    agents=my_agents,
    tasks=my_tasks,
    process=Process.hierarchical,
    manager_llm="gpt-4o"
)

# OR: using a custom manager agent you define yourself
crew = Crew(
    agents=my_agents,
    tasks=my_tasks,
    process=Process.hierarchical,
    manager_agent=my_manager_agent
)

How it behaves:

  • The manager receives the overall objective and current state.
  • It decomposes the goal into subtasks, assigns them to the best agents, and validates their outputs.
  • It can loop, re‑assign, or request revisions, just like a human project manager.

When to use:

  • Complex projects where task order cannot be fully hard‑coded up front.
  • Scenarios with many specialized agents that must be coordinated dynamically.
  • You want to mirror organizational structures (PM + specialists, lead dev + engineers, etc.).

5. Consensual Process (Planned)

CrewAI also defines a Consensual process conceptually, but it is planned and not yet implemented.

  • Idea: agents collectively discuss and agree on which tasks to run and how, using a democratic or voting‑style approach.
  • Goal: support collaborative decision‑making instead of purely top‑down or strictly linear orchestration.

For now, you should not use this in production code; treat it as a roadmap concept you can mention in your course when discussing future architectures.


6. Choosing the Right Process

Here is a simple decision guide:

Start with Sequential when:

  • The workflow is a well‑defined pipeline.
  • You’re learning CrewAI fundamentals (agents, tasks, YAML, crews).

Move to Hierarchical when:

  • You need a manager agent that can plan, delegate, and validate dynamically.
  • You want to simulate real teams with leads, reviewers, and specialized workers.

Remember that process selection = collaboration pattern: it’s not about what each agent knows, but how the team decides who does what, when, and in which order

On this page