CrewAI
Python framework for orchestrating role-playing, autonomous AI agents. Agents collaborate via sequential or hierarchical processes to complete complex tasks. Built from scratch — independent of LangChain. Two core primitives: Crews (autonomous multi-agent collaboration) and Flows (event-driven, precise orchestration).
Warnings
- breaking Python <3.10 is not supported. CrewAI requires Python >=3.10 and <3.14. Installation on 3.9 will fail or produce broken behavior.
- breaking Task.expected_output is a required field. Omitting it raises a validation error at instantiation time.
- breaking crewai-tools is a completely separate package from crewai. Tools like SerperDevTool, FileReadTool, and WebsiteSearchTool raise ImportError if crewai-tools is not installed separately.
- breaking The recommended project structure uses YAML config files (src/<project>/config/agents.yaml and tasks.yaml) with @CrewBase, @agent, @task decorators. Code-only setups from older tutorials (pre-1.0) are still valid but the YAML-first pattern is now canonical and most docs assume it.
- breaking The crewai-tools repo (crewAIInc/crewAI-tools on GitHub) is now archived. Tool development has moved to the crewai-tools PyPI package maintained in the main crewai ecosystem.
- gotcha Small open-source models (7B and below) often fail at function/tool calling within CrewAI. The framework relies heavily on the LLM's ability to generate correctly structured tool calls.
- gotcha Windows users encounter build errors for chroma-hnswlib==0.7.6 (a memory dependency) due to missing C++ build tools.
- gotcha crew.kickoff() is synchronous and blocking. For async contexts or FastAPI use, use crew.kickoff_async() instead.
- gotcha Non-OpenAI LLM providers require litellm and the correct model string format: 'provider/model-name' (e.g. 'anthropic/claude-sonnet-4-5', 'ollama/gemma3'). Passing just the model name without provider prefix silently routes to OpenAI.
Install
-
pip install crewai -
pip install crewai-tools -
pip install 'crewai-tools[mcp]'
Imports
- Agent, Task, Crew
from crewai import Agent, Task, Crew, Process from crewai import LLM
- crewai_tools
from crewai_tools import SerperDevTool, FileReadTool
Quickstart
from crewai import Agent, Task, Crew, Process
researcher = Agent(
role='Senior Researcher',
goal='Uncover groundbreaking technologies in AI',
backstory='You are an expert researcher with a passion for AI innovation.',
verbose=True
)
writer = Agent(
role='Tech Writer',
goal='Craft compelling articles about AI discoveries',
backstory='You are a skilled writer who makes complex topics accessible.',
verbose=True
)
research_task = Task(
description='Research the latest breakthroughs in AI for 2026.',
expected_output='A list of 5 key AI breakthroughs with brief descriptions.',
agent=researcher
)
write_task = Task(
description='Write a short article based on the research findings.',
expected_output='A 3-paragraph article in markdown format.',
agent=writer
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task],
process=Process.sequential,
verbose=True
)
result = crew.kickoff()
print(result)