TAI BUI
Back to curriculum
BuildPython

A2A — The Agent-to-Agent Protocol

Google announced A2A in April 2025. By April 2026 the spec lives at https://a2a-protocol.org/latest/specification/ and 150+ organizations back it. MCP is vertical (agent ↔ tools, Lesson 13) and A2A is horizontal (agent ↔ agent). It defines Agent Cards for discovery, tasks that produce typed artifacts (text, structured data, video), opaque task lifecycles, and auth. Production systems increasingly pair the two, and Google Cloud added A2A support to Vertex AI Agent Builder during 2025-2026.

TIME: ~75 minutesPREREQUISITES: Phase 16 · 04 (Primitive Model)

Learning Objectives

  • Explain how A2A (agent to agent, horizontal) and MCP (agent to tool, vertical) divide the work, and why production systems pair them.
  • Read an Agent Card at /.well-known/agent.json and say what a client learns from it: skills, endpoints, modalities and auth.
  • Trace a task through submitted, working, completed, failed or canceled, and choose between polling and an SSE subscription.
  • Run main.py and map its discovery, submit, poll and artifact steps onto the A2A flow, including what the demo leaves out.
  • Decide when A2A fits (cross-organization, heterogeneous, long-running work) and when direct RPC is the better choice.

Problem

Your agent needs to call another agent on another system. How? You can expose an HTTP endpoint, define a bespoke JSON schema, and hope the other side speaks it. Then the next pair of agents needs its own custom integration.

A2A is a shared wire protocol for that call: standard discovery, task model, transport, and artifacts. Think HTTP+REST, but with agents as first-class citizens.

Warm-up0/3
1. In the four-primitive model of multi-agent systems, which primitive moves control of a conversation from one agent to another?Warm-up
Agent A box with an arrow labelled conversation continues here to Agent B box, and a dashed question box asking what this transfer is called.
2. Which primitive corresponds to what frameworks variously call a blackboard, a message pool or a StateGraph?Warm-up
Two agent boxes each with an arrow down to one central box labelled with a question mark, noted as being called a blackboard, a message pool or a StateGraph in various frameworks.
3. A web service needs several minutes to finish a job that a client requested over HTTP. What is a common API design so the client is not stuck waiting on one open request?Warm-up
A client box sending a request to a web service box for a job that takes several minutes, with a dashed box asking what API design keeps the client from being stuck.
Check: Problem0/2
1. What is A2A?Define
An agent on System A and an agent on System B, with a dashed unlabeled line between them and a dashed question box asking what connects them.
2. Why is a shared agent protocol better than each pair of agents defining its own JSON endpoint?Explain
Three separate agent pairs, each joined by an arrow labelled with its own custom endpoint number, and a dashed question box asking what the problem is as more pairs are added.
Typed schematic, not captured output.

Concept

The four elements

Agent Card. A JSON document at /.well-known/agent.json describing the agent: name, skills, endpoints, supported modalities, auth requirements. Discovery happens by reading the card.

GET https://agent.example.com/.well-known/agent.json
→ {
    "name": "code-review-agent",
    "skills": ["review-python", "review-typescript"],
    "endpoints": {
      "tasks": "https://agent.example.com/tasks"
    },
    "auth": {"type": "bearer"},
    "modalities": ["text", "structured"]
  }

Task. The unit of work. An async, stateful object with a lifecycle: submitted → working → completed / failed / canceled. A client sends a task, polls or subscribes for updates.

Artifact. The result type produced by a task. Text, structured JSON, image, video, audio. Artifacts are typed so different modalities are first-class.

Opaque lifecycle. A2A does not prescribe how the remote agent solves the task. The client sees state transitions and artifacts; the implementation is free to use any framework.

The MCP/A2A split

  • MCP (Lesson 13): agent ↔ tool. The agent reads/writes via JSON-RPC to a tool server. Stateless by default.
  • A2A: agent ↔ agent. Peer protocol; both sides are agents with their own reasoning.

