Skip to main content
Watch: Claude Code Just Killed After Effects
Agents

Build AI agents with CrewAI

CrewAI lets you compose multi-agent teams with role-based prompting. Each agent has a goal, a backstory, and tools - then a Crew orchestrates them.

Prerequisites

  • +Python 3.10+
  • +OpenAI API key
  • +pip

Step-by-Step

  1. 1

    Install CrewAI

    The crewai package ships the core orchestrator. Add crewai-tools for built-in integrations.

    pip install crewai crewai-tools
  2. 2

    Define agents

    Each agent is a role + goal + backstory. Think of these as system prompts with structure.

    from crewai import Agent
    researcher = Agent(
      role='Senior Researcher',
      goal='Find the most recent verified facts about {topic}',
      backstory='You are obsessive about citations.',
      llm='gpt-4o-mini'
    )
  3. 3

    Define tasks

    Tasks are units of work assigned to agents. Be explicit about expected output format.

    from crewai import Task
    research_task = Task(
      description='Research {topic} and produce a markdown brief with citations.',
      expected_output='A markdown document, 500-800 words, with at least 5 citations.',
      agent=researcher
    )
  4. 4

    Assemble the crew

    Sequential process is simplest. Hierarchical lets a manager agent route work dynamically.

    from crewai import Crew, Process
    crew = Crew(
      agents=[researcher, writer],
      tasks=[research_task, write_task],
      process=Process.sequential
    )
    result = crew.kickoff(inputs={ 'topic': 'pgvector vs pinecone' })
  5. 5

    Add tools

    Wrap any callable as a tool. Use crewai-tools for search, scraping, file ops out of the box.

    from crewai_tools import SerperDevTool
    researcher.tools = [SerperDevTool()]
  6. 6

    Inspect outputs

    kickoff() returns a CrewOutput with raw text, JSON, and per-task results. Log the whole thing during dev.

Common Pitfalls

  • !Vague backstories produce vague outputs. Be specific - tone, expertise, constraints.
  • !Too many agents (>5) collapses into noise. Start with 2-3.
  • !Forgetting expected_output makes the next task brittle.
From the Developers Digest stack

Agent Hub

Run, monitor, and orchestrate your agent fleet from one dashboard. Built for multi-agent teams.

What's Next

  • ->Move to Process.hierarchical for dynamic routing.
  • ->Wrap your crew in a FastAPI endpoint for production.

More Build AI agents

AI Development Stack

Get Smarter About AI Dev

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.

One email per weekReal code, not theoryFree forever