Skip to main content

10. Agent Communication Protocols

Introduction to AI Agent Protocols

AI agent protocols are shared contracts so hosts, tools, and agents can discover capabilities, authenticate, exchange structured messages, and collaborate without one-off glue for every integration. This module introduces the landscape β€” function/OpenAPI tooling, Model Context Protocol (MCP) for tools and context, and Agent-to-Agent (A2A) for peer delegation β€” before deep-diving each. Protocols do not replace budgets, HITL, or eval; they standardize the wires.

What you will learn

  • Explain why agent protocols beat ad-hoc tool glue
  • Compare OpenAPI/functions, MCP, and A2A roles
  • Name the layers: transport, auth, discovery, messages
  • Choose when a protocol is worth adopting
  • Answer interview questions with short, solid answers
Hosts protocol tools and agents overview
Interview staple: protocols standardize discovery, auth, and messages between hosts, tools, and agents.

Definition

An AI agent protocol is an agreed set of message formats, discovery rules, and often auth/transport conventions that let independent components β€” LLM hosts, tool servers, data sources, or other agents β€” interoperate. Without protocols, every IDE, chat app, and agent framework reinvents connectors.

Protocols sit below product UX and above raw TCP/HTTP: they define how to list tools, call them, stream results, share resources, or hand off tasks to another agent.

Introduction

This lesson (#1 in Agent Communication Protocols) opens Module 10 after Advanced Concepts. You have agents, tools, and workflows; protocols make those connections portable and safer to govern.

Next: Model Context Protocol (MCP) β€” the host↔server pattern for tools, resources, and prompts.

Why protocols

  • NΓ—M connector explosion without shared contracts
  • Capability discovery instead of hard-coded tool lists
  • Clearer trust boundaries and permission models
  • Reusable servers across IDEs, chat apps, and runners
  • Easier audit of what was called and why

Landscape

Pick the contract that matches the job β€” tools vs peer agents.

OpenAPI MCP A2A landscape comparison
MCP connects hosts to tools/context; A2A connects agents to agents; OpenAPI still matters for plain APIs.
  • OpenAPI / function calling - schema-driven HTTP or local tools owned by one app
  • MCP - standard host client to MCP servers for tools, resources, prompts
  • A2A - agent cards, discovery, and task delegation between agents
  • They can coexist: an agent may use MCP tools and A2A peers
  • Legacy RPCs and custom JSON still appear β€” migrate when reuse pays off

Protocol stack

Every serious integration contract covers the same layers.

Messages discovery auth transport protocol stack
Skipping auth or discovery is how brittle demos become production incidents.
  • Messages/schemas - calls, results, errors, tasks, streaming events
  • Discovery - list tools, resources, agent capabilities
  • AuthZ - who may invoke which capability under which scopes
  • Transport - stdio, HTTP, SSE/streams, session lifecycle
  • Observability hooks - correlation ids and audit fields

Hosts, servers, peers

  • Host / app - LLM runtime that decides when to call out
  • Tool/context server - exposes capabilities (classic MCP role)
  • Peer agent - another autonomous party (classic A2A role)
  • Gateway - optional policy and routing in front of many servers
  • User - still the authority for consent and HITL

When to adopt a protocol

  • Same tools needed in more than one host (IDE + chat + batch)
  • Partners or teams must publish capabilities safely
  • You need discovery instead of redeploying for every tool add
  • Compliance wants a single audit shape for tool calls
  • Skip if one private script will never be reused

Safety and governance

  • Protocols enable allowlists β€” they do not replace them
  • Authenticate servers and agents; verify identities
  • Scope tools narrowly; least privilege per session
  • Treat remote tool output as untrusted content
  • Log protocol calls with user and policy context

Failure modes

  • Calling everything β€œMCP” while shipping ad-hoc JSON
  • No auth on local tool servers exposed to the network
  • Discovery without policy β†’ agents see dangerous tools
  • Confusing A2A delegation with a simple tool call
  • Ignoring versioning β€” hosts and servers drift

Map to this module

  • Next lessons deepen MCP architecture and integration
  • Then A2A discovery and delegation
  • Finally MCP vs A2A and how they interoperate
  • Earlier modules: tools, workflows, and security still apply

Program / implementation notes

Inventory current tool integrations: which are one-off OpenAPI wrappers vs candidates for an MCP server. Sketch which cross-team handoffs need A2A later. Do not rewrite everything on day one.

  • Start by publishing one high-value tool surface via a standard protocol
  • Next: Model Context Protocol (MCP)

Advantages and limitations

  • Advantage: reuse tools/agents across hosts
  • Advantage: clearer discovery and governance
  • Advantage: ecosystem servers instead of custom glue
  • Limitation: protocol churn and version skew
  • Limitation: not a substitute for product security design
  • Limitation: over-protocolizing tiny internal scripts wastes time

Key points

  • Protocols standardize discovery, auth, and messages for agents/tools.
  • OpenAPI/functions, MCP, and A2A solve different integration jobs.
  • Stack: messages, discovery, authZ, transport, observability.
  • Adopt protocols when reuse, partners, or audit demand it.
  • Allowlists and HITL still sit above any protocol.
  • Next deep dive: MCP for host↔tool/context servers.

FAQs

Is function calling already a protocol?

Function calling is a model↔host convention for tool schemas. Broader protocols like MCP standardize how many hosts talk to many external servers beyond one app’s wiring.

MCP vs A2A in one sentence?

MCP connects an AI host to tools/resources/prompts; A2A connects agents to other agents for discovery and task delegation.

Do protocols replace agent frameworks?

No. Frameworks orchestrate reasoning loops. Protocols define how those loops talk to external tools and peer agents.

When keep plain OpenAPI?

When a single app owns a stable HTTP API and you do not need multi-host discovery or shared context servers yet.

Interview questions

  1. What is an AI agent protocol?

    Answer A shared contract for discovery, authentication, transport, and structured messages so hosts, tools, and agents can interoperate without one-off glue.

  2. Why do agent protocols matter?

    Answer They cut NΓ—M integrations, enable capability discovery, clarify trust boundaries, and make tool/agent calls auditable across products.

  3. How do OpenAPI, MCP, and A2A differ?

    Answer OpenAPI describes HTTP APIs for app-owned tools; MCP standardizes host-to-server tools/resources/prompts; A2A standardizes agent-to-agent discovery and delegation.

  4. What layers must a protocol cover?

    Answer Message schemas, capability discovery, authorization/trust, transport/session, and usually observability/audit fields.

  5. When should a team adopt MCP or A2A?

    Answer When the same capabilities must work across hosts or organizations, discovery and policy matter, and one-off connectors become a bottleneck.

  6. Do protocols make agents safe by themselves?

    Answer No. They help structure allowlists and audits, but teams still enforce scopes, HITL, budgets, and untrusted-output handling.

Related topics

Practice task

Complete each numbered practice step in a notebook or doc before opening the next lesson.

  1. List five tools your agents use and mark each OpenAPI-only, MCP-candidate, or A2A-candidate.
  2. Draw host β†’ protocol β†’ server/peer for one integration you want to standardize.
  3. Name the auth scopes that server should expose (read vs write).
  4. Write three interview-ready sentences distinguishing MCP and A2A.
  5. Answer interview questions 1, 3, and 4 in two sentences each.