Production multi-agent systems use both. An A2A peer calls MCP tools on its side. The split keeps the two concerns clean.

Discovery flow

Client                     Agent server
  ├──GET /.well-known/agent.json──>
  <──Agent Card JSON─────────────
  ├──POST /tasks {skill, input}──>
  <──201 task_id, state=submitted
  ├──GET /tasks/{id}──────────────>
  <──state=working───────────────
  ├──GET /tasks/{id}──────────────>
  <──state=completed, artifacts──

Or with streaming: SSE subscription to /tasks/{id}/events for push updates.

Auth

A2A supports three common patterns:

  • Bearer token: OAuth2 or opaque.
  • mTLS: mutual TLS, where organizations prove identity to each other.
  • Signed requests: HMAC over the payload.

Auth is declared in the Agent Card; clients discover and comply.

150+ organizations by April 2026

Enterprise adoption drove the growth, and A2A became a common way for enterprise agent systems to cross trust boundaries. Google Cloud shipped Vertex AI Agent Builder A2A support; Microsoft Agent Framework supports it; most major frameworks (LangGraph, CrewAI, AutoGen) ship A2A adapters.

Where A2A wins

  • Cross-organization calls. Agent at company A calls agent at company B. Without A2A, each pair needs a bespoke contract.
  • Heterogeneous frameworks. LangGraph agent calls CrewAI agent calls custom Python agent. A2A normalizes.
  • Typed artifacts. Video, structured JSON, and audio results are all first-class.
  • Long-running tasks. Opaque lifecycle + polling makes hours-long tasks straightforward.

Where A2A struggles

  • Latency-sensitive micro-calls. A2A's lifecycle is async. Sub-millisecond agent-to-agent does not fit; use direct RPC.
  • Tight-coupled in-process agents. If both agents run in the same Python process, A2A's HTTP round-trip is overkill.
  • Small teams. Spec overhead is real; internal-only agents may not need the formality.

A2A vs ACP, ANP, NLIP

Several related specs emerged in 2024-2026:

  • ACP (IBM/Linux Foundation): predecessor to A2A, narrower scope.
  • ANP (Agent Network Protocol): peer-discovery-heavy, decentralized-first.
  • NLIP (Ecma Natural Language Interaction Protocol, standardized December 2025): natural-language content type.

A2A is the most-adopted peer protocol as of April 2026. See arXiv:2505.02279 (Liu et al., "A Survey of Agent Interoperability Protocols") for the comparison.

