Skip to content

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.

Discover/.well-known agent cardAuthenticateper the cardSend messagecreates a taskUpdatesSSE or pushArtifactstask completedCalling an agent you don’t owninput-required
MCP connects an agent to tools; A2A connects an agent to another agent, which keeps its own prompts, tools and model private.

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.

Common misconception: “A2A replaces MCP.” They solve different problems. An agent typically uses MCP for its own tools and A2A to delegate whole tasks to other agents.

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 code

Labs

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

Further reading

GitHub repositories

Checkpoint quiz

1. What does an agent card describe?
2. A remote task enters input-required. What should the client do?
3. The card says streaming is unsupported. How do you follow a long task?
4. How should you treat a remote agent’s output?
5. When is A2A the right choice?

Interview questions

  1. Explain A2A and how it differs from MCP.
  2. Design how your agent would delegate to a vendor’s agent safely.
  3. How do you handle a remote task that takes an hour?
  4. What could go wrong when your agent trusts a remote agent’s output?
  5. 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).