Introduction to CrewAI
What is CrewAI?
CrewAI is an open-source framework for orchestrating autonomous AI agents and building complex workflows. It combines two layers:
- Flows — the backbone of your app: structured, event-driven workflows that own state and control execution.
- Crews — the units of work inside that backbone: teams of role-playing agents that collaborate on tasks the Flow delegates.
Official guidance: for any production-ready application, start with a Flow. Use a Flow for structure, state, and logic. Use a Crew inside a Flow step when you need a team of agents to work autonomously.
Coding agents (Cursor, Claude Code, Codex, …) can install the official skills:
Source of truth: docs.crewai.com/llms.txt and skills.crewai.com.
Architecture: Flows control, Crews think
Together: the Flow starts and holds state → delegates a hard task to a Crew → agents collaborate → the Crew returns a result → the Flow continues.
When to use Crews vs Flows
Short answer: use both.
Do not start by spawning many agents. Draw the predictable steps as a Flow; hand the “needs judgment and a tool loop” segment to a Crew.
vs LangChain / LangGraph and LlamaIndex
Choose CrewAI for researcher / writer / reviewer role-play. Choose LangChain (especially LangGraph) for fine-grained graphs, checkpoints, and middleware. Choose LlamaIndex when indexing/query is the product; wrap it with LlamaIndexTool if a Crew needs it. For chunking, vector stores, and eval, see the RAG tutorial.
These stacks compose; they are not mutually exclusive.
Core objects
New CLI projects are JSON-first (agents/*.jsonc + crew.jsonc). This tutorial teaches the Python API; scaffolding commands are in Installation.
Good fit / caveats
Good fit: multi-role collaboration, research-and-write with tools, backends that need a state machine plus an autonomous team.
Watch out: one-shot prompts with no tools or state (call the Chat API); ultra-low latency (multi-agent token cost); hierarchical crews without a manager LLM.