10. Agent Communication Protocols
Agent-to-Agent (A2A) Protocol
Agent-to-Agent (A2A) is a protocol for peer agents to discover each other, advertise skills via agent cards, and delegate tasks with structured messages — across teams, vendors, and runtimes. Unlike MCP (host↔tool/context servers), A2A treats the other party as an autonomous agent that can plan, use its own tools, and return artifacts. Use A2A when collaboration spans organizational or product boundaries; keep MCP for plugging tools into a single host.
What you will learn
- Explain what A2A is and when to use it
- Contrast A2A peer agents with MCP tool servers
- Describe discover-match-send-work-result flow
- List safety controls for cross-agent delegation
- Answer interview questions with short, solid answers
Definition
Agent-to-Agent (A2A) protocol standardizes how one agent finds another capable peer, understands its advertised skills (often via an agent card), sends a task with multimodal parts, and receives progress and results. The remote agent remains autonomous: it may run its own planning loop and tools (including MCP servers) to complete the delegated work.
A2A is about collaboration contracts between agents, not about replacing tool protocols inside a single product.
Introduction
This lesson (#5 in Agent Communication Protocols) follows Building and Integrating MCP with AI Agents. You can plug tools into one host; A2A lets that host’s agent hand work to another agent elsewhere.
Next: A2A Architecture, Discovery and Delegation — cards, tasks, and message patterns in depth.
Why A2A
- Specialists live in other products or vendors
- Org boundaries block sharing raw tools/credentials
- Long tasks need async status, not one RPC
- Ecosystem agents should interoperate without custom glue
- Still need auth, budgets, and HITL on delegation
A2A vs MCP
Choose the contract that matches the other party’s role.
- A2A - agent ↔ agent; skills, tasks, artifacts
- MCP - host ↔ server; tools, resources, prompts
- Delegate to A2A when the peer must plan/decide
- Call MCP when you need a deterministic capability
- Do not fake an “agent” that is only a thin tool wrapper unless discovery needs it
Core ideas
- Agent card - machine-readable profile of identity and skills
- Client agent - initiates discovery and sends tasks
- Remote agent - accepts tasks and produces results
- Task - unit of work with state and artifacts
- Messages/parts - text, files, structured data exchanged
Delegation flow
A typical happy path is discover then hand off under policy.
- Discover - fetch or resolve an agent card
- Match - skills, auth, trust, and cost fit the goal
- Send task - goal, context parts, constraints
- Work - remote agent runs; client streams or polls status
- Result - artifacts returned; client continues its plan
- Cancel / timeout - stop runaway remote work
Safety and trust
- Authenticate peers; verify agent card integrity
- Allowlist which remote agents may be called
- Scope what data leaves your boundary in task parts
- HITL before high-stakes or irreversible delegation
- Budgets: time, money, and nested tool spend on the peer
- Treat remote artifacts as untrusted input
Failure modes
- Delegating to unknown agents from open directories
- Sending secrets in task payloads
- No timeout — waiting forever on a remote peer
- Confusing A2A with a local multi-agent crew in one process
- Assuming the peer’s tools are your tools (credential bleed)
Map to this module
- Next: A2A architecture — discovery and delegation details
- Then: MCP vs A2A and interoperability patterns
- Crews/graphs inside one app can coexist with A2A externally
Program / implementation notes
Prototype: publish a minimal agent card for a “summarize URL” specialist; from a client agent, discover, send a task, poll until artifacts return. Keep MCP tools local to each agent.
- Start with one trusted peer inside your org
- Next: A2A Architecture, Discovery and Delegation
Advantages and limitations
- Advantage: cross-product and cross-vendor collaboration
- Advantage: specialists keep their own tools and secrets
- Advantage: async task model fits long work
- Limitation: trust and compliance across boundaries is hard
- Limitation: debugging distributed agent chains is complex
- Limitation: overusing A2A for simple tools adds latency
Key points
- A2A: peer agents discover, delegate tasks, return artifacts.
- MCP plugs tools into a host; A2A connects agents to agents.
- Agent cards advertise identity and skills.
- Flow: discover → match → send task → work → result.
- Allowlist peers, scope data, HITL, and budget remote work.
- Remote artifacts are untrusted until validated.
FAQs
Is A2A the same as a multi-agent crew?
Not necessarily. Crews/graphs often run inside one process or account. A2A targets interoperable peers that may live in different products or organizations.
Can an A2A agent use MCP?
Yes. A remote agent commonly uses MCP servers for its own tools while speaking A2A to client agents.
What is an agent card?
A machine-readable description of an agent’s identity, endpoint, and skills used for discovery and matching before task delegation.
When prefer MCP over A2A?
When you need a deterministic tool/resource in your host and do not need another autonomous planner — use MCP (or local tools).
Interview questions
- What is the Agent-to-Agent (A2A) protocol?
Answer A standard for peer agents to discover capabilities, exchange tasks and messages, and return artifacts across runtimes or organizations.
- How does A2A differ from MCP?
Answer A2A connects agents to agents for delegation; MCP connects AI hosts to tool/context servers. They solve different integration jobs and often coexist.
- What is an agent card?
Answer A discoverable profile advertising an agent’s identity, skills, and how to reach it for task submission.
- Describe a typical A2A flow.
Answer Discover and match a peer via its card, send a task with parts, let the remote agent work with streaming or polling, then receive results/artifacts.
- How do you keep A2A safe?
Answer Authenticate and allowlist peers, minimize data in payloads, HITL high-stakes delegation, set timeouts/budgets, and treat returned artifacts as untrusted.
- When should you use A2A?
Answer When work must be handled by another autonomous specialist across a product or trust boundary, not when a local tool call would suffice.
Related topics
Practice task
Complete each numbered practice step in a notebook or doc before opening the next lesson.
- Write three tasks that need A2A vs three that need MCP tools only.
- Draft a minimal agent card fields list (name, skills, endpoint, auth).
- List data you must never put in an outbound A2A task payload.
- Define timeout and HITL rules for delegating a customer email draft.
- Answer interview questions 1, 2, and 5 in two sentences each.