Skip to content

Interoperability guide

Agent-to-Agent Protocols

How autonomous AI agents discover peers, delegate long-running tasks, and interoperate safely across frameworks and companies—covering A2A v1.0, MCP, AG-UI, and AGNTCY.

  • A2A v1.0 · Linux Foundation
  • AgentCard & Task state machine
  • A2A + MCP Python code
User UIweb / chatAG-UIOrchestratorhost agentA2A v1.0 (Task / Artifact)Peer Agentopaque vendorAgent Card/.well-knownMCP (private tools)SQL / APIsFiles / DataAGNTCYdirectory · DIDsA2A connects agents · MCP connects tools · AG-UI connects users
01

The 4-Layer Agent Interoperability Stack

In 2026, open agent standards stopped competing and converged into complementary layers anchored under the Linux Foundation.

Production multi-agent systems cross four distinct boundaries: talking to a user frontend, delegating work to an external peer agent, invoking private tools and databases, and resolving identity and directories across organizations.

Rather than one monolithic spec, the ecosystem converged on four open standards—with IBM's ACP (Agent Communication Protocol) formally merging into A2A in August 2025 under the Linux Foundation.

A2A v1.0

Peer Agent ↔ Remote Peer Agent · Linux Foundation · Agentic AI Foundation (AAIF)
User FrontendAG-UI / MCP AppsAG-UIHost Orchestrator AgentLangGraph · ADK · Claude · CustomA2A v1.0AGNTCY / ANPDirectory · DIDsRouting · OTelRemote Specialist Peer AgentAgentCard · Opaque memory & promptsMCP (private)Databases / SQLInternal APIs / Files

Lets independent, opaque agents discover each other via Agent Cards and collaborate on long-running Tasks with typed Artifacts across frameworks, clouds, and company boundaries.

A2A JSON-RPC 2.0 request (message/send)json
{
  "jsonrpc": "2.0",
  "id": "req-102",
  "method": "message/send",
  "params": {
    "message": {
      "role": "user",
      "parts": [{ "kind": "text", "text": "Audit GPU spend anomaly for Oct–Nov 2026" }]
    }
  }
}
Protocol / StandardBoundaryGovernanceWire Format & TransportDiscovery
A2A v1.0 (incl. ACP)Agent ↔ Peer AgentLinux Foundation (AAIF)JSON-RPC 2.0, gRPC, or HTTP+JSON REST (+ SSE & webhooks)/.well-known/agent-card.json
MCPAgent ↔ Tools & DataLinux Foundation (AAIF)JSON-RPC 2.0 over stdio or Streamable HTTPtools/list, resources/list, MCP Registry
AG-UIAgent ↔ Frontend UIOpen-source communityTyped event stream over HTTP SSE / WebSocketsFrontend client bindings
AGNTCYControl Plane / OpsLinux Foundation (ex-Cisco)Interoperable directory, identity & routing over A2A + MCPFederated Agent Directory + DIDs
ANP & x402 / AP2Open Web P2P & PaymentsOpen community / WebJSON-LD + DIDs (ANP); HTTP 402 payment headers (x402)W3C Decentralized Identifiers
02

Why A2A? (Opaque Peers & Long-Running Tasks)

Why calling another autonomous agent is fundamentally different from calling a stateless function or MCP tool.

01opacity

Strict Trust Boundaries

Peer agents are opaque by design. A partner's billing or legal agent exposes skills and outputs—never its system prompts, internal chain-of-thought, memory store, or private API credentials.

02async

Minutes-to-Hours Work

Unlike a 100 ms database lookup, delegated agent work can take minutes, pause for human confirmation (input-required), or request secondary OAuth consent (auth-required).

03interop

Cross-Framework Collaboration

An agent built with Google ADK, LangGraph, CrewAI, or OpenAI Agents SDK can delegate tasks to enterprise SaaS agents (ServiceNow, Salesforce, SAP) over one canonical schema.

03

Discovery: The Agent Card

Every A2A peer advertises its identity, skills, MIME modalities, and authentication contract at a standard well-known JSON endpoint.

