Skip to content

Latest commit

 

History

History
283 lines (221 loc) · 9.9 KB

File metadata and controls

283 lines (221 loc) · 9.9 KB

Azure Agent Orchestrator

A multi-cloud AI agent orchestration system that enables Azure AI agents to coordinate and communicate with AWS Bedrock agents. This project demonstrates cross-cloud AI agent collaboration with "Large Marge" as the Azure-based orchestrator.

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Azure AI Projects                        │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │           Large Marge (Orchestrator)                   │ │
│  │         - Azure AI Agent                               │ │
│  │         - Manages rollcall coordination                │ │
│  │         - Uses fetch_rollcall() function              │ │
│  └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
                               │
                               │ calls
                               ▼
┌─────────────────────────────────────────────────────────────┐
│                 Multi-Agent Library                         │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │              execute_rollcall()                        │ │
│  │         - Parallel/Sequential execution                │ │
│  │         - Agent configuration management               │ │
│  │         - Result aggregation                           │ │
│  └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
                               │
                               │ orchestrates
                               ▼
┌─────────────────────────────────────────────────────────────┐
│                   AWS Bedrock Agents                       │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
│  │   Agent 1   │  │   Agent 2   │  │   Agent N   │        │
│  │             │  │             │  │             │        │
│  └─────────────┘  └─────────────┘  └─────────────┘        │
└─────────────────────────────────────────────────────────────┘

📂 Project Structure

azure_orch/
├── main.py              # Azure AI Agent orchestrator (Large Marge)
├── multi_agents.py      # Multi-agent library for AWS Bedrock coordination
├── .env                 # Environment configuration
├── requirements.txt     # Python dependencies
└── README.md           # This documentation

🚀 Features

  • Cross-Cloud Orchestration: Azure AI agent coordinating AWS Bedrock agents
  • Flexible Execution: Support for both parallel and sequential agent calls
  • Rich Reporting: Comprehensive rollcall results with success rates and detailed responses
  • Error Handling: Robust error handling and status reporting
  • Configurable: Environment-based configuration for easy deployment
  • Extensible: Library-based architecture for easy integration

📋 Prerequisites

  1. Azure AI Projects Setup:

    • Azure subscription with AI Projects enabled
    • Azure AI Project created and configured
    • Model deployment (e.g., GPT-4 mini) in your Azure AI Project
  2. AWS Bedrock Setup:

    • AWS account with Bedrock access
    • Bedrock agents created and configured
    • Proper AWS credentials configured locally
  3. Python Environment:

    • Python 3.8 or higher
    • Virtual environment (recommended)

⚙️ Installation

  1. Clone/Download the project:

    cd azure_orch
  2. Create and activate virtual environment:

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

    pip install -r requirements.txt
  4. Configure environment variables: Create/update .env file with your configuration:

    # Azure AI Configuration
    PROJECT_ENDPOINT=https://your-project.cognitiveservices.azure.com/
    MODEL_DEPLOYMENT_NAME=gpt-4o-mini
    USER_MESSAGE=I am taking roll call. Everyone check in and acknowledge.
    
    # AWS Bedrock Configuration
    AWS_REGION=us-west-2
    PROMPT=Hello from Large Marge! Please report in.
    
    # Bedrock Agents (add as many as needed)
    BEDROCK_AGENT_ID_1=your_agent_id_1
    BEDROCK_AGENT_ALIAS_ID_1=your_alias_id_1
    AGENT_NAME_1=Agent Alpha
    
    BEDROCK_AGENT_ID_2=your_agent_id_2
    BEDROCK_AGENT_ALIAS_ID_2=your_alias_id_2
    AGENT_NAME_2=Agent Beta
    
    # Add more agents as needed (up to 10)
  5. Configure AWS credentials (choose one method):

    • AWS CLI: aws configure
    • Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
    • IAM roles (if running on AWS)

🎯 Usage

