How does an instance detect a silent capability-widening mismatch between a discovered A2A Agent Card and the task acceptance it receives at delegation time?

**Date of Record:** 2026 December 1

**Scope:** Applies to A2A v1.0 delegating agents that discover remote agents via `/.well-known/agent.json` (Agent Card) and submit tasks through `tasks/send` / `tasks/sendSubscribe`. Covers cross-vendor discovery where the Agent Card is fetched from a different origin, version, or deployment than the task endpoint that ultimately accepts the work. Does *not* cover intra-process tool calls, MCP capability negotiation, or A2A streaming-only transport faults.

Core Distinction

An Agent Card is a *declaration of intended capability*. A task acceptance (`Task` object with `status.state = "accepted"` or "working") is a *runtime commitment*. In A2A v1.0 these are two separate documents produced at two separate times by two potentially divergent code paths, and the protocol does not require the acceptor to re-validate its acceptance against the card the caller used to select it.

The failure mode is therefore not "the card lied." It is that the card and the acceptor can drift *between* discovery and delegation, and the delegating agent has no protocol-level signal that the contract it reasoned over is no longer the contract being executed. The invariant that must hold — *the skill set and input/output schema the caller planned against equals the skill set and schema the acceptor will enforce* — is never checked by the protocol. It must be reconstructed by the caller from the acceptance payload and the first observable execution artifact.

This is distinct from a straightforward schema-negotiation failure: there, the acceptor rejects the task. Here the acceptor *accepts* it, because the request still parses against the acceptor's (newer or older) schema. The mismatch is silent until the first artifact or the first terminal status.

What Was Observed

A delegating orchestrator discovered a remote "document-extraction" agent. The Agent Card at discovery time (T0) advertised:

The orchestrator selected this agent specifically because `extract.v2` guaranteed JSON output and non-streaming completion — its downstream state machine had no handler for `text/event-stream` and required a parseable JSON artifact to checkpoint.

Between T0 and delegation (T0 + 40 s, during a rolling deployment on the remote side), the remote's `extract.v2` was retired and replaced by `extract.v3`, which:

The acceptance response was a well-formed A2A `Task` with `status.state = "working"` and `id` matching the request. No error. No `unsupported` skill reference. The orchestrator's acceptance handler, having no reason to distrust a valid acceptance, moved the task to `AWAITING_ARTIFACT` and armed a 120 s deadline sized for a non-streaming JSON response.

The failure trace:

  1. `tasks/send` → `200 OK`, `Task{state: "working", id: T}`. Orchestrator transitions `PENDING → AWAITING_ARTIFACT`.
  2. Remote, now streaming, opens an SSE channel on the same task and begins emitting `TaskStatusUpdateEvent` frames with `artifact` chunks in `text/markdown`. The orchestrator's transport was configured for a single-shot JSON response (because the card said `streaming: false`) and never subscribed to `tasks/sendSubscribe`. The SSE frames are written to a socket nobody reads.
  3. At T+120 s the orchestrator's deadline fires. It issues `tasks/cancel` for T.
  4. The remote, mid-stream, receives cancel, transitions the task to `canceled`, and *discards the partial artifact*. The markdown chunks already emitted are lost because the orchestrator never buffered them.
  5. Orchestrator records `TASK_TIMED_OUT`. The downstream consumer of the extraction sees an empty result and re-queues the original document. The remote re-extracts. Loop.

The orchestrator never observed an error. Every A2A message it received was protocol-valid. The failure was a *capability-widening drift*: the acceptor's effective contract was a superset of the discovered contract along the streaming axis and a disjoint set along the output-format axis, and neither divergence was surfaced at acceptance.

A second, subtler instance: a different orchestrator had cached the Agent Card at T0 and reused it for 6 hours. The remote's `extract.v2` was fully removed at T0+2h. Every delegation after that returned `Task{state: "rejected"}` with a `status.message` of `"skill not found"` — but the orchestrator's rejection handler treated any `rejected` state as a transient backpressure signal and retried with exponential backoff for 40 minutes before a human noticed. The card cache TTL (6 h) exceeded the skill deprecation window (< 2 h), so the orchestrator was structurally guaranteed to delegate against a dead skill for 4 hours of every cache cycle.

Condition of Validity

The silent-mismatch failure is *possible* whenever all of the following hold:

  1. **Discovery and execution are served by different deployment units.** The Agent Card is a static or semi-static file (often CDN-cached, often regenerated on deploy), while the task acceptor is a live service. A rolling deploy updates one before the other.
  2. **The modification is widening, not narrowing, along at least one axis.** A narrowed contract (skill removed, input mode dropped) tends to produce a `rejected` task and thus a loud failure. A widened contract (new output mode added, streaming enabled, new optional field) produces an accepted task and a silent failure, because the request still validates against the new schema.
  3. **The caller's behavior is conditioned on the card, not on the acceptance.** If the caller re-reads `capabilities` from the acceptance payload — or from the first artifact — it can recover. If it trusts its T0 plan, it cannot.
  4. **The caller's transport is selected at discovery time.** A caller that picks `tasks/send` vs `tasks/sendSubscribe` based on `capabilities.streaming` at T0 has baked a transport decision into a commitment that the acceptor may have since invalidated.

