๐ ไธญๆReadme ็ฑไบa2aๅ่ฎฎๅ็บง๏ผไปฅๅ็taskๅๆไบmessage๏ผconversation็idไปmetadataไนๆนๆไบcontextId๏ผๆไปฅ่ฟ่กไบๅ็บงใ ๆจ่ๆๆฐA2A็ปๅADKๅMCPๅฎ็ฐๆดๅคๆไปปๅก็ๆนๆณ: https://github.com/johnson7788/MultiAgentPPT/tree/main/backend
A Fully Compatible Implementation of Google's Agent-to-Agent (A2A) Protocol with Model Context Protocol (MCP) Integration
A2A-MCP Serer Framework is a robust, production-ready solution that leverages Google's Agent-to-Agent (A2A) protocol and integrates seamlessly with the Model Context Protocol (MCP). This project is designed for building interoperable single and multi-agent systems with full compatibility with Google's official A2A code. It offers a clear structure, rich examples, and a full-stack, ready-to-use implementation for developers.
Key highlights:
- 100% A2A Compatibility: Built using Google's official A2A code for maximum interoperability.
- MCP Integration: First-class support for MCP, enabling agents to access external tools and data sources.
- Clear Structure: Well-organized project with comprehensive examples for single and multi-agent setups.
- Full-Stack Solution: Includes both backend (Python) and frontend (Node.js) components for immediate deployment.
- Rich Examples: Demonstrates practical use cases for both single-agent and multi-agent collaboration.
- Multi-LLM Model Support: Seamlessly integrates and supports various leading language models, including OpenAI, DeepSeek, Anthropic, Ollama, VLLM, Bytedance offering users flexibility and choice.
- Complete A2A Implementation: Adheres strictly to the official A2A specification.
- Flexible Agent Systems: Supports both single-agent and multi-agent workflows.
- MCP Tooling: Easily integrate external tools via MCP for enhanced agent capabilities.
- Production-Ready: Robust error handling and clear documentation for enterprise use.
- Developer-Friendly: Rich examples, intuitive setup, and minimal dependencies.
- Python 3.10+
- Node.js 16+
- pip for Python dependencies
- npm for frontend dependencies
- Clone the repository:
git clone https://github.com/johnson7788/A2AServer.git
- Install backend dependencies:
cd backend/A2AServer
pip install .
- Agent RAG:
cd backend/AgentRAG
python main.py --port 10005
cd frontend/single_agent
npm install
npm run dev
Open the frontend in your browser, add the agent, and start interacting through the Q&A interface.
graph TD
A[Frontend] --> B[Agent1]
B --> E[MCP Tool1]
B --> F[MCP Tool2]
Question โ Reasoning โ MCP Tool 1 โ Reasoning โ MCP Tool 2 โ Reasoning โ Answer
graph TD
A[ๅ็ซฏ] --> B[Agent1]
B --> C[Reasoning Text]
C --> D[MCP Tool1]
D --> F[Reasoning Text]
F --> E[MCP Tool2]
E --> G[Reasoning Text]
G --> H[Answer]
This section demonstrates how to set up a multi-agent system with collaboration between A2A agents.
- Agent RAG:
cd backend/AgentRAG
python main.py --port 10005
cd backend/DeepSearch
python main.py --port 10004
The host agent coordinates multiple A2A agents, manages their states, and decides which agent to use.
cd frontend/hostAgentAPI
pip install -r requirements.txt
python api.py
cd frontend/multiagent_front
npm install
npm run dev
- Open the frontend in your browser, add agents, and start interacting via the Q&A interface.
graph TD
A[Frontend] --> B[HostAgent]
B --> C[Agent1]
B --> D[Agent2]
D --> E[MCP Tool1]
D --> F[MCP Tool2]
C --> M[MCP Tool3]
A2AServer
โโโ backend
โ โโโ A2AServer # A2A server dependencies
โ โโโ AgentRAG # RAG-based A2A agent
โ โโโ DeepSearch # DeepSearch A2A agent example
โ โโโ client.py # A2A client for testing
โ โโโ hostAgentAPI # Host agent for multi-agent coordination
โโโ multiagent_front # Frontend for multi-agent collaboration
โโโ single_agent # Frontend for single-agent interaction
โโโ README.md # Project documentation
To create a custom A2A server, follow these steps:
- Copy the DeepSearch Example:
cp -r backend/DeepSearch backend/MyCustomAgent
- Directory Structure:
MyCustomAgent
โโโ .env # Environment file for model keys
โโโ main.py # A2A server startup script
โโโ mcp_config.json # MCP server configuration
โโโ mcpserver # MCP server code (optional)
โ โโโ my_tool.py # Custom MCP tool
โโโ prompt.txt # Agent prompt file
- Configure MCP Tools:
- Ensure tool names in
mcp_config.json
use camelCase (e.g.,MyCustomTool
) instead of underscores (e.g.,My_Custom_Tool
) to avoid lookup issues. - Example
mcp_config.json
:
{
"tools": [
{
"name": "MyCustomTool",
"description": "A custom tool for processing data",
"script": "mcpserver/my_tool.py"
}
]
}
- Run Your Server:
cd backend/MyCustomAgent
python main.py --port 10006
- Prompts: Please carefully experiment with your different prompts to achieve the best experience.
- MCP Tools: The naming and description of MCP tools, as well as the docstrings for MCP tool functions, must precisely align with the business logic to make them easy for the LLM to understand.
- Tool Naming: Use camelCase for tool names in
mcp_config.json
(e.g.,SearchTool
,RAGTool
) to ensure compatibility. - Environment Variables: Store API keys and sensitive data in the
.env
file. - Port Conflicts: Ensure unique ports for each agent to avoid conflicts.
- Single-Agent Interface: Simple, intuitive UI for interacting with a single A2A agent.
- Multi-Agent Collaboration: Host agent coordinates multiple A2A agents for complex tasks.
- MCP Integration: Seamless access to external tools and data via MCP.
- Rich Examples: Comprehensive examples for both single and multi-agent setups.
- Full-Stack: Backend and frontend components for immediate deployment.
- AI-Powered Assistants: Build intelligent assistants with single or multi-agent setups.
- Research Tools: Create collaborative agent systems for data analysis or search.
- Enterprise Workflows: Coordinate multiple agents for complex business processes.
- Educational Platforms: Demonstrate agent collaboration for learning purposes.
We welcome contributions! To get started:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/my-feature
). - Commit your changes (
git commit -m 'Add my feature'
). - Push to the branch (
git push origin feature/my-feature
). - Open a pull request.
See our contributing guide for more details.
This project draws inspiration from and gratefully acknowledges the contributions of the following open-source project:
- GitHub Issues: Report bugs or request features.
- GitHub Discussions: Ask questions and share ideas.
This project is licensed under the MIT License - Free for all.
Made with โค๏ธ by Johnson Guo
johnsongzc