Skip to content

ili-meco/MAF-Multi-Agent-Patterns-Python

Repository files navigation

Multi-Agent Patterns in Python

This repository contains practical examples demonstrating multi-agent orchestration patterns using the Microsoft Agent Framework.

Multi-Agent Orchestration Patterns

Overview

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.

Patterns

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

Prerequisites

  • Python 3.10 or later
  • Azure OpenAI resource with a deployed model (e.g., gpt-4o or gpt-4.1)
  • Azure CLI installed and authenticated (az login)

Quick Start

  1. Clone the repository

    git clone https://github.com/YOUR_USERNAME/maf-multi-agent-patterns-python.git
    cd maf-multi-agent-patterns-python
  2. Create and activate a virtual environment

    python -m venv venv
    
    # Windows
    venv\Scripts\activate
    
    # Linux/Mac
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    cp .env.example .env

    Edit .env with your Azure OpenAI settings:

    AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
    AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="gpt-4o"
  5. Authenticate with Azure

    az login
  6. Run a sample

    cd 01-SequentialAgents
    python sequential_agents.py

Project Structure

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

Environment Variables

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

Attribution

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

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

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages