build-with-ag2

AG2 Workshop: Building Multi-Agent Systems

A hands-on workshop teaching you to build, orchestrate, test, and deploy multi-agent AI systems using AG2.

23 episodes covering fundamentals through production deployment. Designed for YouTube (3-4 min per episode) and university programs (5 lectures).

Prerequisites

Getting Started

# Clone the repository
git clone https://github.com/ag2ai/build-with-ag2.git
cd build-with-ag2/ag2-workshop

# Set up your environment
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY

# Install dependencies
pip install -r requirements.txt

# Start with Episode 1
jupyter notebook episodes/ep01_why_agents.ipynb

Note: The .env file lives in ag2-workshop/ (one level above episodes/). Python-dotenv searches parent directories automatically, so load_dotenv() in notebooks will find it.

Episodes

Basics (Episodes 1-4)

# Title What You Build
1 Why Multi-Agent Systems? See agents in action (demo)
2 Your First Agent A single AI agent that chats
3 Give Your Agent Tools An agent that checks the weather
4 Two Agents Working Together Researcher + reviewer collaboration

Patterns (Episodes 5-9)

# Title What You Build
5 Team of Agents: Taking Turns 3-agent debate with round-robin
6 Team of Agents: Smart Speaker Selection LLM-driven speaker selection
7 Routing Agents: Conditions, Handoffs & Escalation Customer support triage system
8 Pipelines & Hierarchies Document pipeline + research hierarchy
9 Choosing the Right Pattern Decision framework (theory)

Applications (Episodes 10-15)

# Title What You Build
10 Build a Customer Service System Complete multi-agent app (guided)
11 Build a Research Assistant 3-agent research pipeline
12 Give Your Agents a Knowledge Base RAG-powered document Q&A
13 Web Browsing Agents Agent that fetches web content
14 Give Your Agent a UI Streamlit + AG-UI frontend
15 Connect to External Tools (MCP) MCP server integration

Production (Episodes 16-20)

# Title What You Build
16 See What Your Agents Are Doing Logging + OpenTelemetry tracing
17 Security & Safe Code Execution Input validation + approval gates
18 Testing Agents Unit tests + evaluation framework
19 Control Your Agent Costs Token tracking + model tiering
20 Deploy to Production (GCP) Docker + Cloud Run deployment

Specialized Patterns (Episodes 21-22)

# Title What You Build
21 Multiple Agents, One Task: Redundancy & Nested Chats Parallel agents + evaluator
22 Make Agents Think Harder: Tree of Thoughts ReasoningAgent with search strategies

Closing

# Title What You Learn
23 What’s Next AG2 Beta, ecosystem, future directions

Notebook Structure

Each episode notebook has two sections:

For Instructors

This workshop maps to 5 university lectures:

Lecture Episodes Focus
1. Foundations 1-4 Agent basics, tools, two-agent systems
2. Orchestration 5-9 Patterns, handoffs, decision framework
3. Applications 10-15 Real apps, RAG, web, UI, MCP
4. Production 16-20 Observability, security, testing, costs, deployment
5. Advanced 21-23 Specialized patterns, reasoning, future

Troubleshooting

See episodes/troubleshooting.md for common issues and fixes.

Resources