Agentic AI · Module 20 of 41 · 10 concepts · about 17 min

Agent-to-Agent Protocols

How agents built by different teams, on different frameworks, find each other and work together: agent and capability discovery, task delegation across a boundary, long-running tasks, and how this differs from MCP.

At work: What a large company needs once it has thirty agents built by ten teams on four frameworks, and what any product needs before it can hand part of a job to another company's agent.

Why agents need an interoperability protocol

What it is

Interoperability means systems built separately can work together. Inside one codebase, agents call each other as functions (modules 16 to 18). That stops working when agents:

  • are built by different teams or companies;
  • run on different frameworks and languages;
  • must stay opaque: the other side should not see their prompts, tools or memory;
  • do long-running work that outlives a single request.

An agent communication protocol is an agreed way for such agents to describe themselves, accept work and report results.

Why it matters

Without a standard, every pair of agents needs a custom integration, the same M times N problem MCP solved for tools.

  • A travel agent that wants to use an airline's booking agent should not need the airline's source code.
  • A standard lets each side change its internals freely as long as the contract holds.
  • It also puts security in a known place: the boundary.

In the real world: A bank's HR agent, IT agent and facilities agent were built on three frameworks; an onboarding agent now delegates to each over one protocol instead of three bespoke integrations.

Reaching for a cross-agent protocol inside one small system. Two agents in the same process, owned by the same team, should use a function call. A protocol earns its cost at an organisational boundary.

Practise it: Design an AI Customer Support Agent

MCP versus agent-to-agent protocols

What it is

The two are often confused. They connect different things:

  • MCP connects an agent to tools and data. The other end is a passive capability: it does what it is called to do and returns.
  • An agent-to-agent protocol connects an agent to another agent. The other end is autonomous: it has its own model, plans its own steps, may take a long time, and may ask questions back.

Why it matters

They are complementary and usually used together.

  • An agent uses MCP to reach its own tools, and an agent-to-agent protocol to hand a whole sub-goal to a peer.
  • The test: are you asking for a function to be run (a tool) or for a goal to be achieved (an agent)?
  • A tool call returns in one response. A delegated task has a lifecycle: accepted, working, needs input, done.

In the real world: A procurement agent reads the product catalogue through MCP and delegates 'negotiate delivery dates with this supplier' to the supplier's own agent through A2A.

Visual example

Comparison

One reaches down to tools. The other reaches across to peers.

MCP versus an agent-to-agent protocol
MCPagent-to-agent (A2A)
Connects an agent toTools and dataOther agents
The other side isA passive capabilityAn autonomous agent
You sendA function call with argumentsA task or message in natural language
DurationOne request and responseMay run for minutes or days
Can ask questions backOnly to request missing inputYes, as part of the task
Internals visibleThe tool's schemaNothing: the agent is opaque
Discovery byListing toolsReading an agent card

Wrapping another team's agent as a single MCP tool and treating it as a function. It works until the task takes ten minutes or the agent needs to ask a question, neither of which a simple tool call models well.

Agent discovery and capability discovery

What it is

Before delegating, an agent must find a suitable peer and learn what it can do:

  • Agent discovery is finding that an agent exists and where it is. Usually through a registry (a directory of agents) or a well-known address on a website.
  • Capability discovery is learning what it can do, in what formats, and how to authenticate. In A2A this is the agent card.

An agent card is a JSON document an agent publishes about itself: its name and description, its skills (what it can do, with examples), the service address, supported features such as streaming, and the security schemes it requires. By convention it is served at /.well-known/agent-card.json on the agent's domain.

Why it matters

The card is what lets one agent choose another at run time.

  • The delegating agent's model reads skill descriptions exactly as it reads tool descriptions, and picks.
  • The same writing rules apply: say what the skill does, when to use it, and what it returns.
  • The card is also an attack surface: it is text from another party that a model will read. A card can be signed so its origin can be verified.

In the real world: A company's agent registry lists forty internal agents with owners and review dates; a new agent cannot be delegated to until its card is registered and its owner named.