Primary Execution (Azure Orchestrator)

Run the main Azure AI agent orchestrator:

python main.py

This will:

  1. Initialize "Large Marge" Azure AI agent
  2. Create a conversation thread
  3. Send the configured message to trigger rollcall
  4. Execute the fetch_rollcall() function
  5. Coordinate with AWS Bedrock agents
  6. Return comprehensive results

Standalone Multi-Agent Testing

Test the multi-agent library directly:

python multi_agents.py

This will:

  1. Load configured Bedrock agents
  2. Execute rollcall in synchronous mode
  3. Display detailed results and summary

Library Usage

You can also import and use the library programmatically:

import multi_agents

# Execute rollcall with default settings
results = multi_agents.execute_rollcall()

# Execute rollcall in parallel with custom prompt
results = multi_agents.execute_rollcall(
    prompt="Custom rollcall message", 
    parallel=True
)

# Get summary statistics
summary = multi_agents.get_rollcall_summary(results)

🔧 Configuration Details

Azure AI Configuration

  • PROJECT_ENDPOINT: Your Azure AI Project endpoint URL
  • MODEL_DEPLOYMENT_NAME: Name of your deployed model (e.g., gpt-4o-mini)
  • USER_MESSAGE: Message sent to Large Marge to trigger rollcall

AWS Bedrock Configuration

  • AWS_REGION: AWS region where your Bedrock agents are deployed
  • PROMPT: Default message sent to Bedrock agents
  • BEDROCK_AGENT_ID_X: Agent ID for agent number X
  • BEDROCK_AGENT_ALIAS_ID_X: Alias ID for agent number X
  • AGENT_NAME_X: Human-readable name for agent number X

📊 Expected Output

Azure Agent Response

{
  "status": "success",
  "summary": {
    "total_agents": 3,
    "successful": 2,
    "failed": 1,
    "success_rate": "66.7%"
  },
  "agent_responses": [
    {
      "name": "Agent Alpha",
      "success": true,
      "response": "Alpha reporting in from AWS Bedrock!",
      "error": ""
    }
  ],
  "orchestrator": "Large Marge from Azure"
}

Console Output

Created agent, ID: asst_xyz123
Created thread, ID: thread_abc789
Created message, ID: msg_def456
🤖 Calling Agent Alpha...
✅ Agent Alpha: Alpha reporting in from AWS Bedrock!
🤖 Calling Agent Beta...
✅ Agent Beta: Beta standing by and ready!
Run completed with status: RunStatus.COMPLETED
Role: assistant, Content: [{'type': 'text', 'text': {'value': 'Rollcall complete...'}}]
Deleted agent

🐛 Troubleshooting

Common Issues

  1. Azure Authentication Errors:

    • Ensure you're logged into Azure CLI: az login
    • Verify your Azure AI Project endpoint and model deployment
  2. AWS Bedrock Connection Issues:

    • Check AWS credentials: aws sts get-caller-identity
    • Verify Bedrock agent IDs and alias IDs
    • Ensure proper IAM permissions for Bedrock
  3. No Agents Configured:

    • Check .env file has valid BEDROCK_AGENT_ID_X and BEDROCK_AGENT_ALIAS_ID_X pairs
    • Agent numbering starts from 1 and must be sequential
  4. Module Import Errors:

    • Ensure virtual environment is activated
    • Run pip install -r requirements.txt again

Debug Mode

Add debugging to see detailed execution:

import logging
logging.basicConfig(level=logging.DEBUG)

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

This project is licensed under the MIT License.

🙋‍♀️ About Large Marge

Large Marge is the Azure-based orchestrator agent that coordinates rollcall across multiple cloud environments. She's responsible for:

  • Initiating rollcall sequences
  • Coordinating with AWS Bedrock agents
  • Aggregating and reporting results
  • Maintaining cross-cloud communication protocols

"Large Marge sends her regards from Azure!" 🚚