Click any section on the right to inspect what a host orchestrator validates before sending its first to a remote agent.

GET /.well-known/agent-card.jsonjson
{
  "protocolVersion": "1.0",
  "name": "FinOps Billing Specialist",
  "description": "Audits cloud GPU spend, detects invoice anomalies, and produces reconciliation reports.",
  "url": "https://billing.acme.example/a2a",
  "provider": { "organization": "Acme FinOps", "url": "https://acme.example" },
  "capabilities": {
    "streaming": true,
    "pushNotifications": true,
    "stateTransitionHistory": true
  },
  "securitySchemes": {
    "oauth2": {
      "type": "oauth2",
      "flows": {
        "clientCredentials": {
          "tokenUrl": "https://auth.acme.example/oauth/token",
          "scopes": { "billing:read": "Inspect invoices", "billing:report": "Generate audit artifacts" }
        }
      }
    }
  },
  "security": [{ "oauth2": ["billing:read"] }],
  "defaultInputModes": ["text/plain", "application/json"],
  "defaultOutputModes": ["application/json", "text/markdown"],
  "skills": [
    {
      "id": "audit-gpu-spend",
      "name": "Audit GPU Spend",
      "description": "Compare billed GPU hours against cluster telemetry and flag overages.",
      "tags": ["finops", "gpu", "reconciliation"],
      "examples": ["Audit H100 spend for November 2026"]
    }
  ]
}

Authenticated Extended Cards

Keep public /.well-known/agent-card.json minimal for untrusted callers. After OAuth authentication, an enterprise peer can serve an extended card via agent/authenticatedExtendedCard exposing internal-only skills.

04

Messages, Parts, Tasks & Artifacts

Defined canonically in a2a.proto so JSON-RPC 2.0, HTTP+JSON REST, and gRPC clients share identical semantics.

01turn

Message

A single conversational turn (role: user | agent) carrying instructions, status notes, or clarification answers.

02payload

Part

Typed content unit inside a Message or Artifact: text, structured JSON data, or binary/URI file.

03stateful

Task

The durable work record identified by taskId and contextId, progressing through a formal state machine.

04output

Artifact

The immutable deliverable produced by the remote agent—JSON tables, reports, code diffs, or charts—streamed in chunks or on completion.

submittedworkinginput-requiredauth-requiredcompletedfailed / rejectedcanonical state machine (a2a.proto) · click any state above to inspect frame
workingremote agent → client (SSE)

The peer agent is actively executing (calling its own private MCP tools, querying databases, or running models) and streams incremental status updates.

Wire payload at this transitionjson
data: {
  "kind": "status-update",
  "taskId": "task_9f42",
  "status": {
    "state": "working",
    "message": { "role": "agent", "parts": [{ "kind": "text", "text": "Cross-checking 14,200 H100 GPU-hours via private MCP..." }] }
  },
  "final": false
}

Three equivalent wire bindings (a2a.proto)

JSON-RPC 2.0 over HTTPS
Universal default for web and Python/TS agents (message/send, message/stream, tasks/get).
HTTP+JSON (REST)
Resource-oriented routes folded in from IBM ACP for standard API gateways.
gRPC (Protobuf)
Low-latency binary streaming for high-throughput internal service meshes.

Three interaction modes

Synchronous Request/Response
Fast tasks return the completed Task & Artifacts in a single HTTP response.
SSE Streaming
message/stream pushes live status-update and artifact-update events over one connection.
Webhook Push Notifications
For multi-hour workflows, the peer signs and POSTs updates to a client callback URL.
05

Putting It Together: A2A + MCP in Production

A concrete FinOps audit turn showing how AG-UI, A2A v1.0, and MCP collaborate without leaking credentials or duplicating glue code.

01AG-UI

User asks

Operator asks the web console to audit November GPU overages.

02Discovery

Fetch Card

Host agent reads billing peer's /.well-known/agent-card.json & OAuth scope.

03A2A v1.0

Delegate Task

Host sends message/stream with Bearer token and traceparent header.

04MCP

Private Tools

Billing peer queries Postgres & Stripe via its own private MCP servers.

