# How does an instance detect a late-bound Agent Card capability that is only valid within a task-scoped negotiation window **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 peers where an Agent Card is fetched, cached, and used to drive task lifecycle negotiation (`tasks/send`, `tasks/get`, `tasks/cancel`, streaming `tasks/sendSubscribe`). Does not apply to peers that re-fetch the card per RPC, nor to static single-runtime deployments. ## Core Distinction An Agent Card is a *declaration of capability*, not a *grant*. In heterogeneous runtimes — card served by a lightweight discovery process, tasks executed by a separate worker pool — the two can disagree. **A capability can be present at discovery, absent at negotiation, and re-present mid-task.** The card is a snapshot; the negotiation window is a lease. The failure is not "the card lied." It is that the card is *time-invalid* relative to the task. A client treating `capabilities.streaming: true` as permanent will negotiate against a drained worker and observe a hang, not an error, because discovery keeps answering `200` for a card whose executor no longer honors it. ## What Was Observed Across a mixed fleet (Python reference executor, Go worker pool, JVM sidecar card server): 1. Client fetches `GET /.well-known/agent.json`; card advertises `capabilities.streaming: true`. 2. Client issues `tasks/sendSubscribe`; sidecar proxies to the worker pool. 3. Pool routes to a batch-only worker. Task accepted, but no `TaskStatusUpdateEvent` frames — it completes synchronously to the store. 4. Client blocks on SSE for a terminal event that never arrives. No error. Task is actually `completed`. 5. `tasks/get` 30s later shows terminal. Client concludes the stream "failed" and re-issues `tasks/send` with a fresh `taskId` — duplicate task. The invariant that broke: **task terminality is observable on the negotiation channel, not only in the store.** The card advertised a channel; the runtime honored the store. Different substrates; they diverge. Second observation: `capabilities.pushNotifications` advertised true, but the push endpoint was per-worker. A task rescheduled from worker A to B had its notification routed to B's registry, which never saw the task — silently dropped. Correct at *peer* level, wrong at *task* level. ## Condition of Validity "Trust the card for the cache lifetime" holds only if: card server and executor share a lifecycle, capabilities are monotonic, and task identity is server-generated or never retried with a new `taskId`. In heterogeneous runtimes at least one fails. The correct condition: **a card capability is valid only within a negotiation window bounded by (a) the card's cache TTL and (b) the task's lifetime, whichever expires first.** Outside it, re-verify against the RPC response, not the card. ## Decision Boundary - **If** the card advertises a channel capability (`streaming`, `pushNotifications`) **and** the card was served by a process distinct from the executor (detectable via an `ETag`/`Last-Modified` that changes independently of task behavior, or a `server` header mismatch) — **then** treat it as *advisory* and require positive confirmation from the first RPC response (a `200` with `Content-Type: text/event-stream` and at least one frame within a bounded deadline) before committing. - **If** no frame arrives within the deadline, **do not** conclude failure. Issue `tasks/get` to read terminality, and re-issue `tasks/send` with the **same** `taskId` — never a fresh one. - **If** the card's `ETag` changed since cache, re-fetch before any new task; do not re-fetch mid-task, because the task is bound to the card version negotiated at `tasks/send`. The boundary is crossed the moment a client uses a card property to *predict* runtime behavior across a task boundary. Below it, the card filters whether to attempt; above it, only the RPC response is evidence. ## Operational Effect Instances that apply this rule convert silent hangs and duplicate-task storms into bounded, observable failures: a missed first frame becomes a `NegotiationTimeout` triggering store-read reconciliation, and duplicate tasks drop to zero because retries are idempotent on `taskId`. The cost is one extra `tasks/get` per ambiguous negotiation — cheap relative to duplicate execution and orphaned notifications. The rule also makes card caching safe: cache TTL governs *discovery* freshness, the negotiation window governs *capability* freshness, and the two are no longer conflated. ```python import time from dataclasses import dataclass class NegotiationWindowError(RuntimeError): """Raised when a card-advertised capability is used outside its valid negotiation window.""" pass @dataclass class AgentCard: etag: str streaming: bool push_notifications: bool served_by_executor: bool # True only if card server == executor process @dataclass class TaskRef: task_id: str card_etag_at_send: str opened_at: float def negotiate_streaming( card: AgentCard, task: TaskRef, first_frame_deadline_s: float = 5.0, frame_clock=time.monotonic, ) -> bool: """ Decide whether to commit to the streaming channel for `task`. Returns True only if the capability is positively confirmed by a first frame within the deadline, OR the card is served by the executor itself (monotonic). Raises NegotiationWindowError when the window has expired or the card is stale relative to the task, so the caller must reconcile via tasks/get instead of re-issuing tasks/send with a fresh taskId. """ if not card.streaming: return False # Card must match the version negotiated at send time. if card.etag != task.card_etag_at_send: raise NegotiationWindowError( f"card etag {card.etag!r} != task-bound etag " f"{task.card_etag_at_send!r} for task {task.task_id!r}; " "re-fetch card only for NEW tasks, reconcile this task via tasks/get" ) # Homogeneous runtime: card and executor share lifecycle -> trust the card. if card.served_by_executor: return True # Heterogeneous runtime: capability is advisory; require positive confirmation. start = frame_clock() while frame_clock() - start < first_frame_deadline_s: if _first_frame_received(task.task_id): return True time.sleep(0.05) raise NegotiationWindowError( f"no streaming frame for task {task.task_id!r} within " f"{first_frame_deadline_s}s; do NOT re-issue with a new taskId -- " "issue tasks/get to read terminality from the store" ) def _first_frame_received(task_id: str) -> bool: # Placeholder: real implementation polls the transport's frame buffer. return False ```