Interested in running your own AI agents without spending hours setting up complicated environments? With CrewAI, you can build powerful multi-agent workflows in minutes — and yes, you can have it up and running in under five. This step-by-step beginner guide will walk you through the CrewAI install process, explain exactly what you need, and help you get your first agent deployed ASAP.
Whether you're a developer, automation enthusiast, or just exploring AI agent frameworks, this guide has everything you need for a quick, clean setup.
What Is CrewAI?
CrewAI is a Python-based framework for building and managing collaborative AI agents. Instead of working with a single LLM-based assistant, CrewAI allows you to create a team (or “crew”) of agents, each with a role, goal, and ability to interact with others.
CrewAI is perfect for:
- Automating multi-step tasks using AI
- Creating custom agent workflows (e.g., researcher → writer → editor)
- Integrating with APIs or other systems
- Experimenting with autonomous AI behavior
Before diving into the install, make sure you have Python 3.10+ and basic experience with terminal commands.
Step 1: Set Up Your Environment
🛠️ Prerequisites
Before you install CrewAI, ensure you’ve got the following:
- Python 3.10+
pip
(Python package installer)virtualenv
(for isolated Python environments — recommended)
🔍 Creating a Virtual Environment
It's a good practice to use a virtual environment to keep your dependencies clean. In your terminal, run:
python3 -m venv crewai-env
cd crewai-env
source bin/activate # On Windows, use `.\Scripts\activate`
Now you're ready to install CrewAI inside this environment.
Step 2: Install CrewAI Using pip
📦 Installing the Package
CrewAI is hosted on PyPI, so installation is as simple as:
pip install crewai
This will install CrewAI along with its dependencies like LangChain, pydantic, and OpenAI or HuggingFace integration if needed. Installation usually takes less than a minute.
💡 Tip
If you want to work with models without OpenAI, you can adapt CrewAI to use Ollama models locally (we’ll cover that in another guide).
Step 3: Build Your First CrewAI Script
Once CrewAI is installed, let’s create a simple two-agent script to understand how it works.
🤖 Example: Researcher and Writer Agents
Create a file named crew_example.py
and paste the following code:
from crewai import Agent, Task, Crew
# Initialize agents
researcher = Agent(
role="Researcher",
goal="Gather insights on recent AI trends",
backstory="An expert in market and tech research",
verbose=True
)
writer = Agent(
role="Content Writer",
goal="Write a blog post based on the research",
backstory="Skilled in turning ideas into engaging articles",
verbose=True
)
# Define tasks
task1 = Task(
description="Research the latest trends in AI from 2024",
agent=researcher
)
task2 = Task(
description="Using the research, write a beginner-friendly blog post",
agent=writer
)
# Create and run the crew
crew = Crew(agents=[researcher, writer], tasks=[task1, task2])
crew.kickoff()
Then run the script:
python crew_example.py
Voila! You’ve just created a basic multi-agent workflow using CrewAI.
Tip: You can expand this by creating more agents, adjusting roles, or connecting APIs.
Step 4: Set Up OpenAI Credentials (Optional)
If you're using OpenAI models, set the API key as an environment variable before running your script:
export OPENAI_API_KEY="your-api-key"
Or add it directly in code using LangChain's OpenAI()
constructor, if customizing.
Step 5: Run and Iterate
That’s it — you’ve completed the basic CrewAI install process in just a few minutes.
From here, you can:
- Add more agents with different goals
- Use tools like web search or file handlers (CrewAI supports LangChain Tools)
- Integrate with workflows from tools like n8n or external APIs
If you're already using tools like LangChain, you’ll find the CrewAI logic super intuitive.
Quick Overview: CrewAI Install Commands
Here’s a quick table of the key steps and the commands needed:
Task | Command |
---|---|
Create Virtual Env | python3 -m venv crewai-env |
Activate Env | source bin/activate (Mac/Linux) or .\\Scripts\\activate (Windows) |
Install CrewAI | pip install crewai |
Run Demo Script | python crew_example.py |
Set OpenAI Key (Optional) | export OPENAI_API_KEY="key" |
Pro Tip: Use CrewAI Together with Workflow Automation Tools
Want to integrate CrewAI into your daily workflows? Tools like n8n allow you to pass data between apps, trigger AI agents on demand, and monitor outputs — no code required.
For example, you could:
- Trigger a CrewAI agent when a new email arrives
- Use n8n to route agent output to Notion or Airtable
- Automate content production using a multi-agent pipeline
Check out our guide comparing CrewAI vs n8n to learn how to combine these powerful platforms.
FAQ
How do I update CrewAI?
Run the following command inside your virtual environment:
pip install --upgrade crewai
This will fetch the latest version from PyPI.
Can I use models other than OpenAI?
Yes! CrewAI supports various LLM providers including HuggingFace and local models. You’ll just need to configure LangChain accordingly. You can also integrate providers like Ollama for local inference.
What tools can CrewAI agents use?
CrewAI agents can use LangChain Tools — including web browsing, math, APIs, file managers, and more. You define the tools capable of being used by each agent during initialization.
How to fix “RuntimeError: Cannot Schedule New Futures” in CrewAI?
This is a common asynchronous threading issue in some environments. A full step-by-step fix is outlined in our CrewAI runtime error guide.
What’s the difference between CrewAI and LangChain?
LangChain is a modular framework for building with LLMs. CrewAI is built on top of LangChain and specializes in orchestrating interacting agents — it adds structure, roles, and collaboration layers that go beyond single-agent execution. For a deeper dive, see LangChain vs CrewAI.
Now that you’ve completed your CrewAI install, go ahead and experiment. Whether you're building research agents, AI assistants, or autonomous decision-makers — CrewAI gives you the flexibility to make it all happen in minutes.