Check: Concept0/18
1. What is an Agent Card?Define
An agent server box with a dashed question box below it asking what the server publishes about itself.
2. What is an artifact in A2A?Define
A task box marked state completed with an arrow to a dashed question box asking what its output is.
3. In A2A, what does discovery mean?Define
A client box and a box for a hostname with a thought bubble asking how to learn what it offers, and a dashed question box asking what this first step is called.
4. What does "vertical versus horizontal" mean when comparing MCP and A2A?Define
One agent box with two unlabeled arrows, one down to a tool box and one sideways to a peer agent box, each arrow carrying a question mark.
5. Which sequence lists the states of an A2A task correctly?Define
A box for a newly created task and a box for a resolved task with a dashed question box between them asking what happens in between and how it ends.
Typed schematic, not captured output.
6. What does the opaque lifecycle mean for a client calling a remote agent?Define
A client box and a remote agent box with a hidden reasoning area, and a dashed question box asking what the client sees while the remote agent works.
7. Which sibling protocol is a natural-language content-type spec standardized by Ecma in December 2025?Define
A box with a question mark naming only that it was standardized by Ecma in December 2025, and a note that it is one of several sibling specs from 2024-2026.
8. A teammate says MCP and A2A are competing standards and you must pick one. What is the best correction?Explain
A quoted claim that MCP and A2A are competing standards, boxes for each named MCP and A2A, and a dashed question box asking how they relate.
9. You are given only the hostname of a partner's agent. What is the first request an A2A client makes?Explain
A client box and a box for a partner's agent, with a note that no request has gone out yet and a dashed question box asking for the first request.
10. An agent returns a generated video along with a JSON summary. How does A2A model this?Explain
A completed task box with a video icon and a curly-brace JSON icon beside it, and a dashed question box asking how the two outputs are represented together.
11. Why can a LangGraph agent call a CrewAI agent over A2A without knowing how the CrewAI agent works?Explain
A LangGraph agent box sending a task to a CrewAI agent box whose internals area is marked hidden, and a dashed question box asking why this works without LangGraph knowing how CrewAI works.
Typed schematic, not captured output.
12. Why does a client need no separate agreement beforehand about how to authenticate with a new agent?Explain
A client box and a box for a just-discovered agent with a thought bubble about authenticating, and a dashed question box asking why no prior agreement is needed.
13. Which of these is NOT one of the three common A2A auth patterns?Explain
An Agent Card's auth field holding a question mark for its type, with a note that A2A supports a short, specific list of auth patterns.
14. How does an SSE subscription to /tasks/{id}/events differ from polling GET /tasks/{id}?Explain
A client box and a box for a task in progress, naming both endpoints GET /tasks/id and the events subscription, with a dashed question box asking the key difference between them.
15. A task will run for hours, and the client sits behind a firewall that blocks inbound connections. What fits A2A best?Explain
A client box noted as blocking inbound connections and a server box running a task for hours, with a dashed question box asking what approach fits.
16. Two agents run in the same Python process and exchange thousands of tiny calls per second. What does the Concept section suggest?Design
Two agent boxes inside one shared process boundary, a note that thousands of tiny calls happen per second, and a dashed question box asking what fits best.
17. Your LangGraph agent must call a partner company's CrewAI agent that works for hours and returns video. Which design fits best?Design
Your LangGraph agent box and a partner's CrewAI agent box noted as running for hours and returning video, with a dashed question box asking which design fits best.
Typed schematic, not captured output.
18. Your agent is exposed to peers through A2A, and it must query an internal database to do its work. Where does the database access belong?Design
A peer callers box and an internal database box on either side of your agent box, with an A2A link already drawn to the peers and a dashed line to the database, and a dashed question box asking where database access belongs.
Typed schematic, not captured output.

Build It

code/main.py implements an A2A-minimal server and client using http.server and JSON. The server:

  • exposes /.well-known/agent.json,
  • accepts POST /tasks,
  • manages task state,
  • returns artifacts on GET /tasks/{id}.

The client:

  • fetches the Agent Card,
  • submits a task,
  • polls until completion,
  • reads the artifact.

Run:

python3 code/main.py

The script starts the server in a background thread, then runs the client against it. You see the complete flow: discovery, submit, poll, artifact.

Check: Build It0/6
1. The demo client submits {"skill": "review-python", "payload": {"code": "x = 1\nprint(x)\n"}}. What artifact does it print?Apply
A code card for a POST to /tasks with skill review-python and the payload x = 1, print(x), with a dashed question box asking for the artifact once the task completes.
Submission matches the stem exactly.
2. The demo client submits a review-python task whose code is "def f():\n return 1\n". What does the completed artifact contain?Apply
A code card for a POST to /tasks with skill review-python and the payload def f(): return 1, with a dashed question box asking for the artifact once the task completes.
Submission matches the stem exactly.
3. A client calls GET /tasks/zzz999 for an id the store never created. What does the demo server return?Apply
A single line, GET /tasks/zzz999, for an id the store never created, with a dashed question box asking for the response.
4. In the demo, a client submits a task with the skill 'summarize', which the server does not implement. What does it observe when polling?Apply
A code card for a POST to /tasks with skill summarize, noted as not implemented by the demo server, with a dashed question box asking what polling observes.
Submission matches the stem exactly.
5. The server owner moves the tasks endpoint to a new host and updates the Agent Card. The demo client's submit succeeds but its polling fails. What is the cause?Analyze
An Agent Card box whose tasks endpoint now points at a new host, a client box, an arrow marked submit succeeds, a note that poll fails, and a dashed question box asking why only polling fails.
6. A teammate runs the demo unchanged on a public host and says the Agent Card's auth field means A2A has secured it. What is wrong with that claim?Analyze
A quoted claim that the Agent Card's auth field means A2A has secured the agent, a box for a demo running on a public host, and a dashed question box asking what is wrong with the claim.