{
  "name": "Kirana Kart Refunds Agent",
  "description": "Decides and issues refunds for Kirana Kart orders.",
  "version": "2.3.0",
  "supportedInterfaces": [
    { "url": "https://agents.kiranakart.example/refunds", "protocolBinding": "JSONRPC" }
  ],
  "capabilities": { "streaming": true, "pushNotifications": true },
  "securitySchemes": { "oauth": { "type": "oauth2" } },
  "skills": [
    {
      "id": "refund-decision",
      "name": "Decide and issue a refund",
      "description": "Given an order id and the customer's complaint, checks the policy and issues a refund if due. Asks for a photo when an item is reported damaged.",
      "examples": ["Order 88213 arrived an hour late; refund the delivery fee."]
    }
  ]
}

Trusting a card because it is well formed. Anyone can publish a card claiming to be the refunds agent. Check where it came from: a registry you control, a domain you trust, a valid signature.

Tasks, messages and artifacts

What it is

A2A models the work with four objects:

  • A message is one turn of communication, from the client agent ('user' role) or the remote agent, made of parts.
  • A part is one piece of content: text, a file, or structured data.
  • A task is a unit of work the remote agent has accepted. It has an id, a status and a history, and it persists while the work runs.
  • An artifact is an output the task produces: a report, a file, a result object. Also made of parts.

Why it matters

Separating conversation from work is what makes long tasks manageable.

  • Messages are how the two agents talk. The task is the thing being tracked.
  • A quick request can be answered with a message alone, with no task created.
  • A long one returns a task at once; the caller checks on it, or is told when it changes.
  • Artifacts keep results distinct from chatter, so the caller knows what the deliverable is.

In the real world: A report-writing agent returns a task id immediately and delivers the finished report as an artifact forty minutes later through a webhook; the calling agent was free the whole time.

// Client agent -> remote agent
{
  "jsonrpc": "2.0", "id": 1, "method": "SendMessage",
  "params": { "message": {
    "role": "ROLE_USER",
    "parts": [{ "text": "Order 88213 arrived an hour late; refund the delivery fee." }]
  } }
}

// Remote agent -> client agent: a task was created and is under way
{
  "jsonrpc": "2.0", "id": 1,
  "result": { "task": { "id": "task-7f3a", "status": { "state": "TASK_STATE_WORKING" } } }
}

Polling a task every second for an hour. Use streaming for tasks you are waiting on, and push notifications (a webhook the remote agent calls) for long ones, so nothing sits in a loop asking 'done yet?'.

The task lifecycle

What it is

A task moves through defined states. In A2A 1.0:

  • submitted: received, not yet started;
  • working: in progress;
  • input required: paused; the remote agent needs something from the caller;
  • auth required: paused; further authorisation is needed;
  • completed, failed, canceled, rejected: finished, one way or another. These are final.

Why it matters

Named states are what let two independent systems agree on where things stand.

  • 'Input required' is the protocol's form of human-in-the-loop: the task waits, across the boundary, until an answer arrives.
  • 'Rejected' lets an agent decline work it should not do, which is different from failing at it.
  • Final states tell the caller it can stop waiting and decide what to do next.
  • This is the state machine of module 6, standardised between organisations.

In the real world: A travel agent delegating to an airline's agent receives 'input required: passport number'; it asks the traveller, sends the answer on the same task, and the booking continues.

Visual example

Lifecycle

The third state is where a person, or the calling agent, is brought in.

The states of a delegated task

  1. SubmittedRemote agent accepted the task
  2. WorkingPlanning, using its own tools
  3. Input requiredNeeds a photo; task pauses
  4. Working againCaller sends the photo
  5. CompletedRefund artifact returned

Handling only 'completed'. A caller that ignores 'input required' leaves the task waiting for ever; one that treats 'rejected' as a passing fault retries a refusal.

Task delegation across a boundary

What it is