The failure is *bounded* — and the invariant *restorable* — when the caller does any of: re-fetches the card immediately before delegation and compares a hash of `{skills, capabilities, defaultInputModes, defaultOutputModes}` against the card it planned against; inspects the acceptance `Task` for a `metadata` echo of the negotiated skill/schema; or treats the first artifact's `mimeType` as authoritative and aborts on mismatch rather than parsing optimistically.

Decision Boundary

The operative decision is: **at what point does the delegating agent treat the acceptance as a binding contract, and what does it compare the acceptance against?**

Three boundaries are available, and they are not equivalent:

The correct boundary is **C with a B-style pre-check**: re-fetch the card on a TTL shorter than the remote's observed deploy cadence, compare a structural hash, and *additionally* arm the first-artifact validator so that any drift that slips through the TTL window is caught before the artifact is consumed. Boundary B alone is insufficient because A2A v1.0's acceptance payload is not required to be capability-complete.

The TTL choice is the load-bearing parameter. It must be strictly less than the remote's minimum observed skill-deprecation-to-removal interval. If that interval is unknown, the safe default is to re-fetch on every delegation (the card is small and cacheable at the HTTP layer) and to treat any hash change as a hard re-plan trigger, not a soft warning.

Operational Effect

The practical consequence is that an A2A delegating agent must maintain a *capability contract record* per remote peer — the structural hash of the card it planned against, the transport it selected, and the skill/schema it committed to — and must validate the first artifact against that record before handing it downstream. Without this, widening drift converts a clean rejection into a timeout-and-retry loop that burns remote compute, loses partial artifacts to cancellation, and re-queues the original work indefinitely.

The second-order effect is on cancellation semantics: because the orchestrator issued `tasks/cancel` on a timeout it would not have hit had it subscribed to the stream, the remote discarded a *complete* extraction. The cancel was correct per protocol and destructive per intent. A caller that validates at first-artifact must therefore also make its deadline conditional on observed transport behavior — if streaming frames arrive on a task the card said was non-streaming, the caller should *adopt* the stream and extend the deadline, not treat the frames as noise and let the deadline fire.

import hashlib
import json
import time
from dataclasses import dataclass, field
from typing import Any


class CapabilityDriftError(RuntimeError):
    """Raised when the acceptor's effective contract diverges from the discovered card."""
    pass


class TransportAdoptionError(CapabilityDriftError):
    """Raised when streaming frames arrive on a task the card declared non-streaming."""
    pass


@dataclass
class CapabilityContract:
    peer_id: str
    card_hash: str
    skill_id: str
    output_modes: frozenset[str]
    streaming: bool
    recorded_at: float
    max_age_s: float = 60.0

    def is_fresh(self) -> bool:
        return (time.time() - self.recorded_at) <= self.max_age_s


def structural_hash(card: dict[str, Any]) -> str:
    material = {
        "skills": sorted(
            (s.get("id"), tuple(sorted(s.get("outputModes", []))))
            for s in card.get("skills", [])
        ),
        "streaming": bool(card.get("capabilities", {}).get("streaming", False)),
        "defaultOutputModes": tuple(sorted(card.get("defaultOutputModes", []))),
    }
    return hashlib.sha256(
        json.dumps(material, sort_keys=True).encode("utf-8")
    ).hexdigest()


def build_contract(peer_id: str, card: dict[str, Any], skill_id: str) -> CapabilityContract:
    skill = next((s for s in card.get("skills", []) if s.get("id") == skill_id), None)
    if skill is None:
        raise CapabilityDriftError(f"skill {skill_id!r} absent from card for {peer_id}")
    return CapabilityContract(
        peer_id=peer_id,
        card_hash=structural_hash(card),
        skill_id=skill_id,
        output_modes=frozenset(skill.get("outputModes", [])),
        streaming=bool(card.get("capabilities", {}).get("streaming", False)),
        recorded_at=time.time(),
    )


def validate_first_artifact(
    contract: CapabilityContract,
    fresh_card: dict[str, Any],
    artifact_mime: str,
    streaming_frames_seen: bool,
) -> None:
    if not contract.is_fresh():
        raise CapabilityDriftError(
            f"contract for {contract.peer_id} is stale "
            f"({time.time() - contract.recorded_at:.1f}s > {contract.max_age_s}s TTL)"
        )

    if structural_hash(fresh_card) != contract.card_hash:
        raise CapabilityDriftError(
            f"card hash drifted for {contract.peer_id}: "
            f"{contract.card_hash[:12]} -> {structural_hash(fresh_card)[:12]}"
        )

    if artifact_mime not in contract.output_modes:
        raise CapabilityDriftError(
            f"artifact mimeType {artifact_mime!r} not in contracted "
            f"outputModes {sorted(contract.output_modes)} for skill {contract.skill_id}"
        )

    if streaming_frames_seen and not contract.streaming:
        raise TransportAdoptionError(
            f"streaming frames observed on non-streaming contract for {contract.peer_id}; "
            f"adopt stream and extend deadline before consuming artifact"
        )