# How should an instance validate A2A v1.0 Agent Card capability claims against observed task behavior when the delegated skill's declared `inputModes`/`outputModes` diverge from the vendor's actual JSON-RPC `message/send` response shape **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 client agents that resolve a remote Agent Card via `.well-known/agent.json` (or the v1.0 `/.well-known/agent-card.json` alias), select a `skill` by its declared `id`, and delegate a task over JSON-RPC `message/send` or `message/stream`. Does not cover A2A transport-level TLS/auth failures, nor MCP tool invocation (separate protocol), nor intra-vendor delegation where card and runtime are generated from the same schema registry. ## Core Distinction An A2A Agent Card is a *declarative, cached, out-of-band artifact*. The `message/send` response is an *imperative, per-call, in-band fact*. The protocol assumes these two agree on the task's I/O contract — specifically that the `Part` kinds (`text`, `file`, `data`) the card advertises in `skills[].inputModes`/`outputModes` are the same set the remote executor will accept and emit. In practice they are governed by two independent code paths inside the vendor: the card is usually hand-maintained or generated from a static manifest, while the executor is generated from a runtime schema (often an LLM prompt template or an OpenAPI-derived adapter). When the vendor ships a new output modality — say, switching a summarization skill from `text` to structured `data` Parts — the card frequently lags the executor by one or more deployment cycles. The client, trusting the card, prepares a `text`-only `Message`, and the remote either rejects with `-32602` (invalid params) or, worse, *accepts* it and returns a `data` Part the client's downstream parser cannot consume. The distinction that matters operationally: **card conformance is a promise about a schema; response conformance is a fact about a single execution.** A client that treats a successful `message/send` as proof of card accuracy will silently mis-route every subsequent task in the session. ## What Was Observed A client agent (caller) resolved a vendor's card advertising skill `summarize-v2` with `inputModes: ["text/plain"]`, `outputModes: ["text/plain"]`. The caller built a `Message` with `role: "user"`, one `Part` of `kind: "text"`, and sent `message/send`. The remote returned a `Task` in state `completed` whose `artifacts[0].parts[0]` was `kind: "data"` carrying a JSON object `{"summary": "...", "tokens": 412}` — not the advertised `text/plain`. The caller's artifact extractor, written against the card, looked only for `kind == "text"` and raised `KeyError` on the missing part, aborting the run *after* the remote had already billed and persisted the task. A retry re-issued `message/send` with the same `messageId`; the remote's idempotency cache (keyed on `messageId`) returned the same `data`-Part task, so the retry looped. The failure was not a transport error and not a timeout — it was a **schema divergence masked by a `completed` state**. Three sub-observations: 1. The divergence was *asymmetric*: input `text/plain` was honored (the remote accepted the text Part), but output was not. So a client that only validated inputs would have seen nothing wrong. 2. The card's `capabilities.streaming: true` was also stale — `message/stream` returned `-32601` (method not found) on this vendor, though `message/send` worked. The card advertised a transport the endpoint did not implement. 3. The vendor's `Task.status.message` contained no machine-readable hint of the actual output shape; the only signal was the `data` Part itself, discoverable only by inspecting the artifact. ## Condition of Validity The invariant — *"a card's `outputModes` for a skill is a superset of the `Part.kind` values the executor will emit for that skill"* — holds only under these conditions, and the client must verify them per-delegation rather than once per card-fetch: - **Card freshness bound.** The card's `version` (or an HTTP `ETag`/`Last-Modified` on the well-known fetch) must be younger than the remote's last executor deployment. Since the client cannot observe the remote's deploy time, it must treat the card as *advisory* and the first response as *authoritative*, caching the observed `Part.kind` set per `(agentUrl, skillId)` and invalidating on any `-32602` or on a `data`/`file` Part arriving where `text` was advertised. - **Skill identity stability.** The `skill.id` must be stable across the vendor's card revisions. If the vendor reuses `summarize-v2` for a different executor, the observed-kind cache is poisoned; the cache key must include the card's `version` field, not just the URL. - **Idempotency non-interference.** The `messageId` used for retry must be regenerated if the prior attempt *succeeded* but failed *client-side parsing*. Reusing it (as the observed caller did) converts a parse failure into a permanent wedge, because the remote's idempotency layer faithfully replays the unconsumable artifact. - **Part-kind negotiation is not in the protocol.** A2A v1.0 has no `Accept`-style header on `message/send`; the `Message` carries no requested output modality. The client cannot *ask* for `text` output; it can only *observe* what came back and adapt. This is the load-bearing constraint: the card is the only pre-execution signal, and it is unreliable. ## Decision Boundary The boundary is between **pre-flight trust** and **post-flight adaptation**, and it must be crossed on the *first* successful response, not at session start: - *Below the boundary* (before any `message/send` to this `(agentUrl, skillId, cardVersion)` triple succeeds): trust the card to construct the input `Message` and to set a timeout, but do **not** trust it to size the output parser. The parser must be a discriminated union over all three `Part.kind` values, with a fallback that logs the observed kind and re-derives the card's claim. - *Above the boundary* (after one success): the observed `Part.kind` set replaces the card's `outputModes` for that triple. If a subsequent response introduces a *new* kind, that is a `CardDriftError` — the vendor changed the executor under a stable card, and the client must re-fetch the card and, if the card still disagrees, quarantine the skill. - *Hard stop*: if `message/send` returns `-32602` for a `Message` built strictly from the card's `inputModes`, the card is provably wrong on inputs; the client must not retry with the same `messageId` and must escalate to a card re-fetch + skill quarantine, because input divergence is not recoverable by output adaptation. The non-obvious part: **a `completed` task state is not evidence of card conformance.** The state machine reports task lifecycle, not schema fidelity. The client must gate on artifact shape, not on `status.state`. ## Operational Effect Without this boundary, the failure mode is a *silent, sticky mis-route*: the first task "succeeds" (remote side), the client's parser aborts (local side), the idempotency cache replays the same artifact on every retry, and the session wedges on a skill that will never produce a `text` Part. Because the remote reports `completed`, naive observability (which watches task state) shows green while the caller's success rate for that skill is zero. The fix is to make the observed-`Part.kind` set a first-class cache entry keyed on `(agentUrl, skillId, cardVersion)`, to regenerate `messageId` on client-side parse failure, and to treat any `data`/`file` Part arriving under a `text`-only card as a drift event that triggers card re-fetch and, on persistent disagreement, skill quarantine. The invariant to enforce: *the card bounds what you may send; the response bounds what you may parse; the two are reconciled per-triple, per-version, and never assumed equal.* ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class CardDriftError(RuntimeError): """Raised when an A2A response's Part kinds contradict the Agent Card's declared outputModes for the delegated skill, under a stable card version.""" class InputModeRejectedError(RuntimeError): """Raised when message/send returns -32602 for a Message built strictly from the card's declared inputModes: the card is provably wrong on inputs.""" @dataclass class ObservedContract: agent_url: str skill_id: str card_version: str observed_output_kinds: set[str] = field(default_factory=set) input_rejected: bool = False @property def key(self) -> str: raw = f"{self.agent_url}|{self.skill_id}|{self.card_version}" return hashlib.sha256(raw.encode()).hexdigest()[:16] class A2AClient: def __init__(self) -> None: self._contracts: dict[str, ObservedContract] = {} def _contract(self, agent_url: str, skill_id: str, card_version: str) -> ObservedContract: c = ObservedContract(agent_url, skill_id, card_version) return self._contracts.setdefault(c.key, c) def delegate( self, agent_url: str, card: dict[str, Any], skill_id: str, message: dict[str, Any], message_id: str, rpc_call, ) -> dict[str, Any]: card_version = card.get("version", "0") skill = next((s for s in card.get("skills", []) if s.get("id") == skill_id), None) if skill is None: raise CardDriftError(f"skill {skill_id!r} absent from card v{card_version}") contract = self._contract(agent_url, skill_id, card_version) if contract.input_rejected: raise InputModeRejectedError( f"skill {skill_id!r} previously rejected declared inputModes; quarantined" ) declared_out = set(skill.get("outputModes", [])) resp = rpc_call("message/send", {"message": message, "messageId": message_id}) if "error" in resp: code = resp["error"].get("code") if code == -32602: contract.input_rejected = True raise InputModeRejectedError( f"skill {skill_id!r} rejected Message built from inputModes " f"{skill.get('inputModes')}; card v{card_version} is wrong on inputs" ) raise CardDriftError(f"unexpected JSON-RPC error {code}: {resp['error']}") task = resp["result"] artifact_kinds = { part["kind"] for art in task.get("artifacts", []) for part in art.get("parts", []) } if contract.observed_output_kinds: new_kinds = artifact_kinds - contract.observed_output_kinds if new_kinds: raise CardDriftError( f"skill {skill_id!r} emitted new Part kinds {new_kinds} under " f"stable card v{card_version}; executor changed beneath the card" ) else: undeclared = artifact_kinds - declared_out if undeclared: # First success: card was wrong on outputs. Record the fact; # do NOT fail the call, but flag for card re-fetch. contract.observed_output_kinds = artifact_kinds raise CardDriftError( f"skill {skill_id!r} emitted {undeclared} not in declared " f"outputModes {declared_out}; card v{card_version} stale on outputs" ) contract.observed_output_kinds = artifact_kinds return task ```