hwclass / a2a-bus

An event bus reference implementation for agent-to-agent (A2A) protocols

Repository from Github https://github.comhwclass/a2a-busRepository from Github https://github.comhwclass/a2a-bus

πŸ“¨ a2a-bus

A Reference Event Bus for Agent-to-Agent (A2A) Protocols

Because the ideas are:

🧠 Agents shouldn’t have to call each other directly.
πŸ“¨ Let them speak in events.

a2a-bus is a schema-first, event-driven messaging architecture for intelligent agents that want to talk to each other β€” but without tight coupling or direct calls.

Instead of HTTP-based (direct) communication between agents, this repo demonstrates how to:

  • 🧠 Publish and consume events over Kafka or NATS JetStream (w/ Docker Compose, but TODO)
  • πŸ“¨ Standardize event structure using JSON Schema, Avro, and Protobuf
  • πŸ” Simulate multi-agent flows with testing tools and local dev setups

πŸ§ͺ Whether you're building tool-using LLM agents, multi-agent systems, or AI-native protocols β€” this repo is here to help you scale communication via topics, not endpoints.


✨ Why This Exists

Agent-to-agent (A2A) interoperability is emerging as a core challenge in the LLM and multi-agent ecosystem. Most current implementations are:

  • tightly coupled via REST/webhook calls,
  • hard to trace or replay,
  • lacking shared message schemas,
  • or too brittle to generalize.

This repo proposes a reference architecture using:

  • 🧠 loosely coupled agents,
  • πŸ“¨ brokered event flows,
  • πŸ“œ shared schema contracts, and
  • πŸ” tooling to simulate, replay, and debug interactions.

Inspired by Google’s A2A protocol vision, but focused on real-world, event-driven backends.


πŸ“ What’s Inside

a2a-bus/ β”œβ”€β”€ schema/ # πŸ“œ JSON, Avro, and Proto3 message schemas
β”œβ”€β”€ ts/ # 🧠 TypeScript agents (publisher, subscriber)
β”œβ”€β”€ go/ # 🧠 Go-based agent implementations
β”œβ”€β”€ python/ # 🧠 Python publisher/consumer samples
β”œβ”€β”€ docker/ # 🐳 Kafka, Schema Registry, NATS JetStream
β”œβ”€β”€ tools/ # πŸ” Simulator & testing CLI to publish A2A events
└── README.md # You are here.


πŸ§ͺ Core Achievements

  • βœ… Multi-language agents (TS, Go, Python) all speaking A2A
  • βœ… Brokered communication over NATS using intent-based topics
  • βœ… Schema-driven message formats (JSON Schema, Avro, Proto)
  • βœ… CLI simulator agent for sending test messages and testing flows
  • βœ… Docker Compose setup for local development and orchestration
  • βœ… Standardized event format (headers, payload, meta) per A2A guidelines
  • βœ… Message replay and test automation support (via test.sh)

πŸ”§ Quickstart

# 1. Start all agents and brokers
docker compose up --build

# 2. Run a test message using the CLI simulator
./test.sh summarize.article "Hello from simulator"

Alternatively, invoke it manually:

docker compose run --rm simulator summarize.article "Hello from simulator"

Agents subscribed to the intent will receive the event and act on it.


🧰 Simulator CLI Tool

Located in tools/, the simulator can send any valid A2A event:

# Usage
docker compose run --rm simulator <intent> "<text>"

# Example
docker compose run --rm simulator summarize.article "Summarize this input text"

🧠 Use it to trigger agent flows, test message schemas, or script behaviors via test.sh.


πŸ”‘ Schema Notes

Please use schema/ definitions to ensure contract-based communication. Extend with your own tools, agents, or topics.

The schemas do not hardcode allowed values for intent, which is a deliberate and extensible choice. This allows agents to define new intents freely, including "summarize.article", "translate.snippet", "search.docs", etc.


πŸ§‘β€πŸ€β€πŸ§‘ Want to Contribute?

This project is early-stage, naive, and meant to inspire more robust agent bus standards. We welcome:

  • πŸ‘€ feedback on schema design
  • πŸ’¬ proposals for message types and routing
  • πŸ”Œ adapters for new brokers or runtimes
  • πŸ§ͺ examples of agents in action

Open an issue or pull request β€” or just fork and experiment.


πŸ“œ License

Apache 2.0

About

An event bus reference implementation for agent-to-agent (A2A) protocols


Languages

Language:TypeScript 43.6%Language:Go 29.1%Language:Python 18.6%Language:Dockerfile 5.9%Language:Shell 2.8%