A framework for creating AG2 (formerly AutoGen) agents that communicate using the A2A Protocol and leverage tools via MCP.
AG2A makes it simple to:
- Define agents using JSON specifications
- Connect AG2 agents with MCP-powered tools
- Expose agents via the standardized A2A protocol
- Build multi-agent systems that communicate seamlessly
# Install from PyPI
pip install ag2a
# Install with dev dependencies
pip install ag2a[dev]
Create a JSON file with your agent's specification:
{
"name": "MyAssistant",
"system_message": "You are a helpful assistant that answers questions concisely.",
"model": "gpt-4o",
"temperature": 0.7
}
Start the agent server:
# Export your API key
export OPENAI_API_KEY=your-api-key-here
# Run the agent with your specification
python -m ag2a --spec agent_spec.json --port 8080
The agent now exposes an A2A protocol endpoint at http://localhost:8080
. You can connect to it using any A2A-compatible client.
To use MCP tools, add an mcp_command
to your agent spec:
{
"name": "YoutubeAssistant",
"system_message": "You can help with analyzing YouTube videos.",
"model": "gpt-4o",
"mcp_command": "mcp-youtube"
}
For agents that need structured output, you can specify a Pydantic response model:
python -m ag2a --spec agent_spec.json --response-model my_module.ResponseModel
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.