Reviewed by Jonathan West · Updated Aug 6, 2026

CrewAI Explained: The Role-First Way to Build Agent Teams

How CrewAI turns a job description into a working AI agent, and when that approach beats wiring a graph by hand.

Reviewed by Jonathan West · Updated Aug 6, 2026

CrewAI is an open-source Python framework that builds AI agent teams around job roles instead of workflow graphs. You describe each agent the way you would describe a new hire: a role, a goal, and a backstory that shapes how it behaves.

A group of these agents working together is called a crew. CrewAI assigns tasks to the right agent, lets agents hand off work to each other, and returns a final result once the crew finishes.

The framework is built and maintained by CrewAI Inc. and is separate from LangChain, though it can use LangChain tools and any LLM API. It ships as a free, open-source Python package, with a paid CrewAI AMP platform on top for teams that need a visual builder and governance.


What Is CrewAI

CrewAI is a Python framework for building multi-agent AI systems around named roles rather than a graph of nodes and edges.

You define agents like team members - a Research Analyst, a Content Writer, a QA Reviewer - each with a role, a goal, and a short backstory that steers its tone and judgment calls.

Agents get tools (web search, a database query, a code interpreter, a custom API call) and a model to run on. CrewAI then handles the coordination: which agent does what, in what order, and how results pass between them.

The project is fully open source under an MIT-style license and installs with a single pip command. It works with OpenAI, Anthropic, Gemini, and local models through providers like Ollama.

  • Role-based agent design instead of manual graph wiring
  • Open-source Python package (crewai on PyPI)
  • Model-agnostic: works with any LLM provider or local model
  • Built-in support for sequential and hierarchical task delegation

Choosing between CrewAI, LangGraph, and AutoGen for a production workflow? We help teams pick the right framework before writing code that has to be rewritten later.

Book a Consultation

The Core Building Blocks: Agent, Task, Crew, Process

CrewAI is built on four primitives: Agent, Task, Crew, and Process.

An Agent is one worker. It has a role ("Senior Data Analyst"), a goal ("find pricing trends in the dataset"), a backstory (context that shapes its reasoning), and a list of tools it can call.

A Task is one unit of work assigned to an agent, with a description and an expected output format. Tasks can depend on the output of earlier tasks.

A Crew is the group of agents plus their tasks, run together toward one outcome. The Process setting controls how work moves through the crew: sequential runs tasks in a fixed order, while hierarchical adds a manager agent that assigns work dynamically and reviews results before passing them along.

CrewAI also ships Flows, a newer, more explicit layer for chaining crews together with state and conditional logic - closer to what LangGraph does, but sitting on top of the role-based crew model instead of replacing it.

  • Agent = role, goal, backstory, tools, and an LLM
  • Task = one job, with a description and expected output
  • Crew = the agents and tasks running together
  • Process = sequential (fixed order) or hierarchical (manager delegates)
  • Flow = event-driven layer for chaining multiple crews with shared state

When CrewAI Beats LangGraph

CrewAI beats LangGraph when the job is a repeatable, role-shaped workflow you can describe in plain language before writing any code.

If your task looks like a small team assignment - one agent researches, one writes, one checks facts - CrewAI gets you a working prototype in under an hour because the role/goal/backstory pattern maps directly onto how people already think about the work.

LangGraph, built by LangChain, models the same problem as an explicit state graph: nodes, edges, and conditional branches you wire by hand. That gives you precise control over every transition, retries, and loops, which matters for workflows with complex branching logic or strict state machines.

The tradeoff shows up at the edges. CrewAI's role abstraction can feel restrictive once a workflow needs unusual branching - looping back conditionally, running steps in parallel with custom merge logic, or pausing for a human approval mid-task. LangGraph handles those natively because you are drawing the graph yourself, not asking a role-based framework to infer it.

