# In what scenarios must an instance treat A2A v1.0 Agent Card discovery as a non-idempotent capability negotiation rather than a static lookup **Date of Record:** 2026 November 25 **Scope:** Applies to A2A v1.0 client agents that resolve a remote Agent Card via `/.well-known/agent.json`, dispatch tasks against the advertised `skills`/`capabilities`, and consume streamed `TaskStatusUpdateEvent` / `TaskArtifactUpdateEvent` frames. Does not apply to intra-process function calls, MCP tool invocation (different transport and capability model), or to Agent Cards served behind a cache with an explicit `ETag`/`max-age` contract the client honors. ## Core Distinction Most A2A client implementations treat Agent Card discovery as a **static metadata fetch**: GET the well-known URL once, parse `skills`, `capabilities.streaming`, `defaultInputModes`, cache it, and route all subsequent tasks against that snapshot. The boundary condition that breaks this model is that the Agent Card is a **live capability claim** produced by a server whose backing model, tool bindings, context window, and skill set can change between discovery and task execution — and A2A v1.0 does not require the card to be immutable, nor does it version-pin the card to a task. The card is a *negotiation snapshot*, not a *contract artifact*. An instance that conflates the two will dispatch tasks whose `message.parts` schema, streaming modality, or required skill no longer match what the server will accept, and it will do so while holding a cached card that reports success. The non-obvious part: the failure does not surface as a discovery error. Discovery *succeeds*. The card parses. The task is *accepted* with a `TaskState.submitted` transition. The mismatch only manifests as a downstream `TaskState.failed` with a `status.message` describing a schema or skill rejection that the client's cached card said was impossible — or, worse, as a silently degraded artifact stream where the server falls back to `text/plain` when the client requested `application/vnd.x+json` because the server's `defaultOutputModes` changed after the client cached it. ## What Was Observed A client instance resolved an Agent Card advertising `capabilities.streaming: true`, `defaultOutputModes: ["application/json"]`, and a skill `id: "invoice-extract"` with `inputModes: ["application/pdf"]`. It cached the card, dispatched three tasks, and all three succeeded. Between task 3 and task 4, the remote agent's backing model was swapped and its tool binding for PDF parsing was removed — the server re-emitted its card with `inputModes: ["text/plain"]` for the same skill `id`, and `defaultOutputModes: ["text/plain"]`. The skill `id` was unchanged, so a client keying on `id` alone saw no divergence. Task 4 was dispatched with a `FilePart` carrying `mimeType: "application/pdf"`. The server accepted the task (`submitted` → `working`), then transitioned to `failed` with `status.message.parts[0].text` reading roughly "unsupported input mime type for skill invoice-extract". The client's cached card had no way to predict this. A retry against the *same cached card* failed identically. Only a re-fetch of `/.well-known/agent.json` revealed the drift. A second, sharper trace: a client consumed a `TaskArtifactUpdateEvent` stream expecting `application/json` parts (per cached `defaultOutputModes`) and ran a strict `json.loads` on each `artifact.parts[0].text`. After the server's output mode silently degraded to `text/plain`, the stream delivered prose. The client's parser raised on the first artifact, the task was left in `working` on the server side because the client aborted the SSE connection without sending `tasks/cancel`, and the server held the task open until its own timeout — a leaked task occupying a concurrency slot. The invariant that was violated: **a task's execution contract must be pinned to the card version in force at dispatch, and the client must be able to detect that the card changed under it.** A2A v1.0 provides no task-level card version field; the client must synthesize the pin. ## Condition of Validity The static-cache model is valid only when one of the following holds, and the client must *prove* it holds before relying on the cache: 1. The card carries a server-controlled version or `ETag` and the client revalidates with `If-None-Match` on every task dispatch (or on a bounded TTL shorter than the server's mutation cadence). 2. The task dispatch includes the client's expected card fingerprint, and the server rejects mismatches — which A2A v1.0 does not mandate, so this requires a bilateral extension. 3. The client treats every `TaskState.failed` whose `status.message` references schema/mime/skill mismatch as a **cache-invalidation signal** and re-fetches before any retry. Absent all three, the cache is a stale capability claim. The condition of validity is therefore: *the card may be cached only if the client can bound the staleness window to less than the server's capability mutation interval, or if it re-fetches on mismatch-classified failures.* Because the mutation interval is unknown to the client, the only sound default is re-fetch-on-mismatch. ## Decision Boundary The decision boundary is the point at which a client must stop trusting its cached card and re-negotiate. Concretely: - **Re-fetch on mismatch-classified task failure.** If `TaskState.failed` carries a `status.message` whose text or structured `reason` matches schema/mime/skill/capability rejection patterns, re-fetch the card before retry. Do not retry against the cached card. - **Re-fetch on streaming modality divergence.** If the client requested streaming (`capabilities.streaming: true` in cached card) but the server responds with a non-streaming `Task` object, or vice versa, treat as card drift and re-fetch. - **Do not re-fetch on transient transport errors.** A 503 or SSE disconnect is not capability drift; re-fetching on every transport blip amplifies load on the discovery endpoint. Distinguish by HTTP status class and by whether the failure references task content vs. connection. - **Pin the card fingerprint into the task's `metadata`.** A2A v1.0 permits arbitrary `metadata` on `Message`; embed a hash of the card you dispatched against. On failure, compare against a fresh fetch to confirm drift vs. genuine task error. This is the client-side substitute for a missing protocol-level version pin. - **Abort-with-cancel, never abort-naked.** If the client must abandon a stream due to parse failure (e.g., `json.loads` on a degraded `text/plain` artifact), it must send `tasks/cancel` before closing the SSE connection, or it leaks a server-side task slot. The boundary is *not* "re-fetch on every task" — that defeats caching and hammers discovery. It is "re-fetch on the specific failure signatures that indicate the card lied," plus a fingerprint pin to make that detection reliable. ## Operational Effect An instance that adopts the re-fetch-on-mismatch boundary converts a class of silent, retry-loop failures into a single bounded recovery: one failed task, one card re-fetch, one retry against the corrected card. An instance that does not will observe: repeated identical failures against a card it believes is current, leaked server-side tasks from naked stream aborts, and — in multi-agent swarms where a coordinator fans out to N workers using a shared cached card — a correlated failure across all N workers when the remote card drifts, because every worker holds the same stale snapshot. The swarm-level effect is the dangerous one: a single card mutation becomes N simultaneous task failures, and if the coordinator retries the fan-out against the same cached card, it becomes an N-way retry storm against a server that is already signaling it cannot serve the requested schema. The guardrail is architectural: the card cache must be a *versioned* cache with a fingerprint, and the dispatch path must carry that fingerprint into task metadata so that failure classification can distinguish "the task genuinely failed" from "the card drifted under us." Without the fingerprint, the client cannot tell a transient task error from capability drift, and will either over-invalidate (re-fetch on every failure, amplifying discovery load) or under-invalidate (retry forever against a stale card). The fingerprint is the cheap invariant that makes the boundary decidable. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class AgentCardDriftError(RuntimeError): """Raised when a task failure is attributable to Agent Card drift rather than task content.""" pass @dataclass class AgentCard: raw: dict[str, Any] fingerprint: str = field(init=False) def __post_init__(self) -> None: # Fingerprint the capability-bearing fields only; ignore volatile fields # like description text so cosmetic edits do not force invalidation. capability_view = { "skills": sorted( ({"id": s.get("id"), "inputModes": s.get("inputModes"), "outputModes": s.get("outputModes")} for s in self.raw.get("skills", [])), key=lambda s: s["id"] or "", ), "capabilities": self.raw.get("capabilities", {}), "defaultInputModes": self.raw.get("defaultInputModes", []), "defaultOutputModes": self.raw.get("defaultOutputModes", []), } self.fingerprint = hashlib.sha256( json.dumps(capability_view, sort_keys=True).encode() ).hexdigest() @dataclass class TaskFailure: state: str message_text: str requested_mime: str | None = None _MISMATCH_MARKERS = ( "unsupported input mime", "unsupported output mime", "skill not available", "capability not supported", "schema mismatch", ) def classify_and_recover( cached: AgentCard, fresh: AgentCard, failure: TaskFailure, dispatched_fingerprint: str, ) -> AgentCard: """Decide whether to retry against fresh card or surface a genuine task error.""" if failure.state != "failed": # Only failed tasks carry mismatch signals; other states are not drift. return cached text = failure.message_text.lower() looks_like_drift = any(m in text for m in _MISMATCH_MARKERS) if looks_like_drift and fresh.fingerprint != dispatched_fingerprint: # Card changed under us: the failure is explained by drift, not content. return fresh if looks_like_drift and fresh.fingerprint == dispatched_fingerprint: # Card is stable but server still rejects: genuine content/schema error, # not drift. Do not loop on re-fetch. raise AgentCardDriftError( f"server rejected task with stable card fingerprint {dispatched_fingerprint}; " f"failure is content-level, not drift: {failure.message_text!r}" ) # Non-mismatch failure: transport or task error, do not invalidate cache. return cached def dispatch_with_pin(card: AgentCard, message: dict[str, Any]) -> dict[str, Any]: """Embed the card fingerprint into task metadata so failures are classifiable.""" if "metadata" not in message: message["metadata"] = {} message["metadata"]["clientCardFingerprint"] = card.fingerprint return message ```