Skip to main content

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:

  1. Master Control Program (MCP) - A centralized server-based approach where agents communicate through a central server
  2. Agent-to-Agent (A2A) - A decentralized peer-to-peer approach where agents communicate directly with each other

Installation

  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Usage

MCP Server and Agents

  1. Start the MCP server:
python cli.py run-mcp-server
  1. 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

  1. Start the first A2A agent:
python cli.py run-a2a-agent --agent-id a2a1 --port 5001
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a2a_mcp-0.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

a2a_mcp-0.1.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

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

Hashes for a2a_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 610f4eaf5d4603977e1ca9870e0ae85761eec2ca5e1163c8824b9a4cfa346814
MD5 64edf90c237f6180d27e18c2e70d6e1f
BLAKE2b-256 eababeb1b5369349ea40809648c64debb92a462da76d3b142a621bc57a8b6620

See more details on using hashes here.

Provenance

The following attestation bundles were made for a2a_mcp-0.1.0.tar.gz:

Publisher: release.yml on khulnasoft-com/a2a-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for a2a_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4783768774645462fb29823d8e6a9e18df312c331319f64c93bc3c69a6fa82b5
MD5 49e8828ca7248afc6141162e13c1f043
BLAKE2b-256 31092843942c1fdd180c337c5478524da2fb01b567d943ad9c4293a2eacfe400

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page