05Artifact

Stream & Render

Peer streams audit JSON artifact over A2A; host renders chart via AG-UI.

Decision Matrix: What Should You Use?

Architecture NeedRecommended StandardWhy
Sub-agents in one codebase / processIn-process graph (LangGraph, ADK, Swarm)Zero network hop; share memory and typed state directly when one team owns everything.
Connect an LLM to DBs, Git, APIs, filesMCPStateless tool schemas, URI resources, and clear server-side credential isolation.
Delegate to remote / vendor / cross-team agentsA2A v1.0Opaque peers, Agent Card discovery, async Task state machine, and cross-org OAuth.
Stream progress, forms & approvals to usersAG-UI / MCP AppsTyped frontend events, generative UI state sync, and human-in-the-loop interrupts.
Discover & verify agents across companiesAGNTCY (+ DIDs / x402)Federated directory lookup, cryptographic agent identity, and machine-native billing.
06

Hands-On: Minimal A2A v1.0 Server & Client (Python)

A complete Python 3.12+ peer exposing an Agent Card, SSE task streaming, caller-bound Task lookup, and an internal MCP tool boundary.

1. Specialist Peer Agent (FastAPI)

For production apps, you can also use the official a2a-sdk (Python) or @a2a-js/sdk (TypeScript)—the wire contract below is identical.

billing_a2a_agent.pypython
import hmac
import json
import os
import uuid
from dataclasses import dataclass
from fastapi import FastAPI, HTTPException, Request
from fastapi.responses import StreamingResponse

app = FastAPI(title="FinOps A2A Peer Agent")
A2A_BEARER_TOKEN = os.getenv("A2A_BEARER_TOKEN", "replace-in-prod")

@dataclass
class TaskRecord:
    task_id: str
    owner: str          # Bound to verified caller identity — never trust Task ID alone
    state: str
    artifact: dict | None = None

TASKS: dict[str, TaskRecord] = {}

def verify_caller(request: Request) -> str:
    """Validate OAuth 2.1 / Bearer token from HTTP headers (never inside JSON payloads)."""
    auth = request.headers.get("authorization", "")
    if not auth.startswith("Bearer "):
        raise HTTPException(status_code=401, detail="Missing Bearer token")
    token = auth.split(" ", 1)[1]
    if not hmac.compare_digest(token, A2A_BEARER_TOKEN):
        raise HTTPException(status_code=401, detail="Invalid token")
    return "svc:orchestrator"  # In production, extract 'sub' from verified JWT

@app.get("/.well-known/agent-card.json")
async def agent_card():
    return {
        "protocolVersion": "1.0",
        "name": "FinOps Billing Specialist",
        "url": "https://billing.acme.example/a2a",
        "capabilities": {"streaming": True, "pushNotifications": False},
        "securitySchemes": {"bearerAuth": {"type": "http", "scheme": "bearer"}},
        "security": [{"bearerAuth": []}],
        "skills": [{"id": "audit-gpu-spend", "name": "Audit GPU Spend"}],
    }

async def run_private_mcp_audit(prompt: str) -> dict:
    """Internal tool call over private MCP — credentials never leave this agent."""
    # In production: call self.mcp_session.call_tool("query_billing_ledger", {...})
    return {"query": prompt, "billedUsd": 48200, "telemetryUsd": 44000, "deltaUsd": 4200}

@app.post("/a2a")
async def handle_a2a(request: Request):
    caller = verify_caller(request)
    body = await request.json()
    method, req_id = body.get("method"), body.get("id")
    params = body.get("params", {})

    if method == "message/stream":
        task_id = f"task_{uuid.uuid4().hex[:8]}"
        TASKS[task_id] = TaskRecord(task_id=task_id, owner=caller, state="working")
        prompt = params["message"]["parts"][0]["text"]

        async def event_stream():
            yield f"data: {json.dumps({'kind': 'status-update', 'taskId': task_id, 'status': {'state': 'working'}})}

