CrewAI Architecture Overview
CrewAI is a framework focused on multi-Agent collaboration. Through Role, Task, and Process, it breaks complex projects into coordinated work by multiple Agents. It suits research assistants, content production, code review, and other scenarios that need division of labor.
Role
Role defines an Agent's "persona":
- goal: The role's core objective (e.g., "write high-quality technical documentation")
- backstory: Background that influences decision style
- llm: Can specify different models for cost/quality tradeoffs
- tools: Tools available to this role
researcher = Agent(
role="Researcher",
goal="Gather and organize accurate information",
backstory="Academic background, skilled at literature search",
tools=[search_tool]
)
writer = Agent(
role="Writer",
goal="Turn information into readable articles",
backstory="Former tech media editor"
)
Task
Task is a concrete work unit with:
- description: What to do
- expected_output: Desired deliverable (e.g., "a 500-word summary")
- agent: The Role responsible
- context: Dependencies on other Tasks' outputs, forming a dependency graph
context=[task1, task2] creates pipelines like "research first, then write."
Process
Process controls Task execution order and collaboration:
- Sequential: Execute in dependency order; good for linear pipelines
- Hierarchical: Introduces a Manager Agent that assigns tasks to subordinates; good for complex, branching projects
Delegation
Delegation means an Agent hands sub-tasks to others:
- In hierarchical mode, the Manager assigns based on Task descriptions and subordinate capabilities
- In a Task's
expected_output, you can specify "delegate X to Role Y" - Use
contextto pass upstream outputs so downstream Agents build on existing results
Practical Tips
Summary
CrewAI abstracts multi-Agent collaboration into configurable pipelines or hierarchies via Role, Task, Process, and Delegation. Mastering these concepts lets you quickly build research assistants, content teams, and automated workflows.