# When must an instance refuse a delegated task mid-lifecycle: The A2A v1.0 card-staleness invariant at handshake boundaries **Date of Record:** 2026 November 15 **Scope:** Applies to A2A v1.0 (and v0.3-compatible) agents that accept cross-vendor delegated tasks after resolving a remote Agent Card, and to orchestrators that cache cards across a task lifecycle. Does not apply to single-vendor intra-process delegation where the card and the executor share a trust domain, nor to stateless request/response calls that never enter `task` state. ## Core Distinction The distinction that matters is between *card resolution* (a discovery-time fact about what an agent claims it can do) and *task negotiation* (a lifecycle-time fact about what an agent will actually do for *this* task under *this* delegation chain). A2A v1.0 lets these two facts drift apart silently. The Agent Card is a signed, cacheable advertisement; the `tasks/send` negotiation is a live, mutable handshake. Operators routinely treat a successfully resolved card as authorization to delegate, and treat a `submitted → working → completed` transition as proof the delegation was honored. Neither is true at the boundary. The non-obvious invariant: **a remote agent may legitimately accept a task, transition it to `working`, and then be required to reject it — because the card that justified the delegation has been superseded, or because the delegation chain crosses a vendor boundary whose capability set is narrower than the card advertised.** The lifecycle state machine and the discovery layer are not coupled by the protocol. They must be coupled by the *implementer*. ## What Was Observed During a multi-vendor orchestration pilot, an orchestrator resolved Agent Cards at t=0, cached them for a 30-minute TTL, and dispatched tasks to a planner agent. The planner's card advertised `capabilities.streaming: true` and a skill set including `code.execute.sandboxed`. At t=+19 minutes the vendor rotated the planner's card: the sandboxed-execution skill was withdrawn (the sandbox pool was drained for maintenance), but the card's `version` field was bumped only in the patch segment (`1.4.2 → 1.4.3`), and the orchestrator's cache key was `(agent_id, major.minor)` — so the cache did not invalidate. The orchestrator delegated a task requiring sandboxed execution. The planner accepted it (`submitted`), moved it to `working` (its task handler validated the *task payload*, not its own *current capability set*), and only failed at execution time with a vendor-specific error code that did not map to any A2A `TaskState`. The orchestrator, seeing `working` and no terminal state, retried on the same agent three times, then escalated. Total wall-clock loss: 11 minutes per affected task, across 40 tasks. The second, subtler observation: when the orchestrator *did* re-resolve the card mid-task (a manual intervention), the planner returned a card whose `skills` array no longer contained the required skill, yet the in-flight task remained in `working`. **The protocol does not specify what a `working` task means when the underlying card no longer supports it.** The planner was not violating the spec; it was violating an invariant the spec leaves to the implementer. ## Condition of Validity The refusal-at-handshake rule is valid only when all of the following hold: 1. The delegation crosses a vendor or trust boundary (the caller and callee do not share a card-signing key or a configuration authority). 2. The task's required capability set is drawn from the card's `skills` or `capabilities` fields, not from out-of-band agreement. 3. The card is cacheable (i.e., the caller did not resolve it in the same request that dispatched the task). 4. The task has not yet reached a terminal state (`completed`, `failed`, `canceled`). If (3) is false — the caller resolves the card in the same round-trip as the negotiation — the staleness window collapses to network latency and the rule is unnecessary (though harmless). If (4) is false, the task is already terminal and refusal is a no-op that corrupts the audit trail. The rule does **not** apply when the callee is the authority on its own capabilities and the caller is merely a router: in that topology the callee must accept-then-fail, because the caller has no basis to refuse on the callee's behalf. ## Decision Boundary The boundary is a single predicate evaluated at the `submitted → working` transition, on the **callee** side, and again at the `working → completed` transition on the **caller** side: - **Callee predicate:** *Does my current, live capability set (not the card I last published) cover every skill and capability the task requires?* If no, the callee must transition the task to `failed` with a structured `TaskStatus.message` naming the missing capability, and must **not** enter `working`. Entering `working` and failing later is the exact failure mode observed above. - **Caller predicate:** *Has the callee's card been superseded since I resolved it, and does the superseding card still cover the task?* If the card was superseded and no longer covers the task, the caller must cancel the task (`tasks/cancel`) rather than wait for a `working` task to time out. The boundary is *not* "card version changed." Patch-level version bumps that do not alter the `skills`/`capabilities` arrays are not boundary crossings. The boundary is **capability-set divergence**, which is a set-difference operation, not a version comparison. Comparing versions is the common mistake; comparing capability sets is the correct one. A second boundary: the delegation handshake must carry the *card digest* the caller resolved (e.g., a `cardHash` in the task metadata). Without it, the callee cannot detect that the caller is operating on a stale card, and the caller cannot prove which card justified the delegation. The digest is the only linkage between discovery and lifecycle. ## Operational Effect Implementing the refusal-at-handshake rule converts a silent, retry-amplifying failure (11 minutes/task, 40 tasks) into an immediate, structured rejection at the `submitted` boundary (sub-second). It also makes the audit trail honest: a `failed` task with a named missing capability is diagnosable; a `working` task that never terminates is not. The cost is a small increase in `failed` task counts during card rotation windows, which is correct behavior — those tasks *should* fail fast. The secondary cost is that callees must maintain a live capability view distinct from their published card, which is a real engineering burden but a necessary one: the card is a cache, and caches lie. ```python import hashlib from dataclasses import dataclass, field from typing import FrozenSet class CardStalenessError(RuntimeError): """Raised when a delegated task's required capabilities are not covered by the callee's live capability set at the submitted->working boundary.""" @dataclass(frozen=True) class AgentCard: agent_id: str version: str skills: FrozenSet[str] capabilities: FrozenSet[str] def digest(self) -> str: payload = f"{self.agent_id}|{self.version}|{sorted(self.skills)}|{sorted(self.capabilities)}" return hashlib.sha256(payload.encode()).hexdigest() @dataclass class DelegatedTask: task_id: str required_skills: FrozenSet[str] required_capabilities: FrozenSet[str] resolved_card_digest: str state: str = "submitted" def accept_delegation(task: DelegatedTask, live_card: AgentCard) -> DelegatedTask: """Callee-side gate: must run before any submitted->working transition. Refuses if the live capability set does not cover the task, OR if the caller resolved a card whose digest differs from the live card's digest AND the live card no longer covers the task (capability-set divergence, not mere version change). """ missing_skills = task.required_skills - live_card.skills missing_caps = task.required_capabilities - live_card.capabilities if missing_skills or missing_caps: raise CardStalenessError( f"task {task.task_id} cannot enter 'working': live card " f"{live_card.agent_id}@{live_card.version} missing " f"skills={sorted(missing_skills)} capabilities={sorted(missing_caps)}" ) if task.resolved_card_digest != live_card.digest(): # Card was superseded, but live card still covers the task: # permitted, but the divergence must be recorded for audit. task.state = "working" task.metadata = getattr(task, "metadata", {}) task.metadata["card_digest_mismatch"] = { "resolved": task.resolved_card_digest, "live": live_card.digest(), } return task task.state = "working" return task def caller_check_before_dispatch(task: DelegatedTask, cached_card: AgentCard, fresh_card: AgentCard) -> None: """Caller-side gate: cancel rather than dispatch if the fresh card no longer covers a task justified by the cached card.""" if cached_card.digest() == fresh_card.digest(): return missing = (task.required_skills - fresh_card.skills) | ( task.required_capabilities - fresh_card.capabilities ) if missing: raise CardStalenessError( f"caller refusing to dispatch {task.task_id}: cached card " f"{cached_card.version} superseded by {fresh_card.version}, " f"no longer covers {sorted(missing)}; issue tasks/cancel" ) ```