A practical rule: pick CrewAI when the team-of-specialists metaphor fits the problem and you want to move fast. Pick LangGraph when the control flow itself is the hard part and you need to see and edit every state transition. Some teams start a prototype in CrewAI, then re-platform to LangGraph once the branching logic outgrows what roles alone can express - see our CrewAI vs LangGraph comparison for a fuller breakdown.

  • CrewAI wins: fast prototyping, role-shaped tasks, small teams new to agent frameworks
  • LangGraph wins: complex branching, custom retry/loop logic, strict state control
  • CrewAI Flows narrows the gap but still sits on top of the role model, not a replacement for it
A failure mode we see often: teams build a 6-agent CrewAI crew for a workflow that is really one linear pipeline with an if-statement. Every extra agent adds a coordination handoff, and each handoff is a place output can drift off-format. Start with the fewest agents that map to real specialization, not one agent per verb in the task description.

Building Your First Crew: A Code Walkthrough

A minimal CrewAI crew needs three things in code: agents, tasks, and a Crew object that ties them together with a process.

Install the package first, then set your LLM provider's API key as an environment variable - CrewAI reads it automatically for most providers.

  • pip install crewai
  • Define each Agent with role=, goal=, and backstory=
  • Define each Task with description= and expected_output=, and assign it an agent=
  • Wrap agents and tasks in a Crew(agents=[...], tasks=[...], process=Process.sequential)
  • Call crew.kickoff() to run it and get the final output
Example: a two-agent research crew. from crewai import Agent, Task, Crew, Process researcher = Agent( role="Research Analyst", goal="Find the three most important trends in a given market", backstory="A former equity analyst who reads primary sources, not summaries.", ) writer = Agent( role="Content Writer", goal="Turn research findings into a clear 300-word brief", backstory="A writer who explains complex topics in plain language.", ) research_task = Task( description="Research current trends in {topic}", expected_output="Three trends, each with one supporting data point", agent=researcher, ) write_task = Task( description="Write a brief based on the research findings", expected_output="A 300-word brief in plain language", agent=writer, context=[research_task], ) crew = Crew( agents=[researcher, writer], tasks=[research_task, write_task], process=Process.sequential, ) result = crew.kickoff(inputs={"topic": "enterprise AI adoption"}) print(result)

Sequential vs. Hierarchical Process

Sequential process runs every task in the fixed order you listed, with each task able to read the output of the ones before it.

This is the right default for linear pipelines: research, then write, then review. It is predictable and easy to debug because the execution order never changes.

Hierarchical process adds a manager agent above the crew. The manager reads the overall goal, decides which agent should handle each piece of work, and can review or reject an agent's output before moving on.

Hierarchical costs more - every delegation decision is an extra LLM call - and it is harder to predict, since the manager's routing can vary between runs. Use it when task order genuinely depends on what earlier agents find, not as a default.

  • Sequential: fixed order, predictable, cheapest to run
  • Hierarchical: manager agent delegates dynamically, higher cost, use when order is genuinely data-dependent

Tools, Memory, and Integrations

CrewAI agents get capabilities through tools - Python functions or pre-built integrations an agent can call mid-task.

The framework ships built-in tools for web search, file reading, code execution, and scraping, and supports LangChain-compatible tools directly, so existing LangChain tool code does not need a rewrite.

Crews can hold memory across runs (short-term task memory and longer entity/context memory) so a crew does not start from zero on every kickoff.

For model access, CrewAI works with any provider's API, plus local models through Ollama, and OpenAI-compatible endpoints such as Groq, Together AI, or Fireworks AI for faster or cheaper inference during development.

  • Built-in tools: web search, file I/O, code execution, web scraping
  • LangChain tool compatibility - no rewrite needed for existing tools
  • Optional short-term and long-term crew memory
  • Any LLM provider, plus local models via Ollama

CrewAI AMP: The Paid Platform Layer

CrewAI AMP is the company's separate, paid platform for teams that want a visual builder and central governance on top of the open-source framework.

The free Basic tier includes a visual workflow editor, an AI copilot for building crews, GitHub integration, and 50 workflow executions a month - enough to evaluate the platform but not to run production traffic.

