Skip to main content

What is Crew AI?

Necati Ozmen
CMO @VoltAgent-Feeling Irie ⚡
6 min read

Introduction

Something quite interesting is happening in the realm of AI building these days. We would try to do it all with a single big AI model before. Now we can build AI agents with different expertise and run them as a team.

One of the leading brands in this market is CrewAI. With this Python library developed by João Moura, you can control your AI agents like you're in a real office. Each agent occupies its own specific role, one is a researcher, another is an analyst, and another is a writer.

From Old-Style AI to Smart Agents

Remember when we used to ask ChatGPT some question and only get a text response? Such times are in the past now. Now AI does not just talk, but also does work.

How is this possible? Consider it in the following way: While standard AI can do nothing but talk, agents can:

Build work schedules - They plan on their own "How do I get this done?" Run tools - They read from databases, call APIs, perform computations Draw on past experience - They learn from past experience Make their own decision - They naturally get responses to "What do I do here?"

So, AI is no longer an answer-question machine, but transformed into actual cooperative assistants.

Why One Agent Is Not Enough?

Think this through: in a company, can one person be an accountant, a marketer, and a developer at the same time? Absolutely not. The same is true for AI agents too.

Problems we face dealing with a single agent:

  • Overwhelmed by too much work
  • Can't excel in all, is shallow
  • When it fails at one place, the whole job falls apart
  • Freezes when big projects are onboard

That's why multi-agent systems like CrewAI make sense. Just like in real life, each of us has something special to do.

For example, when preparing a blog post:

  • Research agent does thorough research on the topic
  • Editor agent proofreads and formats the text
  • SEO specialist agent optimizes keywords

Each of them does its own thing, interacts with others, and finally the awesome output is created. Like sweet cooperation.

crew ai one agent problem

Inside CrewAI

To get an idea of what CrewAI is, imagine a movie set. Just as in a film there are various roles such as director, cameraman, sound engineer, in CrewAI every agent has a special job to perform.

CrewAI, which is based on LangChain technology, functions with fairly straightforward logic. When designing each agent, you specify three things:

agent = Agent(
role='Data Scientist',
goal='Analyze customer data and provide insights',
backstory='You are an experienced data scientist. You are a machine learning and stats expert.'
)

So every agent will have:

  • What it is supposed to do (role)
  • What it is trying to achieve (goal)
  • What abilities it possesses (backstory)

That's simple!

inside crew ai

Agent Toolboxes

Just like a mechanic has several tools, every agent will need its own collection of special tools. CrewAI offers ridiculously rich possibilities in this area.

Some examples of pre-built tools:

  • Terminal commands that can search in JSON files
  • Terminal commands that conduct code research in GitHub
  • Terminal commands that scan YouTube channels
  • Terminal commands that can execute terminal commands

Of course, you can also write your own custom tools. APIs, special calculations, cache systems - you can implement whatever is necessary.

Defining Tasks

You need to specifically tell each agent what to do. Just as describing a job to an employee:

data_collection = Task(
description='Gather data from customer interactions',
expected_output='Structured dataset for analysis',
agent=data_science_agent,
)

You can have things done sequentially or in parallel, and you can pass results of one to another task as input. You can also get results in the format you desire (JSON, file, etc.).

Controlling Your Workflow

There are three different work styles in CrewAI:

Sequential Work: Like an assembly line. One agent finishes its task and transfers it to the second, the third. Classical workflow.

Hierarchical Work: An automatic manager agent is created and it distributes work to all. Think of company hierarchy.

Consensus: (Under construction) Agents will vote among themselves and decide. A democratic approach.

organizing agents

Creating the Team

In the final step, you gather everybody:

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

And there you are! Your team is ready to go.

LLM Integration and Flexibility

One of the best features of CrewAI is LLM flexibility:

  • OpenAI GPT-4 (default)
  • Google AI models
  • Anthropic Claude
  • IBM Granite series
  • Local models (with Ollama)
  • Any LangChain compatible model

This flexibility allows you to choose different LLMs for different agents. You can, for example, use Code Llama for a code agent and GPT-4 for a writing agent.

llm integration crewai

Real-World Use Cases

📝 Content Creation

  • Research Agent: Collects information about the topic
  • Writing Agent: Writes articles based on collected information
  • Editor Agent: Edits and organizes the writing

📧 Email Management

  • Filter Agent: Retrieves important emails
  • Analysis Agent: Analyzes email content
  • Response Agent: Automatically generates response drafts

📈 Financial Analysis

  • Data Collection Agent: Collects company financial information
  • Analysis Agent: Performs technical and fundamental analysis
  • Report Agent: Generates investment recommendation reports

🎯 Social Media Management

  • Content Planning Agent: Creates post calendar
  • Visual Agent: Prepares visuals
  • Interaction Agent: Handles comments

Alternative: VoltAgent Framework

CrewAI's multi-agent solution is great, but every project won't need this degree of complexity. If you desire a faster and simpler solution, VoltAgent offers the perfect substitute.

⚡ What's VoltAgent?

VoltOps LLM Observability Platform Chat Example

VoltAgent is a new AI agent framework developed in TypeScript. It offers fast and efficient solutions with a different approach.

Key features:

  • Modern TypeScript: Type safety and modern developer experience
  • Web-native: Works effortlessly in browser and Node.js environments
  • Lightweight architecture: Minimal dependencies, fast startup
  • Real-time monitoring: Advanced observability and debugging
  • Easy integration: Can be instantly added to existing web projects