// AI NATIVE STACK

AI Native › AI Agent › Agent Framework › CrewAI

CRASH COURSE · AI-NATIVE · beginner · 14 min read · v0.80

CrewAI — role-based agent teams that just work.

agent-framework ai-native crewai multi-agent python

TL;DR — CrewAI lets you build multi-agent systems by thinking in roles: define agents with backstories, assign tasks with expected outputs, pick a process (sequential or hierarchical), and hit run. The fastest path from "I need three agents working together" to working code. Less flexible than LangGraph, more opinionated than AutoGen, but ships faster.

What it is

CrewAI is a Python framework for orchestrating role-based AI agent teams. You define agents (role, goal, backstory), tasks (description, expected output, assigned agent), and a crew (the team + process type). The framework handles delegation, context passing between tasks, and tool execution.

Researcher role + backstory Task 1 research Writer role Task 2 write out sequential process — Task 1 output feeds Task 2

Fig 1 — A sequential crew: each task's output becomes the next task's context.

Why it exists

LangGraph gives you raw graph primitives. AutoGen gives you multi-agent conversations. CrewAI says: most multi-agent workflows are teams with roles doing tasks in order. So it gives you exactly that abstraction — no graph DSL, no message-passing protocol, just agents, tasks, and a process.

Install & setup

pip install crewai crewai-tools
export OPENAI_API_KEY=sk-...

Building a crew

from crewai import Agent, Task, Crew, Process

researcher = Agent(
    role="Senior Researcher",
    goal="Find the most relevant information about {topic}",
    backstory="You're an expert researcher who excels at finding key facts.",
    verbose=True,
)

writer = Agent(
    role="Technical Writer",
    goal="Write a clear, concise summary about {topic}",
    backstory="You transform research into polished technical writing.",
    verbose=True,
)

research_task = Task(
    description="Research {topic} and list the 5 most important points.",
    expected_output="A list of 5 key facts with sources.",
    agent=researcher,
)

write_task = Task(
    description="Write a 200-word summary using the research provided.",
    expected_output="A polished 200-word summary.",
    agent=writer,
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    process=Process.sequential,
    verbose=True,
)

result = crew.kickoff(inputs={"topic": "vLLM PagedAttention"})
print(result.raw)

Tools

from crewai.tools import tool

@tool
def search_web(query: str) -> str:
    """Search the web for information."""
    return f"Results for: {query}"

researcher = Agent(
    role="Researcher",
    goal="Research topics thoroughly",
    backstory="Expert researcher.",
    tools=[search_web],
)

Hierarchical process

A manager agent automatically delegates tasks to the best-suited agent:

crew = Crew(
    agents=[researcher, writer, reviewer],
    tasks=[research_task, write_task, review_task],
    process=Process.hierarchical,
    manager_llm="gpt-4o",
)

Memory

Enable short-term, long-term, and entity memory so agents remember across tasks and even across crew runs:

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    memory=True,   # enables all memory types
)

When to use, when to skip

Use it when your problem maps naturally to "a team of specialists doing tasks in order" — content pipelines, research workflows, report generation. Fastest time-to-working-demo of any multi-agent framework.

Skip it when you need fine-grained control over agent control flow (use LangGraph), complex conversation dynamics (use AutoGen), or you only have one agent (use LangChain or Pydantic AI).

vs the alternatives

ToolBest forTrade-off
CrewAIQuick role-based teams, content pipelinesLess control over flow
AutoGenMulti-agent conversation, researchMore complex setup
LangGraphCustom graph control flowMore wiring needed
SmolagentsMinimal code-first agentsLess multi-agent support

Verified against CrewAI docs (docs.crewai.com), May 2026.

← AI Native Stack
© cvam — written in plaintext, served warm