Course Content
CrewAI Multi-Agents
9 sections · 53 lessons
What are the core components of CrewAI (Agent, Task, Crew, Process)?
What you need to know
The four core pieces
Agent— who does the work. Key fields:role,goal,backstory,tools,llm,allow_delegation(defaultFalse),max_iter(default 25).Task— what must be done. Key fields:description,expected_output,agent,context,output_pydantic,guardrails,async_execution,output_file.Crew— the runtime. Key fields:agents,tasks,process,memory,cache,verbose. Runs withkickoff(inputs={...})and returns aCrewOutput.Process—Process.sequential(the default) orProcess.hierarchical, which needs amanager_llmormanager_agent.
The supporting pieces
| Piece | Purpose |
|---|---|
| Tools | functions the agent can call (BaseTool, the @tool decorator, crewai_tools, MCP servers) |
| Memory | a unified Memory store the crew can write to and recall from across runs |
| Knowledge | reference documents (PDF, text, CSV) that agents search during tasks |
| Guardrails | checks on a task's output; on failure the agent retries with feedback |
| Flows | event-driven orchestration of crews, agents and plain code |
How they fit together in a project
Most teams keep agents and tasks in YAML and wire them in Python with the @CrewBase decorator. This is the layout crewai create crew my_crew --classic generates. (Since CrewAI 1.15, crewai create crew without the flag generates a JSON-based layout with crew.jsonc and an agents/ folder; the ideas are the same.)
1# src/lead_qualifier/config/agents.yaml2researcher:3 role: >4 B2B Account Researcher5 goal: >6 Build a factual profile of {company}7 backstory: >8 You only report facts you can link to a source.1# src/lead_qualifier/crew.py2from crewai import Agent, Crew, Process, Task3from crewai.project import CrewBase, agent, crew, task45@CrewBase6class LeadQualifier:7 agents_config = "config/agents.yaml"8 tasks_config = "config/tasks.yaml"910 @agent11 def researcher(self) -> Agent:12 return Agent(config=self.agents_config["researcher"])1314 @task15 def research_task(self) -> Task:16 return Task(config=self.tasks_config["research_task"])1718 @crew19 def crew(self) -> Crew:20 return Crew(agents=self.agents, tasks=self.tasks,21 process=Process.sequential)The @agent and @task decorators collect methods into self.agents and self.tasks, in the order they are declared. The task YAML names its agent by the key (agent: researcher). You run it with crewai run or LeadQualifier().crew().kickoff(inputs={"company": "Acme"}).
A real-life example
A Bengaluru B2B SaaS company that sells HR software receives about 400 demo requests a week. Sales reps waste hours on students and tiny firms. They build a lead-qualification crew:
- Agents: an account researcher (web search tool), a fit scorer (no tools, knows the ideal-customer rules), and an outreach writer.
- Tasks:
research_task(company size, industry, funding, with URLs),score_task(a score from 0 to 100 with reasons, asoutput_pydantic=LeadScore),email_task(a first email for leads above 70). - Crew: sequential, because the order never changes.
The fit scorer's typed output is what the CRM integration reads, so nobody parses free text. Each piece has one clear job, which is exactly the mental model an interviewer wants to hear.
Follow-up questions to expect
- "Where does the system prompt come from?" — CrewAI builds it from the agent's
role,goalandbackstory, and adds the task'sdescription,expected_outputand any context for each task. - "Does every task need an agent?" — In a sequential crew, yes. In a hierarchical crew a task can leave
agentempty, and the manager chooses who does it. - "What does
kickoffreturn?" — ACrewOutputwith.raw(final text),.pydanticor.json_dict(typed final output),.tasks_output(each task's output) and.token_usage.