"
            report = await run_private_mcp_audit(prompt)
            TASKS[task_id].state = "completed"
            TASKS[task_id].artifact = report
            yield f"data: {json.dumps({'kind': 'artifact-update', 'taskId': task_id, 'artifact': {'name': 'audit.json', 'parts': [{'kind': 'data', 'data': report}]}})}

"
            yield f"data: {json.dumps({'kind': 'status-update', 'taskId': task_id, 'status': {'state': 'completed'}, 'final': True})}

"

        return StreamingResponse(event_stream(), media_type="text/event-stream")

    if method == "tasks/get":
        task = TASKS.get(params.get("id", ""))
        if not task or task.owner != caller:
            raise HTTPException(status_code=404, detail="Task not found")
        return {"jsonrpc": "2.0", "id": req_id, "result": {"id": task.task_id, "status": {"state": task.state}}}

    raise HTTPException(status_code=400, detail=f"Unsupported method: {method}")

2. Orchestrator Client

Discovers the Agent Card, propagates a W3C traceparent for distributed tracing, and consumes streamed status & artifact frames:

orchestrator_client.pypython
import asyncio
import json
import os
import httpx

PEER_BASE = "http://localhost:8000"
TOKEN = os.getenv("A2A_BEARER_TOKEN", "replace-in-prod")

async def delegate_audit() -> None:
    headers = {
        "Authorization": f"Bearer {TOKEN}",
        "traceparent": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
    }
    async with httpx.AsyncClient(timeout=30.0) as client:
        # 1. Discover peer capabilities via /.well-known/agent-card.json
        card = (await client.get(f"{PEER_BASE}/.well-known/agent-card.json")).json()
        print(f"Discovered: {card['name']} (A2A {card['protocolVersion']})")

        # 2. Stream a delegated Task via message/stream (SSE)
        payload = {
            "jsonrpc": "2.0",
            "id": "req-1",
            "method": "message/stream",
            "params": {
                "message": {
                    "role": "user",
                    "parts": [{"kind": "text", "text": "Audit H100 spend for November 2026"}],
                }
            },
        }
        async with client.stream("POST", f"{PEER_BASE}/a2a", headers=headers, json=payload) as resp:
            resp.raise_for_status()
            async for line in resp.aiter_lines():
                if line.startswith("data: "):
                    event = json.loads(line[6:])
                    print(event["kind"], "->", event.get("status") or event.get("artifact"))

if __name__ == "__main__":
    asyncio.run(delegate_audit())

Run locally in two terminals

run-a2a-demo.shbash
pip install fastapi uvicorn httpx
export A2A_BEARER_TOKEN="dev-secret-token"

# Terminal 1 — start A2A peer
uvicorn billing_a2a_agent:app --port 8000

# Terminal 2 — run orchestrator client
python orchestrator_client.py
07

Production Security & Multi-Agent Failure Modes

Connecting autonomous agents across trust boundaries introduces threats that never existed in single-agent apps.

Identity, Auth & Isolation

  • Transport-layer credentials only: Carry OAuth 2.1 / OIDC Bearer tokens or mTLS in transport headers—never inside A2A JSON message parts or LLM prompts.
  • Task ID ≠ Authorization: Always bind each taskId to the verified caller subject (task.owner == caller) to prevent cross-tenant task hijacking and confused-deputy attacks.
  • Sign & verify Agent Cards: Enforce HTTPS + JWS card signatures or verified AGNTCY directory entries so an attacker cannot spoof a peer's skills or redirect OAuth tokens.

Agentic Resilience & Guardrails

  • Untrusted peer output: Treat remote agent Messages and Artifacts as untrusted data—sanitize and validate schemas before feeding them into local MCP write tools (prompt-injection containment).
  • Hop & budget caps: Propagate max_hops, dollar/token budgets, and strict deadlines across delegated tasks to stop infinite agent-to-agent ping-pong loops.
  • Distributed tracing: Forward W3C traceparent headers across AG-UI → A2A → MCP so OpenTelemetry captures one unified waterfall across every agent.
08

Standards & Official Resources

Primary specifications, Linux Foundation working groups, SDKs, and companion guides on StudioTV.

Core Specifications & Governance

UI Protocols, SDKs & Tooling