Skip to content

AI-Maker-Space/AIE7-AWS-Agent-Squad-Event

Repository files navigation

AWS Event - Multi-Agent System Demo with AI Makerspace

This project demonstrates a multi-agent orchestration system using the agent-squad library, showcasing intelligent routing between specialized AI agents powered by OpenAI and Anthropic models.

Features

  • Multi-Agent Orchestration: Intelligent routing of user queries to specialized agents
  • Supervisor Pattern: Hierarchical agent management with team coordination
  • Streaming Responses: Real-time response streaming from AI agents
  • Multiple AI Providers: Support for both OpenAI and Anthropic models
  • Interactive Chat: Command-line interface for real-time agent interaction

Project Structure

.
├── SupervisorExample.py    # Demonstrates supervisor agent pattern with team coordination
├── quickstart.py          # Interactive multi-agent system with tech and health specialists
├── main.py               # Basic project entry point
├── pyproject.toml        # Project dependencies and configuration
└── README.md            # This file

Prerequisites

  • Python 3.13 or higher
  • uv package manager
  • OpenAI API key
  • Anthropic API key

Setup

1. Install uv (if not already installed)

# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# On Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

2. Clone and navigate to the project

git clone <your-repo-url>
cd AWSEvent

3. Sync the environment with uv

# This will create a virtual environment and install all dependencies
uv sync

4. Set up environment variables

Create a .env file in the root directory with your API keys:

# .env file
OPENAI_API_KEY=your_openai_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here

Important: Never commit your .env file to version control. It's already included in .gitignore.

Getting API Keys

  • OpenAI API Key:

    1. Visit OpenAI Platform
    2. Sign up or log in
    3. Navigate to API Keys section
    4. Create a new secret key
  • Anthropic API Key:

    1. Visit Anthropic Console
    2. Sign up or log in
    3. Navigate to API Keys section
    4. Generate a new API key

Usage

Running the Examples

Supervisor Agent Example

Demonstrates a hierarchical agent system with a supervisor coordinating specialized team members:

uv run python SupervisorExample.py

This example shows:

  • Team Lead supervisor agent
  • Specialized Tech Support agent
  • Specialized Billing Expert agent
  • Automatic routing based on query content

Interactive Multi-Agent System

Provides an interactive command-line interface for real-time agent interaction:

uv run python quickstart.py

This example features:

  • Tech Agent: Specializes in technology, software, AI, cybersecurity, etc.
  • Health Agent: Focuses on health, medical topics, wellness, nutrition, etc.
  • Real-time streaming responses
  • Interactive chat interface (type 'quit' to exit)

Example Interactions

For SupervisorExample.py:

  • The system automatically processes: "I'm having issues with my bill and the mobile app"
  • Routes to appropriate specialist agents based on content

For quickstart.py:

  • Try: "How do I optimize my Python code for better performance?"
  • Try: "What are the benefits of regular exercise?"
  • Try: "Explain machine learning algorithms"
  • Try: "What should I eat for better heart health?"

Development

Project Dependencies

  • agent-squad[all,anthropic]>=1.0.2: Multi-agent orchestration framework
  • anthropic>=0.64.0: Anthropic API client
  • openai>=1.100.2: OpenAI API client
  • python-dotenv>=1.1.1: Environment variable management

Configuration

The agent system can be configured through AgentSquadConfig:

options=AgentSquadConfig(
    LOG_AGENT_CHAT=True,              # Log agent conversations
    LOG_CLASSIFIER_CHAT=True,         # Log classifier decisions
    LOG_CLASSIFIER_RAW_OUTPUT=True,   # Log raw classifier output
    LOG_CLASSIFIER_OUTPUT=True,       # Log processed classifier output
    LOG_EXECUTION_TIMES=True,         # Log execution timing
    MAX_RETRIES=3,                    # Maximum retry attempts
    USE_DEFAULT_AGENT_IF_NONE_IDENTIFIED=True,  # Fallback behavior
    MAX_MESSAGE_PAIRS_PER_AGENT=10    # Conversation length limit
)

Troubleshooting

Common Issues

  1. API Key Errors

    • Ensure your .env file is in the project root
    • Verify API keys are valid and have sufficient credits
    • Check that environment variables are loaded correctly
  2. Module Import Errors

    • Run uv sync to ensure all dependencies are installed
    • Verify you're using Python 3.13 or higher
  3. Network Issues

    • Check your internet connection
    • Verify API endpoints are accessible
    • Consider firewall or proxy settings

Getting Help

License

This project is part of the AI Makerspace AWS Event demonstration materials.

About

A small example of how to use AWS' Agent Squad Framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages