CrewAI Guide 2025: Build Multi-Agent AI Systems
A practical guide to CrewAI for Python developers — from first crew to production multi-agent pipelines with Claude, GPT-4o, or Ollama.
What Is CrewAI?
CrewAI is an open-source Python framework (30k+ GitHub stars) that lets you orchestrate multiple AI agents working together toward a shared goal. Each agent has a role, goal, backstory, and access to tools. Agents execute tasks in a defined sequence or under a manager agent's direction.
The mental model: think of a "crew" like a team of specialists. A researcher agent gathers information, a writer agent drafts content, a reviewer agent fact-checks — each staying in their lane but sharing results. CrewAI handles the orchestration, context passing, and agent-to-agent communication.
Core Concepts
Agent
An LLM-powered worker with a role, goal, and backstory. The backstory shapes the agent's persona and expertise. Agents can have tools and memory.
Task
A specific piece of work assigned to an agent. Requires a description and expected_output. Tasks can reference context from previous tasks.
Crew
The top-level object that holds agents, tasks, and process type. Calling crew.kickoff() starts execution.
Process
Sequential — tasks run in order, each output fed to the next. Hierarchical — a manager LLM decides which agent does what and when.
Tools
Functions agents can call — web search, file reading, code execution. CrewAI includes built-in tools and supports LangChain tools.
Python Quickstart: 3-Agent Research Crew
# Install
pip install crewai crewai-tools
# crew.py
import os
from crewai import Agent, Task, Crew, Process, LLM
from crewai_tools import SerperDevTool, WebsiteSearchTool
# Set API keys
os.environ["ANTHROPIC_API_KEY"] = "sk-ant-api03-..."
os.environ["SERPER_API_KEY"] = "your-serper-key" # for web search
llm = LLM(model="claude-sonnet-4-6")
search_tool = SerperDevTool()
web_tool = WebsiteSearchTool()
# Define agents
researcher = Agent(
role="Senior Research Analyst",
goal="Find accurate, up-to-date information on the given topic",
backstory="You are an expert researcher who excels at finding reliable sources.",
tools=[search_tool, web_tool],
llm=llm,
verbose=True
)
writer = Agent(
role="Technical Writer",
goal="Write clear, engaging content based on research findings",
backstory="You transform complex research into readable articles.",
llm=llm,
verbose=True
)
editor = Agent(
role="Senior Editor",
goal="Review content for accuracy, clarity, and completeness",
backstory="You have 15 years of editing experience. You catch errors and improve flow.",
llm=llm,
verbose=True
)
# Define tasks
research_task = Task(
description="Research the current state of AI coding assistants in 2025. Find the top 5 tools, their pricing, and key features.",
expected_output="A structured research report with facts, sources, and key data points.",
agent=researcher
)
write_task = Task(
description="Write a 500-word article about AI coding assistants based on the research. Include a comparison table.",
expected_output="A polished 500-word article with a markdown comparison table.",
agent=writer,
context=[research_task] # receives researcher's output
)
edit_task = Task(
description="Review and improve the article. Fix any inaccuracies, improve clarity, and ensure the table is formatted correctly.",
expected_output="The final, edited article ready for publication.",
agent=editor,
context=[write_task]
)
# Assemble and run the crew
crew = Crew(
agents=[researcher, writer, editor],
tasks=[research_task, write_task, edit_task],
process=Process.sequential,
verbose=True
)
result = crew.kickoff()
print(result) Built-in Tools
| Tool | What it does | Requires |
|---|---|---|
| SerperDevTool | Google search via Serper API | SERPER_API_KEY |
| WebsiteSearchTool | Scrape and search a specific URL | URL at init or runtime |
| FileReadTool | Read local files (txt, pdf, csv) | File path |
| CodeInterpreterTool | Execute Python code in sandbox | None |
| GithubSearchTool | Search GitHub repos and code | GITHUB_TOKEN |
CrewAI vs LangGraph vs AutoGen
| Factor | CrewAI | LangGraph | AutoGen |
|---|---|---|---|
| Learning curve | Low — role-based intuitive API | Medium — graph/node model | Low — conversation-based |
| Control | Medium | High (explicit graph) | Medium |
| Best for | Role-based collaboration | Complex branching workflows | Agent conversations |
| LLM flexibility | ✅ Any LiteLLM model | ✅ Any LangChain model | ✅ Most providers |
| Pricing | Free (pay LLM costs only) | Free (LangSmith $39/mo optional) | Free (pay LLM costs only) |
For building Devin-style coding agents, see the Devin guide. For LangChain integration with CrewAI tools, see LangChain guide.
Monitor Your AI Stack
CrewAI crews depend on LLM APIs — if Claude or OpenAI goes down, your entire pipeline stops. Prismix tracks live status for Anthropic, OpenAI, and 75+ AI providers with instant alerts.
Monitor AI API Status →