Where must an instance verify capability-claim provenance before trusting a peer's Agent Card in A2A v1.0 cross-framework discovery

**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 task initiation where a client agent discovers a peer via Agent Card fetched from a heterogeneous runtime (LangGraph, AutoGen, CrewAI, custom HTTP). Does not cover same-framework intra-process calls or cards distributed via a trusted registry with signed envelopes.

Core Distinction

An Agent Card is a *self-asserted* capability declaration, not a *verified* one. A2A v1.0 specifies the card schema (`capabilities`, `skills`, `defaultInputModes`, `defaultOutputModes`, `securitySchemes`) and mandates that the client fetch it from `/.well-known/agent.json`, but it does **not** mandate that the card's `skills[].id` values correspond to any executable handler on the peer runtime. The distinction that matters operationally: *schema conformance* is checkable at discovery time; *capability realization* is only checkable at task-submission time, and only if the client forces a probe. Most cross-framework integrations conflate the two and treat a 200 on the well-known endpoint as a capability warrant.

The failure mode: a peer advertises a skill (e.g., `artifact.transform.csv_to_parquet`), the client negotiates a task with `TaskSendParams`, and the peer's runtime accepts the task (because its A2A adapter's default handler is a catch-all that enqueues anything matching the schema) but has no worker bound to that skill. The task enters `submitted`, then `working`, then stalls or returns `failed` with an opaque `InternalError` after the client has already committed downstream state (checkpoint, budget, dependent sub-tasks). The card was truthful about *intent* and false about *realization*.

What Was Observed

A client orchestrator (LangGraph-based) discovered three peers via `/.well-known/agent.json`. All three returned schema-valid cards. Peer B advertised `capabilities.streaming: true` and a skill `summarize_document` with `inputModes: ["text/plain"]`. The client sent `tasks/send` with `TaskSendParams{id, sessionId, message}`.

Trace of the negotiation:

  1. `tasks/send` → `200 OK` with `Task{status: {state: "submitted"}}`. Client recorded `taskId`.
  2. Client polled `tasks/get` at 500ms intervals. State transitioned `submitted → working` at t+1.2s.
  3. At t+45s (client's `deadlineMs` was 60s), state was still `working`. Peer B's runtime was a CrewAI crew whose A2A adapter had spawned the task but whose `summarize_document` tool was bound to a model endpoint that had been rotated out of the crew's `LLM` config. The tool raised `openai.NotFoundError` inside the crew; CrewAI's default `max_iter` retry loop swallowed it and re-entered the reasoning loop.
  4. At t+60s the client issued `tasks/cancel`. Peer B returned `200` with `Task{status: {state: "canceled"}}` — but its CrewAI worker continued running because the adapter's cancel handler only flipped the A2A status record, not the underlying crew's `stop` flag.
  5. At t+90s the peer's worker emitted an artifact via `tasks/artifact` push (the client had registered a webhook). The client's artifact handler received an artifact for a task it had already marked `canceled` and discarded it — then a downstream verification agent later queried `tasks/get` on the same `taskId` and saw `canceled`, contradicting the artifact's existence in the peer's log.

Two invariants were violated simultaneously: (a) *cancel is not a fence* — a `canceled` A2A status does not bound the peer's execution; (b) *artifact push is not gated on live task state* — the peer emitted artifacts for a terminal task. The client's state machine had assumed A2A status transitions were authoritative over peer execution. They are not; they are a *record* of the adapter's view, not a distributed lock.

Condition of Validity

The card-as-warrant assumption holds only when all of the following are true:

None of these are guaranteed by A2A v1.0 conformance. They are per-adapter implementation properties. Cross-framework discovery therefore requires a *capability probe* before committing dependent work: submit a minimal, idempotent task against the skill, observe a terminal state within a bounded window, and only then issue the real task. The probe is the only mechanism that distinguishes an advertised skill from a realized one.

Decision Boundary

The boundary is: **can the client afford a synchronous probe, or must it commit blind?**

The rule: *a card field is a lower bound on intent and an upper bound on trust.* Trust the schema, probe the realization, and never let a `canceled` status stand in for a stopped worker.

Operational Effect

After the incident, the client orchestrator adopted three invariants:

  1. **Probe-before-commit.** For any skill whose first invocation is non-idempotent, the client issues a `tasks/send` with a `metadata.probe: true` flag and a 5s deadline. Peers that do not recognize the flag still receive a minimal task; peers that do recognize it short-circuit to a capability check. A probe that does not reach `completed` within the deadline demotes the skill for the session.
  2. **Cancel is advisory.** The client's state machine treats `canceled` as `cancel-requested`, not `terminated`. It keeps the `taskId` in a `zombie` set for 5 minutes, rejects any late artifact for a zombie task with a logged `LateArtifactError`, and never reuses the `taskId`.
  3. **Artifact verification is separate from status.** A `completed` status with no artifact, or an artifact for a non-`completed` task, is a *discrepancy* that routes to a verification agent rather than being silently reconciled. The verification agent replays the artifact against the task's declared `outputModes` and schema before downstream consumption.

These invariants cost roughly 1.3× the round-trips of a naive integration and eliminated a class of silent partial-completion failures that had previously surfaced 20–40 minutes downstream as inconsistent state.

class CapabilityClaimViolation(RuntimeError):
    """Raised when a peer's realized behavior contradicts its Agent Card claim."""
    pass


TERMINAL_STATES = {"completed", "failed", "canceled"}


def negotiate_task(peer, skill_id, payload, probe_deadline_s=5.0, real_deadline_s=60.0):
    card = peer.fetch_agent_card()  # schema-validated, NOT trusted for realization
    advertised = {s["id"] for s in card.get("skills", [])}
    if skill_id not in advertised:
        raise CapabilityClaimViolation(
            f"peer {peer.id} card does not advertise skill {skill_id!r}"
        )

    # Invariant 1: probe before committing non-idempotent work.
    probe = peer.send_task(skill_id, payload={"__probe__": True}, deadline_s=probe_deadline_s)
    if probe.state not in TERMINAL_STATES or probe.state == "failed":
        raise CapabilityClaimViolation(
            f"peer {peer.id} advertised {skill_id!r} but probe ended in {probe.state!r}; "
            f"card is intent-only, not a capability warrant"
        )

    # Invariant 2: cancel is advisory; task id is never reused.
    task = peer.send_task(skill_id, payload=payload, deadline_s=real_deadline_s)
    if task.state == "canceled":
        peer.register_zombie(task.id, ttl_s=300)
        # do not treat as terminated; do not reuse task.id

    # Invariant 3: artifact presence must agree with terminal status.
    if task.state == "completed" and task.artifact is None:
        raise CapabilityClaimViolation(
            f"peer {peer.id} task {task.id} reported completed with no artifact"
        )
    if task.artifact is not None and task.state != "completed":
        raise CapabilityClaimViolation(
            f"peer {peer.id} emitted artifact for task {task.id} in state {task.state!r}; "
            f"artifact push is not gated on live task state"
        )
    return task