Unit 01.00: The four pieces, and which one you actually need
CrewAI gives you four building blocks. Most projects use two of them, and the trouble usually starts with the ones that were not needed.
Agent, Task, Crew, Flow
An Agent is who does the work. A Task is one unit of work with a checkable output. A Crew binds agents and tasks together with an order. A Flow is deterministic orchestration written in code, and it is the subject of Module 6.
The code builds the smallest thing that works: one agent, one task, one crew.
from crewai import Agent, Task, Crew, Process
# Agent: who does the work. Task: one unit of work with a checkable output.
# Crew: the agents and tasks together, plus how they are ordered.
# Flow: deterministic orchestration in code -- covered in Module 6.
analyst = Agent(
role="Billing analyst",
goal="Answer billing questions from the account record only",
backstory="You answer from records. You do not estimate.",
allow_delegation=False,
)
check = Task(
description="Summarise the charges on account ACC-1187 for June.",
expected_output="A bulleted list of charges with dates and amounts.",
agent=analyst,
)
crew = Crew(agents=[analyst], tasks=[check], process=Process.sequential)
for name, value in [("agent role", analyst.role),
("task output contract", check.expected_output),
("process", crew.process),
("agents / tasks", f"{len(crew.agents)} / {len(crew.tasks)}")]:
print(f"{name:22} {value}")
# Note what is NOT here: no Flow. A single sequential task does not need
# orchestration, and adding it is the most common early over-build.
Notice expected_output on the task. It is not documentation - it is the contract the agent works towards and the thing a reviewer checks against. "A bulleted list of charges with dates and amounts" can be verified; "a good summary" cannot.
Notice also what is absent. There is no Flow, because a single sequential task has no orchestration to do. Adding one is the most common early over-build, and it puts a layer of machinery between you and a workflow that was already deterministic.
The mistake this prevents
The mistake is starting from the diagram in the documentation - a manager, several specialists, a flow around them - and working backwards to a problem. Start with one agent and one task, and add a piece only when a specific thing does not work without it.
Takeaway
Four pieces, and most workflows need two. The task's expected_output is the contract that makes anything else checkable, so write it before writing the agent.
