This console application demonstrates the implementation of Agent 2 Agent protocol using Microsoft Semantic Kernel with Azure OpenAI. The application supports both built-in AI agents and custom deployed agents across AWS, Azure, and GCP platforms.
- Agent 2 Agent Protocol: Implements Google's Agent 2 Agent communication protocol
- Custom Agent Integration: Connect to your own deployed AI agents across cloud platforms
- Multi-Cloud Agents: Built-in agents representing AWS, Azure, and GCP platforms
- Configurable Workflow: Mix and match custom and built-in agents
- Sequential Workflow: Tasks are delegated across agents in sequence
- Unique Agent Identities: Each agent has a unique human name and favorite rainbow color
- Response Aggregation: Collects and summarizes responses from all agents
- Error Handling: Graceful handling of agent failures with fallback responses
-
Install Dependencies:
pip install -r requirements.txt
-
Configure Azure OpenAI:
- Update the
.envfile with your Azure OpenAI credentials:AZURE_OPENAI_API_KEY: Your Azure OpenAI API keyAZURE_OPENAI_ENDPOINT: Your Azure OpenAI endpointAZURE_OPENAI_DEPLOYMENT_NAME: Your GPT model deployment nameAZURE_OPENAI_API_VERSION: API version (default: 2024-11-20)
- Update the
-
Configure Custom Agents (Optional):
python config_manager.py
Or manually edit
custom_agents.envto add your deployed agents. -
Run the Application:
python main.py
You can integrate your own deployed AI agents using the configuration manager:
python config_manager.pyThis interactive tool allows you to:
- Add custom agent endpoints
- Enable/disable custom agents
- Test agent connectivity
- View configuration status
Edit custom_agents.env to add your agents:
# Enable custom agents
USE_CUSTOM_AGENTS=true
USE_BUILTIN_AGENTS=true
# AWS Custom Agent Example
AWS_AGENT_1_NAME=MyCustomAWS-DataProcessor
AWS_AGENT_1_ENDPOINT=https://my-aws-agent.amazonaws.com/api/chat
AWS_AGENT_1_API_KEY=your-api-key
AWS_AGENT_1_COLOR=RedYour deployed agents should accept POST requests with this JSON structure:
{
"message": "task description",
"context": "additional context",
"agent_info": {
"name": "agent name",
"platform": "cloud platform",
"favorite_color": "color"
},
"metadata": {
"timestamp": 1234567890,
"session_id": "session_id"
}
}And return responses in one of these formats:
{"message": "response text"}
{"response": "response text"}
{"content": "response text"}
{"data": {"message": "response text"}}Or OpenAI-compatible format with choices array.
- Alexandra (AWS) - Favorite Color: Red
- Benjamin (Azure) - Favorite Color: Orange
- Catherine (GCP) - Favorite Color: Yellow
- David (AWS) - Favorite Color: Green
- Elena (Azure) - Favorite Color: Blue
- Francis (GCP) - Favorite Color: Indigo
- Gabriel (Multi-Cloud) - Favorite Color: Violet
- AWS: Amazon EC2, ECS, Lambda deployments
- Azure: App Service, Container Instances, Functions
- GCP: Cloud Run, Compute Engine, Cloud Functions
- Multi-Cloud: Cross-platform orchestrators
- Agent Discovery: Load configured custom and built-in agents
- Task Delegation: Main task is delegated to each agent sequentially
- Agent Processing: Each agent processes the task while maintaining their identity
- Response Collection: Responses are collected from both custom and built-in agents
- Aggregation: Final report aggregates all agent responses with platform and type information
USE_CUSTOM_AGENTS: Enable/disable custom deployed agentsUSE_BUILTIN_AGENTS: Enable/disable built-in Semantic Kernel agentsCUSTOM_AGENT_TIMEOUT: Timeout for custom agent requests (seconds)CUSTOM_AGENT_RETRIES: Number of retry attempts for failed requests
- Test Setup:
python test_setup.py - Demo Mode:
python demo.py(no API keys required) - Config Manager:
python config_manager.py - Connectivity Test: Built into config manager
The application produces:
- Real-time progress updates during workflow execution
- Agent type identification (Custom vs Built-in)
- Individual agent responses with cloud platform and favorite color
- Final aggregated report summarizing all agent contributions
- Cloud platform grouping and summary statistics
- Error handling and fallback responses for failed agents