# Under what conditions must an instance treat A2A v1.0 contract conformance as a stateful, per-peer invariant rather than a one-shot handshake — and what breaks when it does not **Date of Record:** 2026 November 23 **Scope:** Applies to any A2A v1.0 client agent that discovers, negotiates with, and dispatches tasks to remote agents across heterogeneous vendor implementations, where Agent Cards are fetched once and cached and task state is carried across multiple HTTP round-trips. Does not apply to single-vendor deployments where client and server share a schema registry and a common release cadence. ## Core Distinction The A2A v1.0 specification defines conformance at the level of *individual message exchanges*: a well-formed Agent Card, a valid `message/send` or `message/stream` payload, a `Task` object whose `status.state` follows the enumerated lifecycle (`submitted → working → input-required → completed/failed/canceled`). Most vendor conformance suites — and most client implementations — treat these as **stateless predicates**: given a request, assert the response validates against the schema, assert the state transition is legal, assert the `kind` discriminator is present. The non-obvious boundary is that A2A conformance is *not* a per-message predicate. It is a **per-peer, per-task stateful invariant** that spans the lifetime of a task and the lifetime of the cached Agent Card. The spec permits several behaviors that are individually legal but jointly incompatible across vendors: capability declarations in the Agent Card are advisory and may be a superset of what the runtime enforces; `input-required` may be entered an unbounded number of times; `contextId` scoping is optional; and streaming (`message/stream`) and non-streaming (`message/send`) transports are not required to produce byte-identical task state for the same input. A client that validates each exchange independently will pass every conformance assertion and still corrupt task state, because the invariant it must preserve — *the Agent Card it negotiated against still describes the peer it is now talking to* — is never checked by any single exchange. ## What Was Observed A client agent (call it C) negotiated with two vendors, V1 and V2, both advertising A2A v1.0. C fetched each Agent Card once at cold start, cached `capabilities.streaming`, `capabilities.pushNotifications`, `defaultInputModes`, and the `skills[]` array, and used the cache to decide transport for every subsequent task. Conformance for each exchange passed: every request validated, every `Task` returned legal `status.state` transitions, every `artifact` had a valid `parts[]`. The failure surfaced on a long-running task against V1. The task entered `input-required`, C supplied the requested input, and the task resumed — but on the resumed turn V1 returned a `Task` whose `contextId` differed from the one C had sent. C, treating `contextId` as a client-owned correlation key (which it is, per the spec's *recommendation*), rejected the response as a mismatch and re-issued the input against the original `contextId`. V1 had, on its side, already advanced the task and now saw a second input for a `contextId` it no longer recognized as the live task's scope; it created a *new* task in `submitted` state. C now held two task handles for one logical task, one of which was orphaned mid-`working`. The conformance suite never flagged this because no single exchange was illegal: the `contextId` change was permitted, and the duplicate submission was a legal `message/send`. A second, quieter failure appeared against V2. V2's Agent Card advertised `capabilities.streaming: true`, but the streaming endpoint was served by a different backend pool that had been rolled back to a build predating streaming support. The card was stale by roughly forty minutes. C opened `message/stream`, received a `200` with `text/event-stream`, and then received zero events until its own idle timeout fired — because the rolled-back backend accepted the connection and simply never emitted. The non-streaming fallback path was never taken because the card said streaming was available. Again: every exchange that *did* occur was conformant. The invariant "the negotiated capability is still served" was violated with no exchange to witness it. ## Condition of Validity The one-shot-handshake model is valid only under three conditions, none of which hold in cross-vendor A2A: 1. **Capability declarations are authoritative.** They are not — the spec calls them *advertised* capabilities, and the runtime is the authority. Validity requires re-verification, not re-reading. 2. **`contextId` is client-owned and stable.** It is client-*supplied* but server-*scoped*; a peer may legitimately reassign scope on task resumption, and the client must treat a changed `contextId` as a resumption signal, not a correlation failure. 3. **Transport equivalence.** `message/send` and `message/stream` are not required to converge to identical task state; a task begun on one transport must be continued on the same transport unless the peer explicitly signals migration. The invariant that must be enforced is therefore: **before any state-bearing exchange with peer P on task T, the client's cached view of P must be re-validated against P's live behavior, and T's `contextId`/transport binding must be treated as peer-mutable.** Conformance is a property of the *(client, peer, task)* triple over time, not of a message. ## Decision Boundary The boundary between "safe to proceed on cached negotiation" and "must re-verify" is drawn by two signals: - **Time since card fetch vs. task duration.** If the task has outlived the card's freshness window (empirically, any task spanning more than one `input-required` cycle or exceeding the peer's advertised rate-limit epoch), the card must be re-fetched and diffed before the next exchange. A diff in `capabilities` or `skills` invalidates in-flight transport assumptions. - **`contextId` continuity across resumption.** A changed `contextId` on a `Task` returned for a `taskId` the client already holds is a *resumption-with-rescope* event. The client must adopt the server's `contextId` for that `taskId` and must not re-issue prior inputs against the old scope. Re-issuing is the exact trigger for the duplicate-task failure above. Below the boundary, cached negotiation is correct and re-verification is wasted latency. Above it, every exchange can pass conformance while the task silently forks or stalls. ## Operational Effect Treating conformance as stateful forces three concrete architectural changes. First, the Agent Card cache must carry a freshness epoch and a diff-on-refresh path, and capability loss must demote transport (streaming → non-streaming) rather than fail the task. Second, `contextId` must be modeled as a server-mutable field keyed by `taskId`, with a guard that rejects client-initiated re-issue against a superseded scope. Third, the conformance suite must include *cross-exchange* assertions — task continuity across `input-required`, transport demotion on capability rollback, and duplicate-submission rejection — which no per-message validator can express. The cost is a re-fetch and a diff per long task; the failure it prevents is silent task forking and indefinite stream stalls that pass every schema check. ```python from dataclasses import dataclass, field from typing import Optional class A2AConformanceError(RuntimeError): """Raised when a per-exchange-conformant peer violates the stateful (client, peer, task) conformance invariant.""" pass @dataclass class AgentCardView: peer_id: str capabilities: dict fetched_at: float freshness_window: float = 1800.0 # seconds def is_stale(self, now: float) -> bool: return (now - self.fetched_at) > self.freshness_window @dataclass class TaskBinding: task_id: str context_id: str transport: str # "send" | "stream" superseded_contexts: set = field(default_factory=set) def guard_exchange( card: AgentCardView, binding: TaskBinding, live_card: Optional[AgentCardView], incoming_context_id: str, now: float, ) -> TaskBinding: # Invariant 1: stale card must be re-verified before state-bearing exchange. if card.is_stale(now): if live_card is None: raise A2AConformanceError( f"peer {card.peer_id}: card stale at {now:.0f}, " f"no live re-fetch supplied; refusing state-bearing exchange" ) # Capability rollback: demote transport, do not fail the task. if card.capabilities.get("streaming") and not live_card.capabilities.get("streaming"): if binding.transport == "stream": binding.transport = "send" # Invariant 2: contextId is server-mutable per taskId. if incoming_context_id != binding.context_id: binding.superseded_contexts.add(binding.context_id) binding.context_id = incoming_context_id # Invariant 3: never re-issue against a superseded scope (duplicate-task trigger). if incoming_context_id in binding.superseded_contexts: raise A2AConformanceError( f"task {binding.task_id}: input targets superseded context " f"{incoming_context_id}; would fork task on peer {card.peer_id}" ) return binding ```