Build autonomous AI agent teams with CrewAI - a lightweight Python framework for orchestrating role-playing AI agents that collaborate to solve complex tasks through flexible workflows and event-driven automation.
Build fast, flexible multi-agent AI systems with CrewAI - a lean Python framework for creating autonomous AI agents that work together seamlessly to tackle complex tasks.
CrewAI is a standalone Python framework (completely independent of LangChain) that enables you to orchestrate role-playing AI agents with either:
With over 100,000 certified developers, CrewAI is rapidly becoming the standard for enterprise-ready AI automation.
Use CrewAI when you need to:
Ensure you have Python 3.10, 3.11, 3.12, or 3.13 installed:
```bash
python --version
```
For basic installation:
```bash
pip install crewai
```
For installation with additional agent tools:
```bash
pip install 'crewai[tools]'
```
For installation with embedding support:
```bash
pip install 'crewai[embeddings]'
```
```bash
crewai create crew my_project
```
This creates a complete project structure with configuration files, agents, and tasks.
After creation, your project will have:
```
my_project/
├── .env # Environment variables
├── pyproject.toml # Project dependencies
├── README.md # Project documentation
└── src/
└── my_project/
├── main.py # Entry point
├── crew.py # Crew definition
├── config/
│ ├── agents.yaml # Agent configurations
│ └── tasks.yaml # Task definitions
└── tools/
└── custom_tool.py # Custom tools
```
Edit `src/my_project/config/agents.yaml`:
```yaml
researcher:
role: Senior Data Researcher
goal: Uncover cutting-edge developments in {topic}
backstory: >
You're a seasoned researcher with a knack for uncovering the latest
developments. Known for your ability to find relevant information
and present it clearly.
analyst:
role: Reporting Analyst
goal: Create detailed reports based on research findings
backstory: >
You're a meticulous analyst with a keen eye for detail. You turn
complex data into clear, actionable reports.
```
Edit `src/my_project/config/tasks.yaml`:
```yaml
research_task:
description: >
Conduct thorough research about {topic}.
Find interesting and relevant information for 2025.
expected_output: >
A list with 10 bullet points of the most relevant information
agent: researcher
reporting_task:
description: >
Review the research and create a detailed report on {topic}.
Include key findings, trends, and actionable insights.
expected_output: >
A comprehensive 3-paragraph report in markdown format
agent: analyst
```
Edit `src/my_project/crew.py`:
```python
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
@CrewBase
class MyProjectCrew():
"""MyProject crew"""
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'],
verbose=True
)
@agent
def analyst(self) -> Agent:
return Agent(
config=self.agents_config['analyst'],
verbose=True
)
@task
def research_task(self) -> Task:
return Task(
config=self.tasks_config['research_task'],
)
@task
def reporting_task(self) -> Task:
return Task(
config=self.tasks_config['reporting_task'],
output_file='report.md'
)
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=True,
)
```
Edit `src/my_project/main.py` and run:
```python
#!/usr/bin/env python
from my_project.crew import MyProjectCrew
def run():
inputs = {
'topic': 'AI Agents in 2025'
}
MyProjectCrew().crew().kickoff(inputs=inputs)
if __name__ == "__main__":
run()
```
Execute:
```bash
crewai run
```
Create event-driven workflows that combine Python code with AI agents:
```python
from crewai.flow.flow import Flow, listen, start
class ResearchFlow(Flow):
@start()
def fetch_data(self):
# Your data fetching logic
return {"data": "raw_data"}
@listen(fetch_data)
def analyze_data(self, data):
# Use a crew to analyze
result = MyCrew().crew().kickoff(inputs=data)
return result
```
Set your API key in `.env`:
```bash
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
```
Create tools in `src/my_project/tools/custom_tool.py`:
```python
from crewai_tools import BaseTool
class MyCustomTool(BaseTool):
name: str = "Custom Tool"
description: str = "Description of what the tool does"
def _run(self, argument: str) -> str:
# Your tool logic here
return "Result"
```
1. **Start Simple**: Begin with 2-3 agents and sequential process
2. **Clear Roles**: Give each agent a specific, well-defined purpose
3. **Specific Tasks**: Write clear task descriptions with expected outputs
4. **Iterate**: Test with simple inputs before scaling complexity
5. **Use Flows**: For production systems, combine Crews with Flows for control
6. **Monitor**: Use CrewAI's built-in observability features
7. **Customize Prompts**: Override default prompts for fine-grained control
**ModuleNotFoundError for tiktoken**:
```bash
pip install 'crewai[embeddings]'
```
**Building wheel failures**:
```bash
pip install --upgrade pip
pip install tiktoken --prefer-binary
```
**Agent not executing**:
1. Complete the official tutorials at learn.crewai.com
2. Explore example projects in the GitHub repository
3. Join the community forum for support
4. Try the Cloud Control Plane for observability
5. Build your first production application with Flows + Crews
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/crewai-multi-agent-framework/raw