Delegating to an agent you do not control has five steps:

  • Discover: fetch the agent card from a trusted source.
  • Select: match the sub-goal to one of its skills.
  • Authenticate: obtain credentials using the scheme the card declares.
  • Send: pass the task as a message, with only the context the peer needs.
  • Follow: stream updates, receive notifications or poll; answer questions; collect artifacts; handle every final state.

Why it matters

Everything from module 16 about briefing still applies, with less trust.

  • The peer cannot see your context, so the message must be self-contained.
  • You should send the minimum: this is another organisation, and what you send may be stored.
  • What comes back is untrusted input. An artifact from another agent can contain instructions aimed at yours.
  • Authority should not travel by default: the peer acts with the rights you grant it for this task, not with your user's full rights.

In the real world: A hiring agent delegating a background check sends the candidate's name and consent reference, not the interview notes; the returned report is validated against a schema before the hiring agent reads it.

Visual example

Delegation

Every arrow crosses a trust boundary. Send the minimum; verify what returns.

Delegating to an agent in another system

  1. DiscoverRead the peer's agent card
  2. Select a skill'Decide and issue a refund'
  3. AuthenticateToken scoped to this task
  4. Send the taskOrder id and complaint only
  5. Follow to the endValidate the returned artifact

Forwarding your whole conversation to a third-party agent 'for context'. It may contain other customers' data, internal notes or credentials. Write a brief containing only what the task needs.

Where agent-to-agent architectures are useful

What it is

They fit when the boundary between agents is real:

  • Across companies: a travel agent working with airline, hotel and payment agents.
  • Across departments: an onboarding agent coordinating HR, IT and facilities agents, each owned by its team.
  • Across frameworks: agents built on different stacks that must cooperate.
  • Agent marketplaces: choosing a specialist agent at run time by its advertised skills.
  • Opaque specialists: an agent whose prompts, tools or data its owner will not expose.

Why it matters

The gain is organisational more than technical.

  • Each team ships and changes its agent on its own schedule.
  • Specialist knowledge stays with the team that has it.
  • New capabilities are added by registering an agent, not by redeploying a central system.
  • The costs are real too: each hop adds latency, a failure point and a trust question, and end-to-end debugging needs tracing that crosses organisations.

In the real world: A logistics firm's customers' agents can book shipments by talking to its booking agent over A2A; the firm did not need to publish an API for every booking variation, only the agent's skills.

Building a 'network of agents' inside one team because the protocol exists. Inside one codebase, a supervisor calling workers as functions is simpler, faster and easier to trace.

Security and governance between agents

What it is

An agent that accepts tasks from other agents is a public interface. It needs:

  • Authentication: who is calling? The card declares schemes such as OAuth 2 or mutual TLS.
  • Authorisation: what may this caller ask for, on whose behalf?
  • Scoped delegation: the peer receives only the rights needed for this task, for a limited time.
  • Input and output checks: messages and artifacts from peers are untrusted and may carry injection.
  • Limits: rate limits, cost limits and a maximum delegation depth, so agents cannot call each other in a loop.
  • Audit: a record of which agent asked which agent to do what, tied to a task id.

Why it matters

Chains of agents spread both capability and risk.

  • If agent A can ask B, and B can ask C, then A can reach whatever C can do, unless each hop limits it.
  • A compromised or confused agent in the chain can pass poisoned content onwards.
  • Responsibility must be traceable: when a wrong refund is issued three hops away, someone has to be able to say who asked for it.
  • The specifications are young and still moving; pin versions and keep the protocol behind a thin layer of your own code.

In the real world: A company caps delegation depth at two and logs every cross-agent task with the originating user; when a mis-issued credit appears, the audit shows which agent requested it and why within minutes.

Visual example

Controls

The same questions as for any public API, plus two that are new.

Controls at an agent-to-agent boundary
questioncontrol
Who is calling?Authentication declared in the agent card
What may they ask?Authorisation per skill and per caller
With whose rights?A short-lived token scoped to this task
Is the content safe?Treat peer messages and artifacts as untrusted input
Can it run away?Rate, cost and delegation-depth limits
Who is accountable?Audit log keyed by task and originating user

