Core Concepts
Agents
Each agent has a role, goal, and optional tools:
analyst = Agent(
role="Data Analyst",
goal="Analyze datasets and find actionable insights",
backstory="10 years of experience in data science",
tools=[csv_tool, sql_tool, chart_tool],
llm="claude-sonnet-4-20250514"
)Tasks
Tasks define what needs to be done:
analysis_task = Task(
description="Analyze Q1 sales data and identify top-performing regions",
expected_output="Report with charts and recommendations",
agent=analyst,
output_file="q1_analysis.md"
)Crews
Crews orchestrate agents and tasks:
crew = Crew(
agents=[analyst, writer, reviewer],
tasks=[analysis_task, write_task, review_task],
process=Process.sequential # or Process.hierarchical
)Process Types
| Process | How It Works |
|---|---|
sequential |
Tasks run one after another |
hierarchical |
Manager agent delegates to workers |
Built-In Tools
from crewai_tools import (
SerperDevTool, # Web search
ScrapeWebsiteTool, # Web scraping
FileReadTool, # Read files
DirectoryReadTool, # Read directories
CodeInterpreterTool # Execute code
)Real-World Example: Content Pipeline
# Research → Write → Edit → Publish
researcher = Agent(role="Researcher", tools=[search_tool])
writer = Agent(role="Writer")
editor = Agent(role="Editor")
crew = Crew(
agents=[researcher, writer, editor],
tasks=[
Task(description="Research topic X", agent=researcher),
Task(description="Write 1000-word article", agent=writer),
Task(description="Edit for grammar and clarity", agent=editor),
],
process=Process.sequential
)Key Stats
- 25,000+ GitHub stars
- Role-based agent design
- Sequential and hierarchical processes
- 20+ built-in tools
- Memory and caching support
FAQ
Q: What is CrewAI? A: CrewAI is a Python framework for building teams of AI agents that collaborate on complex tasks, each with specialized roles, goals, and tools.
Q: Is CrewAI free? A: Yes, open-source under MIT license. Enterprise edition available.
Q: How is CrewAI different from LangGraph? A: CrewAI uses a role-playing metaphor — you define agents with roles and goals. LangGraph uses a graph-based approach with nodes and edges. CrewAI is more intuitive for team-like workflows.