CrewAI takes a specific angle on multi-agent systems: instead of one AI agent trying to do everything, you assemble a “crew” of specialized agents, each with a defined role, that collaborate on a shared goal — closer to how a real team divides work than to a single do-everything assistant. This walks through the core concepts and a working example, from scratch.
The Core Concepts
- Agent — a single AI worker with a role, a goal, and a backstory that shapes how it approaches tasks (a “Senior Research Analyst” behaves differently than a “Copy Editor,” even calling the same underlying model).
- Task — a specific unit of work assigned to an agent, with a clear description and expected output.
- Crew — the group of agents and tasks working together toward a shared overall goal.
- Process — how tasks get coordinated: sequentially (one agent’s output feeds the next) or hierarchically (a manager agent delegates and reviews).
Installing CrewAI
pip install crewai
A Working Two-Agent Crew
A common first project: a researcher agent that gathers information, and a writer agent that turns it into a finished piece — a real division of labor, not one agent doing both jobs.
from crewai import Agent, Task, Crew, Process
researcher = Agent(
role="Senior Research Analyst",
goal="Find accurate, up-to-date information on the given topic",
backstory="An experienced analyst known for thorough, well-sourced research.",
verbose=True
)
writer = Agent(
role="Technical Writer",
goal="Turn research findings into a clear, well-structured summary",
backstory="A writer who values clarity over jargon and never overstates a claim.",
verbose=True
)
research_task = Task(
description="Research the current state of {topic} and list the key facts.",
expected_output="A bullet-point list of the most important, well-sourced facts.",
agent=researcher
)
writing_task = Task(
description="Using the research findings, write a clear 3-paragraph summary of {topic}.",
expected_output="A 3-paragraph summary, written for a general audience.",
agent=writer,
context=[research_task]
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, writing_task],
process=Process.sequential
)
result = crew.kickoff(inputs={"topic": "recent advances in battery technology"})
print(result)
The context=[research_task] line is the important detail: it explicitly passes the researcher’s output into the writer’s task, so the writer isn’t starting from nothing — it’s building on what the previous agent actually found.
Giving an Agent a Real Tool
Without tools, an agent can only reason over what the model already knows. CrewAI supports attaching tools (web search, a custom API call, a file reader) to any agent:
from crewai_tools import SerperDevTool
search_tool = SerperDevTool()
researcher = Agent(
role="Senior Research Analyst",
goal="Find accurate, up-to-date information on the given topic",
backstory="An experienced analyst known for thorough, well-sourced research.",
tools=[search_tool],
verbose=True
)
Now the researcher agent can genuinely search the web rather than relying purely on the model’s training data — a meaningful difference for any topic that changes over time.
When CrewAI Is the Right Choice
CrewAI’s role-based structure makes it a strong fit for workflows that naturally divide into specialized jobs — research-then-write, plan-then-execute, draft-then-review. For workflows that need explicit, fine-grained control over every state transition (production systems with strict auditability requirements, for example), LangGraph is generally the better fit — see our custom AI agents guide for a fuller framework comparison.
Frequently Asked Questions
Do all agents in a crew need to use the same underlying model?
No — CrewAI supports assigning different models to different agents, which is useful when one role needs more reasoning depth than another and you want to control cost accordingly.
What’s the difference between sequential and hierarchical process?
Sequential runs tasks in a fixed order, each building on the last — simplest to reason about. Hierarchical adds a manager agent that delegates tasks and reviews output, closer to how a real team lead operates, at the cost of more complexity and more model calls.
Is CrewAI free to use?
The core framework is open source and free; you pay only for the underlying model API calls it makes (OpenAI, Anthropic, or others) plus any paid tools you attach, like a search API.
Conclusion
CrewAI’s whole value is making role-based collaboration explicit instead of implicit — agents, tasks, and how they hand off to each other, all defined in code rather than buried inside one long prompt. Start with a simple two-agent sequential crew like the one above before reaching for hierarchical process or a larger crew — the coordination logic gets harder to reason about fast as you add agents.
📑 About the author: I also build Digital Bizz Card — hosted digital business cards you can share with a QR code, no app required.


