Agent-to-Agent vs Master Control Program communication patterns
Project description
A2A vs MCP Agent Demo
This project demonstrates two different approaches to agent communication:
- Master Control Program (MCP) - A centralized server-based approach where agents communicate through a central server
- Agent-to-Agent (A2A) - A decentralized peer-to-peer approach where agents communicate directly with each other
Installation
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Usage
MCP Server and Agents
- Start the MCP server:
python cli.py run-mcp-server
- In separate terminals, start one or more MCP agents:
python cli.py run-mcp-agent --agent-id agent1
python cli.py run-mcp-agent --agent-id agent2
The MCP server will track all connected agents and their status. You can view the status by opening http://localhost:5000 in your browser.
A2A (Agent-to-Agent) Network
- Start the first A2A agent:
python cli.py run-a2a-agent --agent-id a2a1 --port 5001
- Start additional A2A agents, connecting them to existing agents:
python cli.py run-a2a-agent --agent-id a2a2 --port 5002 --peer localhost:5001
python cli.py run-a2a-agent --agent-id a2a3 --port 5003 --peer localhost:5001 --peer localhost:5002
A2A agents will automatically discover other agents through their initial peers. You can type messages in any agent's terminal to broadcast them to all connected agents.
Architecture
MCP (Master Control Program)
- Centralized server that tracks all agents
- Agents register with the server and maintain connection through heartbeats
- Server provides a web interface to monitor agent status
- Simple and reliable but has a single point of failure
A2A (Agent-to-Agent)
- Decentralized peer-to-peer network
- Agents connect directly to each other
- Messages are flooded through the network
- More resilient but requires more complex coordination
- No single point of failure
Project Structure
a2a_mcp/
├── agents/ # Agent implementations
│ ├── mcp_agent.py # MCP-based agent
│ └── a2a_agent.py # Peer-to-peer agent
├── mcp/ # MCP server implementation
│ └── server.py # Flask-based MCP server
├── cli.py # Command-line interface
└── requirements.txt # Python dependencies
Contributing
Feel free to submit issues and pull requests to improve the demonstration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file a2a_mcp-0.1.0.tar.gz.
File metadata
- Download URL: a2a_mcp-0.1.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
610f4eaf5d4603977e1ca9870e0ae85761eec2ca5e1163c8824b9a4cfa346814
|
|
| MD5 |
64edf90c237f6180d27e18c2e70d6e1f
|
|
| BLAKE2b-256 |
eababeb1b5369349ea40809648c64debb92a462da76d3b142a621bc57a8b6620
|
Provenance
The following attestation bundles were made for a2a_mcp-0.1.0.tar.gz:
Publisher:
release.yml on khulnasoft-com/a2a-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
a2a_mcp-0.1.0.tar.gz -
Subject digest:
610f4eaf5d4603977e1ca9870e0ae85761eec2ca5e1163c8824b9a4cfa346814 - Sigstore transparency entry: 204459665
- Sigstore integration time:
-
Permalink:
khulnasoft-com/a2a-mcp@9bc18df1df3338d05a2d3bf0aff24a2f06182e38 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/khulnasoft-com
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bc18df1df3338d05a2d3bf0aff24a2f06182e38 -
Trigger Event:
release
-
Statement type:
File details
Details for the file a2a_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: a2a_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4783768774645462fb29823d8e6a9e18df312c331319f64c93bc3c69a6fa82b5
|
|
| MD5 |
49e8828ca7248afc6141162e13c1f043
|
|
| BLAKE2b-256 |
31092843942c1fdd180c337c5478524da2fb01b567d943ad9c4293a2eacfe400
|
Provenance
The following attestation bundles were made for a2a_mcp-0.1.0-py3-none-any.whl:
Publisher:
release.yml on khulnasoft-com/a2a-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
a2a_mcp-0.1.0-py3-none-any.whl -
Subject digest:
4783768774645462fb29823d8e6a9e18df312c331319f64c93bc3c69a6fa82b5 - Sigstore transparency entry: 204459666
- Sigstore integration time:
-
Permalink:
khulnasoft-com/a2a-mcp@9bc18df1df3338d05a2d3bf0aff24a2f06182e38 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/khulnasoft-com
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9bc18df1df3338d05a2d3bf0aff24a2f06182e38 -
Trigger Event:
release
-
Statement type: