Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microsoft Agent Framework - Multi-Agent Orchestration Patterns

This project demonstrates five key multi-agent orchestration patterns using the real Microsoft Agent Framework, providing runnable examples that showcase different collaboration approaches inspired by Semantic Kernel patterns.

Patterns Implemented

Each pattern uses the real Microsoft Agent Framework with authentic APIs and orchestration builders:

  1. Sequential Orchestration (sequential/step1_sequential.py) - Uses SequentialBuilder
  2. Concurrent Orchestration (concurrent/step2_concurrent.py) - Uses ConcurrentBuilder
  3. Group Chat Orchestration (group_chat/step3_group_chat.py) - Uses WorkflowBuilder with custom executors
  4. Handoff Orchestration (handoff/step4_handoff.py) - Uses WorkflowBuilder with routing logic
  5. Magentic Orchestration (magentic/step5_magentic.py) - Uses MagenticBuilder with tool integration

Quick Start

1. Install Dependencies

pip install -r requirements.txt

This installs the real Microsoft Agent Framework packages:

  • agent-framework - Core framework components
  • agent-framework-azure-ai - Azure AI integration
  • azure-identity - Azure authentication

2. Authentication Setup

This project uses Azure CLI authentication with Azure OpenAI:

# Install Azure CLI (if not already installed)  
az login

3. Configure Environment

# Copy the environment template
cp .env.example .env

# Set your Azure OpenAI configuration in .env:
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=gpt-4o
AZURE_OPENAI_API_VERSION=2024-10-21

4. Verify Setup

# List available patterns
python -m agent_framework_patterns.cli --list

# Test all patterns
python agent_framework_patterns/test_all_patterns.py

4. Run Examples

Option A: Using CLI (Recommended)

# Run all patterns with default task
python agent_framework_patterns/cli.py all

# Run specific pattern
python agent_framework_patterns/cli.py sequential

# Run with custom task
python agent_framework_patterns/cli.py magentic --task "Design an AI-powered customer service system"

Option B: Direct Script Execution

# Sequential pattern - deterministic chain
python agent_framework_patterns/sequential/step1_sequential.py

# Concurrent pattern - parallel execution  
python agent_framework_patterns/concurrent/step2_concurrent.py

# Group Chat pattern - collaborative conversation
python agent_framework_patterns/group_chat/step3_group_chat.py

# Handoff pattern - dynamic delegation
python agent_framework_patterns/handoff/step4_handoff.py

# Magentic pattern - plan-driven collaboration
python agent_framework_patterns/magentic/step5_magentic.py

Web Dashboard UI

The project includes a modern Streamlit-based web dashboard that provides a professional interface for running all orchestration patterns with real-time monitoring and agent tracking.

Homepage

The main interface allows you to select orchestration patterns, configure business scenarios, and customize task inputs:

Homepage

Pattern In Progress

Real-time monitoring shows live agent execution with progress tracking, individual agent status, and sequential completion indicators:

Pattern In Progress

Completed Execution

Comprehensive results view displaying execution metrics, individual agent inputs/outputs, and detailed performance analytics:

Completed Execution

Running the Dashboard

# Start the web dashboard
cd web_ui
streamlit run dashboard_core.py

Pattern Explanations

Sequential Orchestration

When to use: Fixed workflows, step-by-step processing, pipeline scenarios

  • Chains agents: Planner → Researcher → Writer → Reviewer
  • Each agent receives full context and adds its output
  • Deterministic order and execution

Concurrent Orchestration

When to use: Independent analyses, parallel processing, ensemble decisions

  • Runs multiple agents simultaneously on same task
  • Aggregates diverse perspectives (e.g., Summarizer, ProsCons, RiskAssessor)
  • Reduces overall runtime

Group Chat Orchestration

When to use: Collaborative problem-solving, maker-checker loops, brainstorming

  • Managed conversation between agents (Maker, Checker, Moderator)
  • Supports human-in-the-loop interactions
  • Quality gates and consensus building

Handoff Orchestration

When to use: Dynamic routing, specialized expertise, customer support scenarios

  • Intelligent routing based on context (StatusAgent, ReturnsAgent, etc.)
  • Full ownership transfer between agents
  • Fallback to human when needed

Magentic Orchestration

When to use: Complex open-ended problems, planning + execution workflows

  • Planner decomposes tasks and selects appropriate agents
  • Dynamic agent selection and tool usage
  • Backtracking and plan refinement

Architecture

Common Modules

  • common/models.py - Model client factory for Azure OpenAI and GitHub Models
  • common/agents.py - Agent factory with domain-specific roles
  • common/tools.py - Simple tools for Magentic example

Environment Support

  • GitHub Models: Free for development, single endpoint, PAT authentication
  • Azure OpenAI: Enterprise-grade, requires deployment and API keys
  • Graceful fallbacks when credentials are missing

How This Mirrors Semantic Kernel

Each pattern provides functional parity with Semantic Kernel's orchestration samples:

  • Agent roles and instructions match SK sample personas
  • Control flow logic mirrors SK orchestration behavior
  • Human-in-the-loop patterns preserved
  • Streaming responses and error handling included

The key difference is using Agent Framework APIs instead of Semantic Kernel APIs, while maintaining the same orchestration patterns and agent collaboration behaviors.

Development Notes

  • All scripts are self-contained and runnable individually
  • Type annotations and error handling included
  • Graceful degradation when environment variables missing
  • Clear logging and trace output for debugging
  • Follows Agent Framework best practices

Testing

# Run all pattern examples to verify setup
python -m agent_framework_patterns.test_all_patterns

Support

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages