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.
- 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
.
├── 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
- Python 3.13 or higher
- uv package manager
- OpenAI API key
- Anthropic API key
# 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"
git clone <your-repo-url>
cd AWSEvent
# This will create a virtual environment and install all dependencies
uv sync
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
.
-
OpenAI API Key:
- Visit OpenAI Platform
- Sign up or log in
- Navigate to API Keys section
- Create a new secret key
-
Anthropic API Key:
- Visit Anthropic Console
- Sign up or log in
- Navigate to API Keys section
- Generate a new API key
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
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)
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?"
agent-squad[all,anthropic]>=1.0.2
: Multi-agent orchestration frameworkanthropic>=0.64.0
: Anthropic API clientopenai>=1.100.2
: OpenAI API clientpython-dotenv>=1.1.1
: Environment variable management
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
)
-
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
- Ensure your
-
Module Import Errors
- Run
uv sync
to ensure all dependencies are installed - Verify you're using Python 3.13 or higher
- Run
-
Network Issues
- Check your internet connection
- Verify API endpoints are accessible
- Consider firewall or proxy settings
- Check the agent-squad documentation
- Review API documentation for OpenAI and Anthropic
- Ensure your API keys have the necessary permissions and credits
This project is part of the AI Makerspace AWS Event demonstration materials.