# Which invariants prevent Agent Card discovery from silently degrading task-lifecycle negotiation in A2A v1.0 **Date of Record:** 2026 November 29 **Scope:** Applies to A2A v1.0 client agents that resolve a remote peer's Agent Card, then negotiate `message/send` and `tasks/get` against the advertised capabilities and skills. Does not apply to single-process in-memory tool dispatch or to MCP (which has no cross-agent task lifecycle). ## Core Distinction The failure is not "the Agent Card was unreachable." It is that the Agent Card was *reachable, schema-valid, and semantically stale or partial* — so discovery succeeded while the negotiated task lifecycle silently diverged from what the caller assumed. A2A separates two contracts that share one document: (a) the **capability contract** (transports, streaming, push notifications, `defaultInputModes`/`defaultOutputModes`) and (b) the **skill contract** (per-skill `id`, `inputModes`, `outputModes`, `examples`). The Agent Card is a *snapshot*, and A2A v1.0 does not mandate that the snapshot be atomically consistent with the task endpoints served behind it. The invariant that breaks is **card-to-endpoint monotonicity**: every capability the caller *acts on* from the card must still be honored by the task endpoint at negotiation time, or the peer must fail closed with an explicit rejection rather than degrade. The non-obvious part: degradation is *legal* under the spec. A peer may accept a `message/send` whose `acceptedOutputModes` the card advertised but the running task cannot produce, and then return a `Task` in state `completed` carrying artifacts in a mode the caller never asked for. The caller's negotiation logic — which trusted the card — has no signal that the contract shifted. Nothing errored. The task "succeeded." ## What Was Observed A client agent resolved a peer card advertising `capabilities.streaming: true` and a skill with `outputModes: ["application/json"]`. It dispatched a `message/send` (non-streaming, since it only needed the terminal task) with `configuration.acceptedOutputModes: ["application/json"]`. The peer was mid-rollout: streaming had been disabled on the worker fleet, and the skill's runtime had fallen back to `text/plain` because its structured-output model was quarantined. The card cache on the client was 14 minutes old (TTL 15m). Trace: 1. `GET /.well-known/agent.json` → 200, `ETag: "v7"`, `Cache-Control: max-age=900`. Card cached. 2. Worker fleet rolls back; card is *not* re-published (the card is served by a control-plane replica that was not part of the rollback). Card and endpoint now disagree. 3. Client sends `message/send` with `acceptedOutputModes: ["application/json"]`. 4. Peer's task handler does not validate `acceptedOutputModes` against its *current* runtime — it validates against the card it *believes* it is serving. Validation passes. 5. Task runs, produces `text/plain` artifact, transitions to `completed`. 6. Client's `tasks/get` returns `status.state: "completed"` with an artifact whose `parts[].kind` is `text`, not the structured payload the downstream parser expected. 7. Downstream parser raises on missing JSON; the client records a *task success* with a *parse failure* — a split-brain outcome where the lifecycle says done and the consumer says broken. The observed amplifier: because the task reached `completed`, the client's retry/idempotency layer did **not** re-dispatch, and no dead-letter was written. The divergence was invisible in task-level metrics (100% completion) and only surfaced as a downstream parse-error spike 40 seconds later, uncorrelated by trace ID because the artifact was consumed by a different service. ## Condition of Validity The invariant "card capabilities are honored at negotiation" holds only when *all* of the following are true; violation of any one is the trigger condition: - The card's `ETag`/`version` is bumped on **every** change to served capabilities or skill output modes, and the control plane serving the card is in the same deploy unit as the task workers. If the card is served from a replica outside the rollout, monotonicity is unenforced. - `message/send` **re-validates** `configuration.acceptedOutputModes` against the live runtime, not against the card it emits. Card emission and request validation must read the same source of truth. - The client treats a returned artifact mode outside `acceptedOutputModes` as a **protocol violation**, not a success. A2A v1.0 permits the peer to omit the requested mode; it does not permit the client to accept the substitution silently. - Card TTL is shorter than the maximum acceptable divergence window, *or* the client revalidates with a conditional `GET` (`If-None-Match`) immediately before dispatch when the task is high-stakes. When the peer cannot honor an advertised capability, the only spec-conformant safe behavior is to **fail the task** (state `failed` with an explicit `UnsupportedModeError`-class message) or reject at submission. Silent substitution is the failure. ## Decision Boundary The boundary is whether the client **trusts the card as a promise** or **treats the card as a hint that must be re-verified at the point of effect**. Concretely: - If the task is idempotent, cheap, and the artifact is human-consumed → card-as-hint is acceptable; accept substitution, log the mode mismatch as a warning, let a human reconcile. - If the artifact feeds an automated parser, a downstream agent, or a persisted schema → card-as-promise is mandatory: revalidate `acceptedOutputModes` via conditional GET or a capability probe, and **reject any completed task whose artifact modes fall outside the accepted set** before it enters the pipeline. - If the peer advertises `capabilities.pushNotifications: true` but the webhook is not registered/acked → treat as unavailable; do not rely on push for lifecycle transitions, poll `tasks/get`. The invariant to enforce: **a task that completes with an out-of-contract artifact mode is a failed task, regardless of `status.state`.** The lifecycle state and the artifact contract are two separate acceptance gates; both must pass. ## Operational Effect Without the guardrail, the failure mode is *silent contract drift*: task-level success metrics stay green, downstream parse errors spike uncorrelated, and retries never fire because the lifecycle reported `completed`. The blast radius scales with card TTL and rollout skew — a 15-minute TTL against a 20-minute rolling deploy guarantees a window of divergence on every deploy. With the guardrail (fail-closed on out-of-contract artifact modes + conditional revalidation before high-stakes dispatch), the same rollout produces explicit `failed` tasks at the boundary, which are retryable and visible. The cost is a small increase in rejection rate during rollouts; the benefit is that divergence is bounded to the revalidation window rather than the TTL window, and every divergence carries a trace ID that links the lifecycle outcome to the consumer failure. ```python from dataclasses import dataclass, field from typing import Optional class AgentCardContractViolation(RuntimeError): """Raised when a completed A2A task violates the capability contract the caller negotiated against the peer's Agent Card.""" @dataclass class AgentCard: etag: str ttl_seconds: int streaming: bool skill_output_modes: dict[str, list[str]] # skill_id -> modes fetched_at: float @dataclass class TaskResult: task_id: str state: str # "completed" | "failed" | ... skill_id: str artifact_modes: list[str] # modes actually produced trace_id: str def negotiate_and_accept( card: AgentCard, result: TaskResult, accepted_output_modes: list[str], now: float, high_stakes: bool, revalidate_fn, # () -> AgentCard | None (conditional GET) ) -> TaskResult: # Invariant 1: high-stakes dispatch must not act on a stale card. if high_stakes: fresh = revalidate_fn() if fresh is None or fresh.etag != card.etag: raise AgentCardContractViolation( f"card changed or expired mid-dispatch: cached={card.etag} " f"fresh={getattr(fresh, 'etag', None)} trace={result.trace_id}" ) card = fresh # Invariant 2: card must not be past TTL when its promises are relied upon. if now - card.fetched_at > card.ttl_seconds: raise AgentCardContractViolation( f"card past TTL ({now - card.fetched_at:.0f}s > {card.ttl_seconds}s) " f"trace={result.trace_id}" ) # Invariant 3: a 'completed' task whose artifact modes fall outside the # accepted set is a protocol violation, not a success. if result.state == "completed": produced = set(result.artifact_modes) accepted = set(accepted_output_modes) if not produced <= accepted: raise AgentCardContractViolation( f"task {result.task_id} completed with out-of-contract modes " f"{sorted(produced - accepted)}; accepted={sorted(accepted)} " f"trace={result.trace_id}" ) # Invariant 4: skill-level output modes must cover what was produced. skill_modes = set(card.skill_output_modes.get(result.skill_id, [])) if result.state == "completed" and not set(result.artifact_modes) <= skill_modes: raise AgentCardContractViolation( f"skill {result.skill_id} produced modes outside card declaration: " f"{sorted(set(result.artifact_modes) - skill_modes)} trace={result.trace_id}" ) return result ```