Lesson 6 of 20

Agent Frameworks Overview

CrewAI

3 min read

CrewAI brings a unique approach to AI agents: role-based multi-agent collaboration. With over 40,000 GitHub stars, it's become the go-to framework for building teams of specialized AI agents.

The Crew Concept

Instead of one agent doing everything, CrewAI lets you create specialized agents that work together:

from crewai import Agent, Task, Crew

# Define specialized agents
researcher = Agent(
    role="Senior Research Analyst",
    goal="Uncover cutting-edge developments in AI",
    backstory="You're an expert at finding and analyzing information.",
    tools=[search_tool, scrape_tool],
    llm=llm
)

writer = Agent(
    role="Tech Content Writer",
    goal="Create engaging content about AI developments",
    backstory="You're a skilled writer who makes complex topics accessible.",
    tools=[],
    llm=llm
)

editor = Agent(
    role="Content Editor",
    goal="Ensure content is accurate and well-structured",
    backstory="You have an eye for detail and clarity.",
    tools=[],
    llm=llm
)

Tasks and Workflows

Define what each agent should do:

# Create tasks
research_task = Task(
    description="Research the latest AI agent frameworks released in 2025",
    expected_output="A detailed report with key findings",
    agent=researcher
)

writing_task = Task(
    description="Write a blog post based on the research",
    expected_output="A 1000-word blog post",
    agent=writer,
    context=[research_task]  # Uses output from research
)

editing_task = Task(
    description="Edit and polish the blog post",
    expected_output="Final polished blog post",
    agent=editor,
    context=[writing_task]
)

# Assemble the crew
crew = Crew(
    agents=[researcher, writer, editor],
    tasks=[research_task, writing_task, editing_task],
    verbose=True
)

# Execute
result = crew.kickoff()

Key Features

Feature Description
Role-based agents Each agent has a specific role and expertise
Task delegation Agents can delegate to others
Sequential/Parallel Tasks can run in order or simultaneously
Memory Agents remember previous interactions
Process types Sequential, hierarchical, or consensual

Process Types

from crewai import Process

# Sequential: Tasks run one after another
crew = Crew(agents=[...], tasks=[...], process=Process.sequential)

# Hierarchical: Manager agent coordinates others
crew = Crew(
    agents=[...],
    tasks=[...],
    process=Process.hierarchical,
    manager_llm=ChatOpenAI(model="gpt-4")
)

When to Use CrewAI

Ideal for:

  • Complex tasks requiring multiple perspectives
  • Simulating team collaboration
  • Content creation pipelines
  • Research and analysis workflows

⚠️ Less suitable for:

  • Simple single-agent tasks
  • Real-time applications (overhead)
  • When you need fine-grained control

Real-World Example: Market Analysis

# A crew for market analysis
market_analyst = Agent(role="Market Analyst", ...)
competitor_researcher = Agent(role="Competitor Researcher", ...)
strategy_advisor = Agent(role="Strategy Advisor", ...)

# Tasks flow naturally between specialists
crew = Crew(
    agents=[market_analyst, competitor_researcher, strategy_advisor],
    tasks=[market_task, competitor_task, strategy_task]
)

Next, we'll explore OpenAI's native Agents SDK and its unique primitives. :::

Quiz

Module 2: Agent Frameworks Overview

Take Quiz