Use It

outputs/skill-a2a-integrator.md designs an A2A integration: Agent Card contents, task schemas, auth choice, streaming vs polling.

Ship It

Checklist:

  • Pin the spec version. A2A is still evolving; the Agent Card should declare the protocol version.
  • Idempotent task creation. Duplicate submissions (network retries) should produce one task.
  • Artifact schemas. Declare what shapes the agent returns; consumers should validate.
  • Rate limits + auth. A2A is public-facing; apply standard web security.
  • Dead-letter for failed tasks. Inspect patterns over time for recurring failure types.
Check: Ship It0/2
1. Network retries keep creating duplicate tasks on your A2A server. Which Ship It item addresses this?Analyze
A client box noted as retrying over the network sending two POST requests to a server box, a box reading two tasks created, and a dashed question box asking which Ship It item addresses this.
Typed schematic, not captured output.
2. A consumer crashes because an agent's artifact changed shape. Which Ship It practice would have caught it?Analyze
An artifact box from last week and an artifact box from today with a different shape, a note that the consumer crashes, and a dashed question box asking which Ship It practice would have caught this.
Typed schematic, not captured output.
Author's Note

I'd run main.py and read the trace before the Concept section. The server starts in a background thread and the client walks through three steps (discovery, submit, poll), then prints the artifact. It is plain http.server and JSON, so no SDK hides the wire format.

The part I'd read twice is TaskStore. POST /tasks returns 201 with a task_id and state submitted right away, and a worker thread moves the task to working, then completed or failed. That is the async lifecycle from the Concept section, and it is the reason the client has to poll. The review-python skill is two substring checks, so the issues it finds mean little. The shape is what matters: a typed structured artifact on success, a text artifact on failure.

I'd also keep the demo in proportion. The card declares auth: none, so the auth patterns are described but never exercised. There is one skill, no canceled state, no streaming endpoint, and no handling of duplicate submissions. Exercises 3 and 4 and the Ship It checklist cover those gaps. The card does carry protocol_version: a2a-0.3, and pinning the version is the habit I'd copy first.

Exercises

  1. Run code/main.py. Confirm the client discovers the server and receives the correct artifact.
  2. Add a second skill to the server (e.g., "summarize"). Update the Agent Card. Write a client that picks the skill based on task type.
  3. Implement an SSE streaming endpoint: /tasks/{id}/events that emits state changes. What does the client need to do differently?
  4. Read the A2A spec (https://a2a-protocol.org/latest/specification/). Identify three things the spec mandates that this demo does not implement.
  5. Compare A2A (Agent Card discovery) to MCP (server-side capability listing via listTools). What is the tradeoff between self-describing agents and capability-probing?

Key Terms

TermWhat people sayWhat it actually means
A2A"Agent-to-agent"Peer protocol for agents to call other agents across systems. Google 2025.
Agent Card"The agent's business card"JSON at /.well-known/agent.json describing skills, endpoints, auth.
Task"The unit of work"Async stateful object with a lifecycle; artifacts produced on completion.
Artifact"The result"Typed output: text, structured JSON, image, video, audio. First-class media.
Opaque lifecycle"How it's solved is the agent's business"Client sees state transitions; server is free to choose framework/tools.
Discovery"Finding the agent"GET /.well-known/agent.json returns the card.
MCP vs A2A"Tools vs peers"MCP: vertical agent ↔ tool. A2A: horizontal agent ↔ agent.
ACP / ANP / NLIP"Sibling protocols"Adjacent specs; A2A is the most-adopted 2026.

Further Reading

Code

Ships With