Courses / Agentic AI / Module 8
Module 8: Agent-to-agent protocols (A2A) and interoperability
6 h · theory 2 · hands-on 2 · project 1 · revision 1
You will be able to
- Explain A2A agent cards, tasks and messages
- Expose an agent over A2A
- Call a remote agent and handle long tasks
Capstone increment: Optional: the runbook agent exposed over A2A.
Job-description skills: A2A · Lab tools: a2a-sdk
1. Agents talking to agents
MCP connects an agent to tools. The Agent2Agent protocol (A2A), introduced by Google in 2025 and now a Linux Foundation project, connects an agent to another agent that it doesn’t own: a vendor’s agent, another team’s agent, an agent behind a partner’s firewall. The remote agent keeps its own prompts, tools and model private and exposes only what it can do.
The flow: discover the agent’s card, authenticate as it says, send a message that creates a task, follow the task through its states, and collect the resulting artifacts.
2. Agent cards
An agent card is a JSON document published at a well-known URL on the agent’s host. It names the agent, describes it, gives its endpoint and version, lists its skills with descriptions and tags, declares capabilities such as streaming and push notifications, and states the security schemes it accepts.
Validate the card before using it, as you would any external input, and cache it with its version. A client agent can read the skills to decide whether to delegate, much as it reads tool descriptions.
3. Tasks, messages and artifacts
A client sends a message (made of parts: text, files or structured data). The remote agent replies directly or creates a task with an id. Tasks move through states: submitted, working, input-required, completed, failed, canceled or rejected. Results come back as artifacts, which are also made of parts.
The input-required state is the important one: the remote agent needs something (a clarification, an approval) and the same task continues when the client replies. Handle every state, including the failure ones.
4. Long-running tasks
Remote agents may take minutes or hours. If the card says the agent supports streaming, subscribe to updates over Server-Sent Events. Otherwise poll the task with exponential backoff and jitter, or register a webhook for push notifications. Always set a deadline, and cancel tasks you abandon so the remote side stops work.
Make your own side idempotent: if your process restarts, resume following the task by its id instead of sending the message again.
5. Security, and when to use it
Authenticate with the schemes the card declares (OAuth 2.0, API keys, mutual TLS). Treat everything a remote agent returns as untrusted input: validate it, and never let it trigger privileged actions in your system without your own checks and approvals. Log every exchange with the task id.
Use A2A at organisational boundaries: between teams, vendors and partners. Inside one codebase, a function call or an MCP tool is simpler and easier to test.
Hands-on: coding window
The coding window and the full VS Code lab are available after you sign in.
Sign in to codeLabs
Lab 8.1: Expose the runbook agent
Wrap the capstone’s runbook agent as an A2A server with the a2a-python SDK, publish its card and test it with the sample client.
Expected: A card at the well-known URL and a working message exchange.
Lab 8.2: Call it from the supervisor
Have the supervisor delegate to the remote runbook agent over A2A, handle input-required by answering in the same task, and enforce a deadline with cancel.
Expected: Traces showing the task id, its states and the returned artifact.
Lab 8.3: Decide (optional capstone increment)
Write an ADR on whether the runbook agent should be remote (A2A) or local (a function or MCP tool) in your capstone, with latency and complexity measured.
Expected: docs/adr/0008-a2a.md with the numbers.
Go deeper
Videos
- Introduction to Agent2Agent (A2A) Protocol · Google Cloud Tech · ~8 min. Google’s introduction to A2A: agent cards, tasks and how it complements MCP.
- A2A Protocol (Agent2Agent) Explained: How AI Agents Collaborate · IBM Technology · ~9 min. A clear explainer of how agents collaborate through A2A.
Further reading
- Docs A2A protocol specification · A2A Project. Agent cards, tasks, messages, artifacts and streaming, from the specification.
- Article Announcing the Agent2Agent Protocol (A2A) · Google for Developers. Why the protocol exists and how it complements MCP.
- Docs Model Context Protocol specification · modelcontextprotocol.io. Compare with A2A: MCP connects an agent to tools; A2A connects agents to each other.
GitHub repositories
- a2aproject/A2A: The specification: agent card fields, task states and the JSON-RPC methods.
- a2aproject/a2a-python: The Python SDK: building a server with an agent executor and a client.
- a2aproject/a2a-samples: Sample agents across frameworks; run one and read its card.
Checkpoint quiz
Interview questions
- Explain A2A and how it differs from MCP.
- Design how your agent would delegate to a vendor’s agent safely.
- How do you handle a remote task that takes an hour?
- What could go wrong when your agent trusts a remote agent’s output?
- When would you not use A2A?
Ask the professor
Sign in to ask questions about this module.
Discussion
Community discussion appears here once giscus is configured (see README).