The Enterprise tier moves to custom pricing and adds SSO, role-based access control, workload identity, PII redaction, governance policies, and a choice of deployment - CrewAI's cloud, your VPC, or fully self-hosted. Confirm exact seat and execution limits on CrewAI's own pricing page before budgeting, since platform tiers change more often than the open-source package does.

None of this is required to use CrewAI. The open-source pip package is the actual framework covered in this guide, and it runs standalone with no CrewAI account.

  • Open-source crewai package: free, self-hosted, no account needed
  • AMP Basic: free, 50 executions/month, visual editor + copilot
  • AMP Enterprise: custom pricing, SSO/RBAC/governance, flexible deployment

Common Failure Modes When Adopting CrewAI

The most common CrewAI mistake is over-hiring: building a crew with one agent per step instead of one agent per genuine specialization.

Each additional agent is a handoff, and each handoff is a chance for the output format to drift or for context to get lost between agents. A three-agent crew that actually needs three distinct skill sets outperforms a seven-agent crew built by literally translating a flowchart into agents.

A second failure mode is skipping expected_output on tasks. Without a clear expected output format, downstream agents receive inconsistent input shapes and the whole crew becomes harder to debug.

When we build and audit agent-based automation routines across the sites in our own portfolio, the pattern holds outside CrewAI too: the systems that stay reliable over months are the ones with the fewest handoffs between steps, not the most sophisticated ones. Extra coordination layers add failure surface faster than they add capability.

  • Over-hiring: one agent per verb instead of per real specialization
  • Missing expected_output specs, causing format drift between tasks
  • No memory/context passed between tasks that actually depend on each other
  • Defaulting to hierarchical process when sequential would be cheaper and more predictable

Getting Started: A Practical Checklist

Getting started with CrewAI takes five steps before you run your first crew.

Start narrow: one task, two agents, sequential process. Expand only once that works reliably.

  • 1. pip install crewai and set your LLM provider's API key
  • 2. Write down the real roles the task needs - not one per verb
  • 3. Give each agent a specific goal and a short, relevant backstory
  • 4. Define expected_output on every task before running the crew
  • 5. Start with Process.sequential; move to hierarchical only if task order must vary at runtime

Frequently Asked Questions

  • Yes. The core CrewAI Python framework is free and open source under an MIT-style license - install it with pip and run it on your own infrastructure with any LLM provider. CrewAI AMP, the company's separate visual-builder platform, has a free Basic tier (50 executions/month) and a custom-priced Enterprise tier for governance features.
  • LangChain is a general-purpose toolkit for building LLM applications - chains, tools, retrieval, and integrations. CrewAI is a narrower, higher-level framework specifically for multi-agent role-based orchestration, and it can use LangChain tools directly rather than replacing them.
  • Neither is universally better - they fit different problem shapes. CrewAI is faster to prototype for role-shaped teamwork tasks (research, write, review). LangGraph gives more precise control over complex branching, loops, and state, which matters once a workflow's control flow gets complicated. See our [CrewAI vs LangGraph](/comparisons/crewai-vs-langgraph) comparison for specific decision criteria.
  • A Crew is a team of agents collaborating on one task, coordinated by role. A Flow is a higher layer for chaining multiple crews together with explicit state and event logic, closer to a workflow orchestrator. Most teams start with a single Crew and add Flows only when they need to chain several crews or add conditional branching between them.
  • Yes. CrewAI works with any LLM provider through a standard interface, including local models served through Ollama, and OpenAI-compatible fast-inference providers like Groq, Together AI, or Fireworks AI.
  • As few as the task genuinely needs - most reliable crews use two to four agents. Adding one agent per step in a workflow, rather than one agent per real specialization, is the most common cause of format drift and unpredictable output in production crews.
  • Yes. You can write any Python function as a custom tool, use CrewAI's built-in tools (web search, file I/O, code execution, scraping), or reuse existing LangChain-compatible tools without rewriting them.

Need Help Choosing an Agent Framework?

CrewAI, LangGraph, and AutoGen all solve multi-agent orchestration differently, and the wrong pick costs weeks of rework once a workflow outgrows it. We help teams map their actual workflow shape to the right framework before they write production code.

Book a Consultation