Module 8 Wrap-up: Your First AI Crew
Hands-on: Build a two-agent research crew that identifies tech trends and writes a report.
Module 8 Wrap-up: The Power of the Ensemble
You have learned how to design roles, tasks, and processes. Now, we are going to build a Full Multi-Agent Crew. We will create a "Researcher" and a "Technical Writer" that work together to analyze a website.
Hands-on Exercise: The Tech Trend Crew
1. Requirements
pip install crewai
2. The Code
Create a file tech_crew.py:
from crewai import Agent, Task, Crew, Process
# 1. Define Agents (The Identity)
researcher = Agent(
role='Tech Breakthrough Researcher',
goal='Discover 3 key developments in Quantum Computing for 2024',
backstory="""You are a deep-tech enthusiast with a knack for spotting
academic papers that are about to go mainstream. You are analytical.""",
verbose=True
)
writer = Agent(
role='Tech Journalist',
goal='Summarize the researcher findings into a LinkedIn post',
backstory="""You are a pro at making complex tech sound exciting for
a general audience. Your tone is professional but engaging.""",
verbose=True
)
# 2. Define Tasks (The Assignment)
task1 = Task(
description='Perform a deep dive into 2024 Quantum Computing papers.',
expected_output='A summary of 3 key breakthroughs with their potential impact.',
agent=researcher
)
task2 = Task(
description='Turn the breakthroughs into a 3-paragraph LinkedIn post.',
expected_output='A post containing 3 paragraphs and 3 relevant hashtags.',
agent=writer
)
# 3. Create the Crew (The Team)
my_crew = Crew(
agents=[researcher, writer],
tasks=[task1, task2],
process=Process.sequential # A -> B
)
# 4. Kickoff
result = my_crew.kickoff()
print("######################")
print(result)
3. Observe the Collaboration
When you run this, you will see the logs showing:
- Researcher and its internal monologue searching for Quantum info.
- Writer taking the researcher's output and "re-styling" it.
- The Result: A high-quality post that is better than what a single "Generic" agent would produce.
Module 8 Summary
- Multi-Agent Systems use specialized personas to improve quality.
- CrewAI manages the "Baton Passing" between these agents automatically.
- Role, Goal, and Backstory are the primary way we "Program" the behavior of a crew.
- Sequential Processes are easy to build, while Hierarchical Processes allow for more complex management.
Coming Up Next...
In Module 9, we explore a different philosophy: StrandAgents. We will learn about Event-Driven AI and how to build agents designed for streaming and asynchronous real-time behavior.
Module 8 Checklist
- I have installed the
crewailibrary. - I can explain the difference between a Role and a Goal.
- I have successfully run the
tech_crew.pyscript. - I understand how the output of Task 1 moves to Task 2.
- I can identify a task in my life that would benefit from a "Manager" agent.