Complete architectural guide to the Linux Foundation Agent2Agent (A2A v0.3 → v1.0) protocol, deciding between intra-app AgentTool / sub-agents and inter-app A2A delegation, and composing the 5-layer agentic ecosystem: MCP (tools), A2A (peer agents), A2UI / AG-UI / MCP UI (declarative generative UI), Live Streaming, and AP2 + x402 (agentic commerce).
The Agent2Agent (A2A) protocol is an open, vendor-neutral standard initiated by Google with 50+ enterprise partners and governed by the Linux Foundation. It defines how autonomous agents discover capabilities, negotiate modalities, delegate stateful tasks, stream incremental artifacts, and enforce enterprise security across organizational and framework boundaries.
A2A solves the Multi-Agent Silo problem: compliant agents built on Google ADK, LangGraph, CrewAI, or SaaS platforms (Workday, Salesforce, ServiceNow, SAP) collaborate as opaque peers without exposing internal prompts, session databases, tool credentials, or model weights.
| Dimension | Model Context Protocol (MCP) | Agent2Agent Protocol (A2A) |
|---|---|---|
| Topology | Vertical integration (Agent ↔ Tool / Database / Resource). |
Horizontal peer orchestration (Client Agent ↔ Remote Specialist Agent). |
| Execution Model | Primarily stateless, schema-bound RPCs (tools/call) for deterministic actions and lookups. |
Stateful cognitive reasoning, multi-turn clarification (input-required), and asynchronous workflows spanning seconds to days. |
| Discovery Artifact | tools/list JSON Schema over stdio or Streamable HTTP. |
AgentCard at /.well-known/agent-card.json (plus authenticated extended cards & Agent Registry). |
A front-door orchestrator in Gemini Enterprise distributes domain sub-goals over A2A to specialized departmental agents, and each specialist agent invokes its own private databases and APIs over MCP.
AgentCard skills, decomposes goals, dispatches tasks, handles interruptions, and synthesizes returned artifacts.a2a.proto)AgentCard, Task, Message, Part [TextPart, DataPart, FilePart], Artifact, TaskStatusUpdateEvent, TaskArtifactUpdateEvent).SendMessage (v0.3: message/send), SendStreamingMessage (message/stream), GetTask (tasks/get), CancelTask (tasks/cancel), SubscribeToTask (v0.3: tasks/resubscribe — reconnects SSE to an active in-flight task after network drop), and GetExtendedAgentCard (REST: GET /extendedAgentCard).supportedInterfaces): Each interface declares a url and protocolBinding supporting JSONRPC (JSON-RPC 2.0 over HTTPS), HTTP+JSON (REST), or GRPC.A2A tracks work via taskId (one stateful execution unit) grouped across multi-turn threads by contextId. Know the exact difference between active, interrupted, and terminal states:
| Category | States | Stream & Client Behavior |
|---|---|---|
| Active | submitted, working | Queued or actively running; SSE streams stay open and emit status/artifact events |
| Interrupted | input-required, auth-required | SSE stream closes cleanly; client gathers missing user input (input-required, natural HITL pause) or completes OAuth step-up (auth-required) and resumes using the same taskId + contextId |
| Terminal | completed, failed, canceled, rejected | Execution permanently finished (rejected means the remote agent declined the request); follow-ups create a new taskId under the shared contextId |
Fetch /.well-known/agent-card.json or query Agent Registry.
Match goal against skills[], MIME modes, and security schemes.
Call SendMessage or SendStreamingMessage with header auth.
Handle incremental updates or input-required / auth-required pauses.
Consume typed Artifact chunks for chaining or UI rendering.
SendMessage): Single blocking HTTP exchange for fast sub-second to ~10s lookups.SendStreamingMessage + SSE): Server pushes real-time TaskStatusUpdateEvent and chunked TaskArtifactUpdateEvent payloads (append: false/true, lastChunk: true); reconnect dropped streams with SubscribeToTask.SendMessage → GetTask): Server returns submitted/working + taskId immediately; client polls GetTask when persistent SSE or inbound webhooks are blocked by firewalls.pushNotificationConfig callback URL; server posts signed async state notifications across multi-hour or multi-day workflows without holding open connections (verify HMAC/JWT webhook signatures + replay nonces!).Match transport to duration: using synchronous SendMessage or even long-lived SSE for a 4-hour research job hits proxy/Cloud Run (60-minute max) timeouts. Switch to Push Notifications (Webhooks) or Polling for multi-hour tasks.
/.well-known/agent-card.json for open discovery. Version trap: early drafts showed agent.json / tasks/send; v0.3 used agent-card.json + message/send; v1.0 keeps agent-card.json with PascalCase SendMessage.capabilities.extendedAgentCard: true (v0.3: supportsAuthenticatedExtendedCard); authenticated callers invoke GetExtendedAgentCard to retrieve sensitive internal skills.AgentTool vs. Inter-App A2AA core Professional Agentic Architect design decision is choosing between in-process composition (ADK sub_agents transfer or AgentTool) and network-isolated A2A delegation:
| Dimension | Intra-App (sub_agents / AgentTool) | Inter-App (A2A Protocol) |
|---|---|---|
| Team & Repo Boundary | Single repo, unified CI/CD release, homogeneous runtime stack (e.g., all Python ADK) | Independent teams/repos, separate release cycles, polyglot frameworks (ADK ↔ LangGraph ↔ SaaS vendor) |
| Session & Memory Scope | Shared in-process InvocationContext & session.state | Strict opacity: remote agent maintains its own private store; sees only explicit Part payloads sent per contextId |
| IAM & Blast Radius | Shares one container & service identity — wide blast radius if compromised | Hard security boundary: separate SPIFFE Agent Identity, VPC-SC perimeter, least-privilege IAM, and scoped OAuth token exchange |
| Latency & Overhead | Zero network serialization (in-memory call); lowest TTFT | HTTPS/gRPC hop + auth validation + independent remote reasoning loop |
| Live Voice / Modality Boundary | Native in-memory context sharing | Modality normalization: live voice front-doors (CX Agent Studio / Gemini 3.8 Live) terminate audio streams locally and delegate normalized TextPart / DataPart / FilePart tasks over A2A |
| Layer | Open Protocol(s) | What It Standardizes |
|---|---|---|
| 1. Agent ↔ Tool / Data | MCP & OpenAPI | Vertical, deterministic tool calls, DB queries, and resource reads |
| 2. Agent ↔ Agent | A2A | Horizontal stateful task delegation & discovery across opaque peer agents |
| 3. Agent ↔ User Generative UI | A2UI (v0.8 / v0.9), AG-UI, MCP UI | Safe, interactive rich UI components without arbitrary remote JS execution |
| 4. Real-Time Multimodal Stream | Gemini Live API (WebRTC / WSS) | Sub-second bidirectional PCM audio & video streaming with VAD barge-in |
| 5. Agent ↔ Commerce / Money | AP2 (Agent Payments Protocol) & x402 | Cryptographic human purchase mandates (AP2) & HTTP 402 M2M micropayments (x402) |
A2UI vs. AG-UI vs. MCP UIDataPart payloads against a client-approved Component Catalog (basic, Material, or custom widgets). The host client renders native, brand-consistent UI with zero arbitrary JS/iframe XSS risk.AP2 & x402402 Payment Required headers so agents can autonomously pay per API call, dataset query, or compute unit via programmatic M2M micropayments without pre-provisioned subscriptions.AgentCard skills and synthesizes their artifacts.to_a2a() & A2aAgentExecutor): Define AgentCard + AgentSkills, bridge the task loop with A2aAgentExecutor (automated by to_a2a(root_agent)), and deploy to Cloud Run, GKE, or Agent Runtime (A2aAgent).RemoteA2aAgent): Consume any remote A2A peer inside an ADK orchestrator by pointing at its AgentCard or Agent Registry URI.traceparent headers into Cloud Trace.supportedInterfaces), security, and skill manifest at /.well-known/agent-card.json.taskId) & contextIdtaskId) correlated across multi-turn threads by contextId.TextPart / DataPart / FilePartA2UI), and MIME-typed files.SubscribeToTaskA2UI), frontend-agent event sync (AG-UI), and tool-embedded UI (MCP UI).AP2) and HTTP 402 M2M micropayments (x402).Q1. When should you choose A2A over ADK's in-process AgentTool?
Q2. How does A2UI prevent Cross-Site Scripting (XSS) when rendering UI from a remote third-party A2A agent?
Q3. How do AP2 Intent Mandates and x402 solve different commerce problems?
Drill scenario-based questions on A2A v1.0 wire operations, Agent Cards, Intra-App AgentTool vs. Inter-App A2A boundaries, A2UI/AG-UI/MCP UI, AP2 & x402 commerce, and zero-trust A2A security.