Contents

A2A Protocol and MCP Architecture Guide

A compliance agent accepts a review, then asks for supporting documents or extra authorization. Across separate teams and frameworks, how does the caller resume that Task and retrieve the final Artifact?

The Agent2Agent (A2A) Protocol defines that cross-boundary contract (introduced by Google in April 2025, transitioned to the Linux Foundation in June 2025, with v1.0 released in March 2026; separately, MCP joined the AAIF as a founding project in December 2025). Getting A2A v1.0.1 right (What’s New in v1, Life of a Task) comes down to separating A2A from MCP, validating v1 Agent Cards strictly, and handling resumable Task states cleanly.

Orthogonal Roles: A2A vs. MCP

A2A and MCP address separate planes of a multi-agent architecture rather than competing:

flowchart LR Client["Coordinator Agent (A2A Client)"] -->|"A2A: Discover Card / Delegate & Resume Task"| Compliance["Compliance Agent (A2A Server)"] Client -->|"A2A: Retrieve Final Artifact"| Review["Engineering Review Agent (A2A Server)"] Compliance -->|"MCP: Query Policy & Approval Records"| PolicyDB["Compliance Policy Store"] Review -->|"MCP: Invoke Git / CI Tools"| RepoTools["Code & Build Tooling"]
  • MCP (vertical: agent → tools and data): Exposes deterministic tools and data sources to a single agent through a uniform schema.
  • A2A (horizontal: agent → agent): Treats a remote autonomous agent as an opaque peer—callers couple only to declared interfaces, skills, and task states rather than internal prompts or model choices.

When all roles live inside one repository and team, in-process orchestration (see Multi-Agent Systems Guide) is simpler; A2A earns its keep across team, language, or organizational boundaries.

Three-Layer Specification and Official SDKs

A2A anchors its normative schema in Protocol Buffers (a2a.proto) across three layers:

  1. Canonical Data Model: Transport-agnostic Message, Part, Task, Artifact, and AgentCard definitions.
  2. Abstract Operations: Wire-independent semantics for messaging, task lifecycle, cancellation, and subscriptions.
  3. Protocol Bindings: Functionally equivalent bindings for JSON-RPC 2.0 over HTTP(S), gRPC, and HTTP+JSON/REST. Support for SSE streaming, subscriptions, and push notifications is negotiated via capabilities declared in the Agent Card.

The official SDK list includes TypeScript/JavaScript (@a2a-js/sdk), Go (github.com/a2aproject/a2a-go), Python (a2a-sdk), Rust (a2a-lf), and official Java and .NET packages.

Normative Task Lifecycle with Resumable States

Simple exchanges can return a direct Message without creating a Task. For multi-step workflows like a compliance review, Life of a Task defines resumable states alongside four immutable terminal states:

flowchart LR Sub["Submitted"] --> Work["Working"] Work --> InputReq["Input Required (Awaiting Documents)"] Work --> AuthReq["Auth Required (Awaiting Authorization)"] InputReq -->|"Caller Resumes Same taskId"| Work AuthReq -->|"Caller Completes Auth & Resumes"| Work Work --> Done["Completed (Terminal · Artifact Ready)"] Work --> Cancel["Canceled (Terminal)"] Work --> Reject["Rejected (Terminal)"] Work --> Fail["Failed (Terminal)"]

Two invariants keep cross-team workflows clean:

  • Resume in place on Input Required / Auth Required: When the compliance agent requests supporting documents or additional authorization, the caller continues the existing taskId rather than spawning a fresh task.
  • Terminal states are immutable: Once a Task reaches Completed, Canceled, Rejected, or Failed, it cannot be restarted. Follow-up iterations create a new Task referencing prior context for audit continuity (application-level idempotency requires separate caller-designed keys).

TypeScript Example: Minimal A2A v1.0.1 Agent Card Validator

A key breaking change in A2A v1 is replacing the legacy v0.3 top-level url with supportedInterfaces[], where each entry declares url, protocolBinding, and protocolVersion (see What’s New in v1). In production, prefer the official @a2a-js/sdk types; this minimal v1.0.1 projection validator checks every interface and skill entry strictly and enforces a discovery timeout (add an explicit branch only if you must support v0.3 cards):

export interface SupportedInterface {
  url: string;
  protocolBinding: string;
  protocolVersion: string;
}

export interface AgentSkill {
  id: string;
  name: string;
}

export interface AgentCardV1 {
  name: string;
  supportedInterfaces: SupportedInterface[];
  skills: AgentSkill[];
}

function isRecord(v: unknown): v is Record<string, unknown> {
  return typeof v === "object" && v !== null;
}

export function parseAgentCardV1(raw: unknown): AgentCardV1 {
  if (!isRecord(raw) || typeof raw.name !== "string") {
    throw new Error("Invalid A2A v1 Agent Card: missing name");
  }
  if (!Array.isArray(raw.supportedInterfaces) || raw.supportedInterfaces.length === 0) {
    throw new Error("Invalid A2A v1 Agent Card: missing supportedInterfaces");
  }
  if (!Array.isArray(raw.skills)) {
    throw new Error("Invalid A2A v1 Agent Card: missing skills array");
  }

  const supportedInterfaces: SupportedInterface[] = raw.supportedInterfaces.map((entry, i) => {
    if (
      !isRecord(entry) ||
      typeof entry.url !== "string" ||
      typeof entry.protocolBinding !== "string" ||
      typeof entry.protocolVersion !== "string"
    ) {
      throw new Error(`Invalid supportedInterfaces[${i}]`);
    }
    return {
      url: entry.url,
      protocolBinding: entry.protocolBinding,
      protocolVersion: entry.protocolVersion,
    };
  });

  const skills: AgentSkill[] = raw.skills.map((entry, i) => {
    if (!isRecord(entry) || typeof entry.id !== "string" || typeof entry.name !== "string") {
      throw new Error(`Invalid skills[${i}]`);
    }
    return { id: entry.id, name: entry.name };
  });

  return { name: raw.name, supportedInterfaces, skills };
}

export async function discoverAgentCardV1(
  baseUrl: string,
  timeoutMs = 5000,
): Promise<AgentCardV1> {
  const endpoint = new URL("/.well-known/agent-card.json", baseUrl);
  const res = await fetch(endpoint, {
    headers: { Accept: "application/json" },
    redirect: "error", // Block implicit cross-origin redirects to prevent SSRF bypasses
    signal: AbortSignal.timeout(timeoutMs),
  });

  if (!res.ok) {
    throw new Error(`Agent Card discovery failed (${res.status}): ${endpoint.toString()}`);
  }

  let raw: unknown;
  try {
    raw = await res.json();
  } catch {
    throw new Error("Agent Card discovery returned non-JSON payload");
  }
  return parseAgentCardV1(raw);
}

export function selectInterface(
  card: AgentCardV1,
  binding: string,
  versionPrefix = "1.",
): SupportedInterface | undefined {
  return card.supportedInterfaces.find(
    (iface) =>
      iface.protocolBinding === binding && iface.protocolVersion.startsWith(versionPrefix),
  );
}

Before attaching credentials to any url returned by selectInterface, verify both the discovery host and the declared target URL against a trusted domain allowlist.

When Not to Use A2A

  • Keep deterministic microservices on REST/gRPC or MCP: Order lookups, CRUD writes, and notifications gain nothing from a stateful Task protocol.
  • Centralize cross-team governance at the gateway: As MCP and A2A endpoints grow, enforce auth and telemetry at a shared gateway layer (see Agent Router for LLM and MCP Traffic).

References