Interview's MateAI Engineering
Interview's Mate

AI Engineering

LLMs, RAG, agents & evals

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
AI Engineering topics
Lesson 60/ 160
03. AI Agents

A2A Protocol

Agent-to-agent interoperability protocols for discovery, messaging, and collaboration.

AdvancedInterop · Discovery3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidHands-onQuiz (3)Practice

In plain words

A shared language that lets AI agents from different companies find each other, ask each other for help and report back.

Think of it like…

Contractors who work for different companies: each publishes a business card (skills, contact, how to pay), you send a work order, they update you on progress, ask for missing details and deliver a finished product, all without you seeing how their shop operates.

Where you’ve seen it

A company's orchestrating assistant needs a flight rebooked and expense policy checked. It finds the travel agency's agent through its Agent Card (skills: search_flights, rebook, requires OAuth), sends a task "rebook flight AI-203 to the next morning, max +₹3,000", and subscribes to streamed updates. The travel agent responds input-required ("Choose seat type"), receives the answer, completes the task and returns a booking artifact. The orchestrator never sees the agency's pricing tools or prompts, and a separate A2A call to the internal finance agent validates the policy.

Words you’ll hear

Agent Card
Metadata published by an agent: name, description, skills, endpoint, supported modes and auth requirements.
Task
A unit of work with an id and lifecycle states, handled by a remote agent.
Message and parts
Communication turns composed of typed content parts (text, file, data).
Artifact
A deliverable produced by a task (document, booking, dataset).

Visual diagram

Loading interactive diagram

Theory & deep dive

How A2A works

Discovery: an agent exposes its Agent Card at a well-known URL (or registers in a directory). The card lists identity, description, supported capabilities (streaming, push notifications), input and output modes, authentication schemes and a list of skills with descriptions and examples. A client agent (or its orchestrator) reads cards to choose the right remote agent.

Interaction: the client sends a message that creates a task; the remote agent may answer immediately or run asynchronously, returning status updates by streaming (server-sent events) or webhook push notifications for long jobs. Tasks pass through states such as submitted, working, input-required (the agent asks for more information or approval), completed, failed or cancelled. Messages contain parts (text, files by reference or inline, structured JSON), and results are returned as artifacts. Because everything uses ordinary HTTP, JSON-RPC and standard authentication, A2A fits existing enterprise infrastructure.

A simplified Agent Card (sketch; field names vary by spec version)

{"name": "Travel Agent", "url": "https://travel.example.com/a2a", "capabilities": {"streaming": true}, "skills": [{"id": "rebook", "description": "Rebook an existing flight within constraints", "examples": ["Move AI-203 to tomorrow morning, max +₹3,000"]}], "authentication": {"schemes": ["oauth2"]}}

Key takeaway: Agent Cards for discovery; tasks, messages and artifacts for collaboration over HTTP.

A2A, MCP and the trust questions

A2A and MCP are complementary. MCP standardises how an agent connects to tools and data (functions with schemas, resources). A2A standardises how an agent talks to other agents, which have their own reasoning, memory and tools, and can negotiate, ask questions and work over long periods. A practical architecture: each agent uses MCP to reach its own tools, and A2A to delegate or collaborate with peer agents. Compared with the in-process patterns (handoffs, orchestrator-worker), A2A crosses process, vendor and trust boundaries.

Crossing trust boundaries raises issues. Authentication and authorisation: verify who is calling, grant least privilege, and don't forward user credentials broadly. Data minimisation: share only what the remote agent needs; treat remote responses as untrusted input (prompt-injection risk from another agent's output). Accountability: log tasks and artifacts, set contracts on what agents may do, and keep humans in the loop for consequential actions. Reliability: handle timeouts, retries, idempotency and partial results. The protocol is young and evolving, so check the current specification and ecosystem support before building on specific features.

Minimal sharing

Send the travel agent only the flight number, date and fare-difference limit, not the employee's full profile or expense history. If it needs more, it returns input-required and the orchestrator decides what to share.

Key takeaway: MCP for tools, A2A for peer agents; treat remote agents as untrusted and share minimally.

How it works, step by step

Step 1 of 4
Architecture

1. Decide if you need interop

Use A2A when agents are built by different teams or vendors and must collaborate; keep in-process patterns inside one system.

cross-team travel and finance agents
Key numbers at this step
Else
simple handoffs

When to use it & trade-offs

What it is

The Agent2Agent (A2A) protocol, introduced by Google in 2025 and later moved to the Linux Foundation, is an open standard that lets independently built agents discover each other and collaborate across vendors, frameworks and organisations. Each agent publishes an Agent Card (a JSON description of who it is, what skills it offers, its endpoint and authentication needs). A client agent sends a task to a remote agent using JSON-RPC over HTTP; the task has a lifecycle (submitted, working, input-required, completed, failed, among others), exchanges messages made of typed parts (text, files, structured data), can stream progress, and produces artifacts as results. A2A treats remote agents as opaque: you don't see their internals, tools or memory, only their interface.

Why it matters: Companies increasingly run agents from different teams and vendors (a procurement agent, a travel agent, a finance agent), and need them to cooperate without custom integrations for every pair or exposing internal prompts and tools. A common protocol reduces integration cost and lets agents delegate to specialists across organisational boundaries. It also raises new questions about trust, authentication, data sharing and accountability.

When to reach for it

  • Cross-team or cross-vendor agent collaboration
  • Delegating to specialist agents you don't control
  • Enterprise agent marketplaces and registries

When to avoid or be careful

  • A2A for agents inside a single process
  • Sharing full user profiles with every remote agent
  • Trusting remote agent output without validation

Connecting agents and tools

A2A (agent to agent)
Best for: Collaboration between independently built agents

Strengths: Standard discovery, task lifecycle and opaque interop.

Watch out: Network, trust and governance complexity.

MCP (agent to tool)
Best for: Giving an agent access to tools and data

Strengths: Standard tool and resource interface.

Watch out: Tools aren't agents; no negotiation or long-lived tasks.

In-process handoffs or orchestration
Best for: Agents inside one application

Strengths: Simple; low latency.

Watch out: Doesn't cross vendor or organisational boundaries.

Interview signals & numbers to know

When this topic comes up

  • “How do our agents talk to a partner's agent?”
  • “A2A vs MCP”
  • “What is an Agent Card?”
  • Cross-organisation agents
  • Opaque agent collaboration

Benchmarks & rules of thumb

5 – 9 -
task states: the five core ones, plus canceled, rejected and auth-required in recent spec versions
2025 -
year A2A was introduced
JSON-RPC over HTTP -
transport basis

Common mistakes & follow-ups

Common interview mistakes

  • Using A2A to call a tool that MCP (or a plain API) would serve better.
  • Forwarding the user's full credentials to a third-party agent.
  • Treating a remote agent's text as trusted instructions.

Likely interviewer follow-ups

  • How are A2A and MCP different and how do they work together?
  • What does an Agent Card contain?
  • What are the security concerns of agent-to-agent communication?
Interview tip: State the split plainly: MCP is agent-to-tool, A2A is agent-to-agent. Then name one trust concern (minimal data sharing). That's a complete, current answer.
Loading hands-on exercise

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply A2A Protocol with generative AI interview Q&A and hands-on practice.

Open Generative AI Q&A →Tech Learn Q&A
Previous topic
Stop Conditions
Next topic
Golden Datasets