Passing the end user's full credentials down the chain so 'everything just works'. Every agent in the chain can then do anything the user can. Issue narrow, short-lived tokens per task.

Practise it: Design a Multi-Agent Data Analyst, Design an AI Customer Support Agent

Interview questions: agent-to-agent communication

What it is

The questions interviewers ask about agent-to-agent communication, from the first screening call to the senior round. Cover the answer, say yours aloud, then compare.

Why it matters

Reading an idea and explaining it are different skills.

  • Each answer below is the two or three sentences an interviewer is listening for.
  • The reasoning behind each one is in the cards above. If an answer surprises you, go back to that card.

In the real world: An interviewer asks 'MCP or A2A for this?'; the answer they are after is the test itself: 'am I asking for a function to be run or a goal to be achieved?'.

Q: What is an agent-to-agent protocol?

A standard by which independently built agents describe themselves, accept tasks and return results, without sharing internals. A2A is the leading open example: agent cards for discovery, tasks with a lifecycle, messages and artifacts.

Q: How is A2A different from MCP?

MCP connects an agent to tools and data: passive capabilities called like functions. A2A connects an agent to another autonomous agent that plans its own work, may run long and may ask questions. They are used together.

Q: What is an agent card?

A JSON document an agent publishes describing its identity, skills, endpoint, supported features and required authentication, conventionally at a well-known URL. The calling agent's model reads the skills to choose whom to delegate to.

Q: How does capability discovery work?

The client fetches the card from a registry or well-known address, checks its origin, and matches the sub-goal to a skill by its description and examples.

Q: Describe a delegated task's lifecycle.

Submitted, working, optionally input required or auth required, then a final state: completed, failed, canceled or rejected. The caller streams, is notified or polls, answers questions on the same task, and collects artifacts.

Q: When would you use A2A rather than a function call?

At a real boundary: different teams, companies or frameworks, opaque specialists, or long-running work. Inside one codebase, call the other agent directly.

Q: What are the security concerns?

Spoofed cards, over-broad delegated authority, injection through peer messages and artifacts, delegation loops, and unclear accountability. Use authenticated callers, scoped short-lived tokens, input validation, depth limits and an audit trail.

Q: How do you debug across agents you do not own?

Propagate a task and trace id across hops, log each hop's request and final state, and require peers to return structured status and errors. You can see their outcomes, not their reasoning.

Treating A2A and MCP as competitors, or describing either as 'how agents talk' without saying to what.

Exercise: design an agent card and a delegation flow

What it is

A short build that uses this module's ideas. Write it yourself before looking anything up; the checks at the end tell you whether it works.

Why it matters

An idea you have only read fades in a week.

  • Building it once, even in fifty lines, is what makes it yours.
  • Interviewers can tell the difference between someone who has read about a loop and someone who has debugged one.

In the real world: An integration team prototypes a partner connection this way in a week, which is how long the previous bespoke API integration took just to agree the field names.

Your task. Write the agent card for a refunds agent and build a minimal two-agent delegation over HTTP that handles every task state.

Steps

  1. Write an agent card for the Kirana Kart refunds agent with two skills, each with a description and an example. Have a colleague, or a model, choose between the skills for five requests and fix any description that causes a wrong choice.
  2. Build a small HTTP service for the refunds agent with three operations: send a message (returns a task), get a task, and send a follow-up message on a task.
  3. Make the task move through submitted, working and completed, and through input required when the complaint is 'damaged item' with no photo.
  4. Build a client agent that reads the card, sends a task, follows it, answers the input request and collects the artifact.
  5. Have the service reject a request for another customer's order with a 'rejected' state, and confirm the client does not retry it.
  6. Validate the returned artifact against a schema before the client's model reads it.

You are done when

  • The client contains no hard-coded knowledge of the refunds agent beyond the card's address.
  • All of completed, failed, rejected and input required are handled by distinct code paths.
  • The message sent contains only the order id and complaint, not the client's conversation.
  • A trace id appears in the logs of both services for the same task.

Stretch. Replace your home-made operations with an official A2A SDK and compare what it gives you for free.