This repository contains practical examples demonstrating multi-agent orchestration patterns using the Microsoft Agent Framework.
Multi-agent systems enable complex task decomposition by coordinating multiple specialized AI agents. This repository showcases five distinct orchestration patterns, each with working Python examples that you can run and adapt for your own use cases.
| Pattern | Description |
|---|---|
| 01-SequentialAgents | Chain agents where output flows from one to the next |
| 02-ConcurrentAgents | Run multiple agents in parallel and aggregate results |
| 03-HandoffAgents | Triage agents that route to specialized handlers |
| 04-GroupChatAgents | Multi-agent discussions with manager or selector-based coordination |
| 05-MagenticAgents | Advanced orchestration with planning, checkpointing, and human-in-the-loop |
- Python 3.10 or later
- Azure OpenAI resource with a deployed model (e.g.,
gpt-4oorgpt-4.1) - Azure CLI installed and authenticated (
az login)
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/maf-multi-agent-patterns-python.git cd maf-multi-agent-patterns-python -
Create and activate a virtual environment
python -m venv venv # Windows venv\Scripts\activate # Linux/Mac source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
cp .env.example .env
Edit
.envwith your Azure OpenAI settings:AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/" AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="gpt-4o"
-
Authenticate with Azure
az login
-
Run a sample
cd 01-SequentialAgents python sequential_agents.py
maf-multi-agent-patterns-python/
├── .env.example # Environment variable template
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
├── README.md # This file
├── requirements.txt # Python dependencies
├── 01-SequentialAgents/ # Sequential pattern examples
├── 02-ConcurrentAgents/ # Concurrent pattern examples
├── 03-HandoffAgents/ # Handoff pattern examples
├── 04-GroupChatAgents/ # Group chat pattern examples
└── 05-MagenticAgents/ # Magentic pattern examples
| Variable | Description | Required |
|---|---|---|
AZURE_OPENAI_ENDPOINT |
Azure OpenAI resource endpoint | Yes |
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME |
Model deployment name (e.g., gpt-4o) |
Yes |
AZURE_OPENAI_API_VERSION |
API version (default: 2024-08-01-preview) |
No |
AZURE_AI_PROJECT_ENDPOINT |
Azure AI Foundry project endpoint (for code interpreter samples) | Some samples |
The sample code in this repository is based on and adapted from the Microsoft Agent Framework examples. The Agent Framework is an open-source SDK for building AI agents with Azure OpenAI and other model providers.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
