Skip to content

Latest commit

 

History

History
225 lines (167 loc) · 5.78 KB

File metadata and controls

225 lines (167 loc) · 5.78 KB

CrewAI Crash Course 🚀

A comprehensive, hands-on tutorial and learning resource for CrewAI - the powerful framework for building multi-agent AI systems. This repository contains practical examples, step-by-step guides, and real-world implementations covering all aspects of CrewAI development.

📋 Overview

CrewAI Crash Course is your complete guide to mastering CrewAI, featuring:

  • 7 comprehensive modules covering everything from basics to advanced topics
  • Hands-on examples with real code you can run immediately
  • Best practices and production-ready patterns
  • Observability integration with LangTrace
  • Knowledge management techniques
  • LLM integration (OpenAI, Anthropic Claude, local LLMs with Ollama)

🎯 What is CrewAI?

CrewAI is a cutting-edge framework for orchestrating role-playing, autonomous AI agents. It enables you to build sophisticated multi-agent systems where agents collaborate to solve complex tasks.

✨ Features

📚 Module 1: Basics

  • Create crews programmatically
  • Configure crews using YAML
  • Agent and task management

📋 Module 2: Tasks

  • Access task outputs (Pydantic & JSON)
  • Task dependencies and chaining
  • Task callbacks
  • Guardrail validations

👥 Module 3: Crew Management

  • Access crew outputs
  • Crew orchestration patterns

🛠️ Module 4: Tools Integration

  • Using tools with tasks
  • Custom tool development

📖 Module 5: Knowledge Management

  • Reading files as knowledge
  • Knowledge base integration

🤖 Module 6: LLM Integration

  • Local LLM setup with Ollama
  • Anthropic Claude integration
  • Any LLM provider support

📊 Module 7: Observability

  • Tracing with LangTrace
  • Performance monitoring
  • Debugging and logging

🏗️ Project Structure

CrewAI-Crash-Course/
├── knowledge/                      # Sample knowledge files
│   ├── customer.json
│   ├── products.txt
│   └── transactions.xlsx
├── src/
│   ├── 1_basics/                  # Basic crew creation
│   ├── 2_tasks/                   # Task management
│   ├── 3_crew/                    # Crew operations
│   ├── 4_tools/                   # Tool integration
│   ├── 5_knowledge/               # Knowledge management
│   ├── 6_llm/                     # LLM integrations
│   └── 7_observability/           # Monitoring & tracing
└── pyproject.toml

🚀 Getting Started

Prerequisites

  • Python 3.8+
  • pip or uv package manager
  • (Optional) OpenAI API key or Anthropic API key for cloud LLMs
  • (Optional) Ollama for local LLM support

Installation

  1. Clone the repository:
git clone https://github.com/bhanuchaddha/CrewAI-Crash-Course.git
cd CrewAI-Crash-Course
  1. Create virtual environment:
uv venv
# or
python -m venv venv
  1. Activate virtual environment:
source venv/bin/activate  # On macOS/Linux
# or
venv\Scripts\activate  # On Windows
  1. Install dependencies:
uv pip install -e .
# or
pip install -e .

Quick Start Example

from crewai import Agent, Crew, Task

# Create an agent
agent = Agent(
    name="Researcher",
    role="Research Analyst",
    goal="Provide accurate research",
    backstory="Expert researcher with attention to detail"
)

# Create a task
task = Task(
    description="Research the latest AI trends",
    expected_output="A comprehensive report on AI trends",
    agent=agent
)

# Create and run crew
crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()
print(result)

📖 Module Guide

Module 1: Basics

Learn how to create crews both programmatically and using YAML configuration files.

Module 2: Tasks

Master task management including dependencies, callbacks, and output handling.

Module 3: Crew Management

Understand crew orchestration and output management.

Module 4: Tools

Integrate custom tools and external APIs with your agents.

Module 5: Knowledge

Feed your agents with structured knowledge from files and databases.

Module 6: LLM Integration

Configure different LLM providers and optimize for cost and performance.

Module 7: Observability

Monitor, trace, and debug your AI agent systems.

🔧 Configuration

Environment Variables

Create a .env file for API keys:

OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here

YAML Configuration

Example agents.yaml:

agents:
  - name: Researcher
    role: Research Analyst
    goal: Provide accurate research

📝 Examples

Each module contains multiple examples demonstrating different aspects of CrewAI. Navigate to the specific module directory and run the examples:

cd src/1_basics
python 1_create_crew_programmatically.py

🎓 Learning Path

  1. Start with Module 1 - Understand the basics
  2. Move to Module 2 - Learn task management
  3. Explore Modules 3-4 - Advanced crew features
  4. Integrate knowledge - Module 5
  5. Configure LLMs - Module 6
  6. Add observability - Module 7

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is open source and available for educational purposes.

🔗 Resources

🌟 Star History

If you find this repository helpful, please consider giving it a star! ⭐


Built with ❤️ for the AI agent community