How muthub-ai/a2a works
Project type and purpose
• This is an open‑source protocol project (“Agent2Agent” or A2A) designed to enable multi‑vendor AI agents to discover and talk to each other via HTTP.
• It provides:
– A JSON specification (/specification/json/*.json) defining protocol methods, data models (Task, Message, Part, Artifact).
– Reference libraries (Python & JS) for building A2A servers and clients (samples/python/common, samples/js/src/client and samples/js/src/server).
– Sample agent implementations for various frameworks (samples/python/agents/*, samples/js/src/agents/*).
– A demo web UI with built‑in agents (demo/ui/...).
– CLI samples (samples/python/hosts/cli, samples/js/src/cli.ts).
File structure
Top‑level directories:
• specification/ – JSON schema of the protocol
• samples/ – reference implementations in JS and Python:
– samples/js/src has client, server, CLI, and Genkit‑style agents
– samples/python has “common” client/server libraries, multiple agent directories, host/CLI apps
• demo/ui/ – a monolithic UI application (Python based) with:
– UI components (components/, pages/, styles/)
– Service layer (service/client, service/server) hosting a multi‑agent A2A server in‑memory
– State management (state/)
– Tests (tests/)
• tests/ – protocol conformance and utility tests
README for architectural hints
• Describes core concepts: Agent Card (discovery), A2A Server, A2A Client, Task lifecycle, streaming (SSE), push notifications.
• Typical flow: discovery → tasks/send or tasks/sendSubscribe → (SSE or sync response) → optional follow‑up → terminal state.
Essential detail checklist
– Show the discovery step via Agent Card fetch.
– Show request/response vs. streaming vs. push notifications.
– Annotate state transitions of a Task (submitted→working→…→completed).
– Call out both Python and JS sample stacks and how they reuse the spec.
– Highlight the in‑memory manager in the demo vs. pluggable real stores.