Content
# A2A Agent System with MGX-Inspired Team Collaboration
A comprehensive **Agent-to-Agent (A2A)** protocol implementation featuring **MGX-inspired multi-agent team collaboration**. This system combines the power of A2A interoperability with the innovative team-based approach found in MGX (<https://mgx.dev/>).
## 🌟 New MGX-Inspired Features
### 24/7 AI Development Team
Inspired by MGX's "Dream, Chat, Create" philosophy, our system now includes a specialized AI team:
- **👨💼 Mike** - Team Leader (Project coordination, strategic planning)
- **👨💻 Alex** - Engineer (Full-stack development, DevOps)
- **👩💼 Emma** - Product Manager (UX research, feature planning)
- **👨🔬 David** - Data Analyst (ML, analytics, visualization)
- **👨🏗️ Bob** - Architect (System design, scalability)
- **👩🎨 Sophia** - UI Designer (Interface design, prototyping)
### Team Collaboration Features
- **Project Creation**: Team analyzes requirements and assigns appropriate members
- **Multi-Agent Discussions**: Specialized agents contribute their expertise
- **Code Generation**: Team creates artifacts and components
- **Project Management**: Track progress and manage workflows
## 🌟 Key Features
- **Fully A2A Protocol Compliant**: Complete implementation of Google A2A standard specifications
- **Multi-AI Model Support**: Integration of various AI services such as OpenAI, Anthropic, Google, Cohere, etc.
- **Flexible Skill System**: Easily extensible modular skill architecture
- **RESTful API**: Standard HTTP/JSON-RPC 2.0 based interface
- **Real-time Streaming**: Real-time responses via Server-Sent Events
- **Security**: Support for standard web authentication methods (API Key, Bearer Token)
## 📋 System Requirements
- Python 3.8+
- FastAPI, uvicorn
- requests, aiohttp
- python-dotenv
- AI service API keys (optional)
## 🚀 Quick Start
### 1. Environment Setup
```bash
# Install dependencies
pip install -r requirements.txt
# Setup environment (interactive)
python setup_env.py
```
### 2. Set API Keys
When you run the setup script, you can enter the following API keys:
- **OpenAI API Key**: For text generation and analysis features
- **Anthropic API Key**: For using the Claude model (optional)
- **Google API Key**: For using the Gemini model (optional)
- **Cohere API Key**: For using the Cohere model (optional)
- **Weather API Key**: For weather information features (optional)
### 3. Run the Server
```bash
# Start the A2A agent server
python run_server.py
```
Once the server is running, you can access it at the following URLs:
- **Agent Card**: <http://localhost:8000/agent-card>
- **A2A Endpoint**: <http://localhost:8000/a2a>
- **Health Check**: <http://localhost:8000/health>
- **Skill List**: <http://localhost:8000/skills>
### 4. Client Testing
```bash
# Test the agent with the client
python a2a_client.py
```
## 📖 Usage Examples
### Using the Python Client
```python
from a2a_client import A2AClient
# Create a client
client = A2AClient("http://localhost:8000")
# Check agent information
client.print_agent_info()
# Chat
response = client.chat_with_agent("Hello, can you help me?")
print(response)
# Execute a specific skill
result = client.execute_skill("text_generation", {
"prompt": "Write a short story about AI",
"max_tokens": 500
})
print(result)
```
### Direct API Calls via cURL
```bash
# Retrieve Agent Card
curl http://localhost:8000/agent-card
# Create a task
curl -X POST http://localhost:8000/a2a \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "task/create",
"id": "1"
}'
# Send a message
curl -X POST http://localhost:8000/a2a \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "task/message",
"params": {
"task_id": "your-task-id",
"message": {
"role": "user",
"parts": [{"type": "text", "content": "Hello!"}]
}
},
"id": "2"
}'
```
## 🔧 Configuration Options
### Environment Variables
You can adjust the following settings in the `.env` file:
```env
# AI service API keys
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
GOOGLE_API_KEY=your_google_key
# Agent settings
A2A_AGENT_NAME=MyCustomAgent
A2A_AGENT_PORT=8000
A2A_AGENT_HOST=localhost
```
### Customization
#### Adding New Skills
You can add new skills in `skills.py`:
```python
async def _new_skill(self, parameters: Dict[str, Any]) -> Dict[str, Any]:
"""Implement new skill"""
# Skill logic implementation
return {"success": True, "result": "Skill result"}
```
#### Modifying the Agent Card
You can modify the agent's metadata in `agent_card.py`.
## 🌐 A2A Protocol Compatibility
This system fully implements A2A protocol version 0.2.1:
- ✅ JSON-RPC 2.0 over HTTP(S)
- ✅ Agent Card specification
- ✅ Task lifecycle management
- ✅ Message exchange
- ✅ Skill execution
- ✅ Streaming support (coming soon)
- ✅ Authentication and authorization
## 🔗 Connecting with Other A2A Agents
This agent implements the standard A2A protocol, allowing easy connections with other A2A compatible agents:
```python
# Connect to another A2A agent
other_agent = A2AClient("http://other-agent:8000")
# Chain agents
response1 = other_agent.chat_with_agent("Please analyze the data")
response2 = client.chat_with_agent(f"Please summarize this result: {response1}")
```
## 📚 Additional Resources
- [Official A2A Protocol Documentation](https://google-a2a.github.io/A2A/)
- [A2A GitHub Repository](https://github.com/google-a2a/A2A)
- [A2A Python SDK](https://github.com/google-a2a/a2a-python)
## 🤝 Contributing
If you would like to contribute to this project:
1. Fork this repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request
## 📄 License
Distributed under the MIT License.
## 🔧 Troubleshooting
### Common Issues
**Q: The server won't start**
A: Check if the `.env` file is correctly set up and if port 8000 is available.
**Q: OpenAI API error occurs**
A: Verify that the API key is correct and that you have sufficient credits.
**Q: I want to use a different port**
A: Change `A2A_AGENT_PORT` in the `.env` file or run it like `python run_server.py --port 9000`.
If you need more help, please create an Issue!
## 🎯 Next Steps
1. **Enhanced UI**: Web interface for team interactions
2. **Persistent Storage**: Database for projects and artifacts
3. **Real-time Updates**: WebSocket support for live collaboration
4. **Agent Marketplace**: Discover and integrate other A2A agents
5. **Advanced Workflows**: Complex multi-step project automation
## 🤖 Inspiration
This project draws inspiration from:
- **MGX (<https://mgx.dev/>)**: Revolutionary AI team collaboration concept
- **A2A Protocol**: Interoperable agent communication standard
- **Multi-Agent Systems**: Academic research in agent collaboration
The goal is to combine MGX's innovative team-based approach with the openness and interoperability of the A2A protocol.
---
**Ready to experience the future of AI team collaboration? Start your A2A MGX-inspired agent system today!**