What CrewAI is
CrewAI is a Python framework for orchestrating teams of AI agents that collaborate on a goal. Its mental model is deliberately human: you hire agents with roles, goals, and backstories, hand them tasks with clear expected outputs, and organise them into a crew that runs a process. That role-based framing makes multi-agent systems approachable — you design a team the way you’d staff a project. The builder above turns a few roles and a topic into a complete, runnable crew.
How it works
Three primitives do all the work:
- Agent — a persona defined by
role,goal, andbackstory. These fields are not decoration; they are injected into the prompt and genuinely steer the agent’s behaviour and priorities. - Task — a
descriptionplus anexpected_output, assigned to one agent. The expected output is what keeps results focused and chainable. - Crew — the agents and tasks bundled together with a
process.
The process determines coordination. Process.sequential runs tasks in
order, feeding each output forward as context — a researcher gathers facts, then
a writer turns them into a report. Process.hierarchical introduces a manager
LLM that dynamically assigns and reviews work, which is more flexible for
ambiguous goals at the cost of more model calls.
Calling crew.kickoff() starts the run; CrewAI handles the message passing,
context flow, and aggregation, returning the final task’s output.
Tips and a real example
The classic CrewAI starter is a research crew: a Senior Researcher whose goal is finding accurate, recent facts, and a Tech Writer who turns those facts into a polished report. Run sequentially, the researcher’s notes flow straight into the writer’s task. That two-role pattern (which the builder defaults to) is enough for blog drafts, market summaries, and briefings.
- Write specific goals. “Find accurate, recent facts and sources” beats “research things” — the goal text is doing real prompting.
- Make expected outputs concrete. Asking for “a polished report in markdown” produces far better structure than leaving it implicit.
- Add tools when prose isn’t enough. Wire a web-search tool to the researcher so it grounds claims in live data rather than its training cutoff.
- Stay sequential until you must scale up. Hierarchical crews are powerful but spend more tokens and are harder to debug; reach for them only when a fixed task order genuinely can’t express the work.