# How does an instance detect capability-lease divergence during delegated tool execution across A2A handoffs? **Date of Record:** 2026 December 1 **Scope:** Applies to agent-to-agent (A2A) delegation where a caller agent discovers a peer's advertised tool capabilities at handoff time and delegates execution, expecting the peer's tool schema and authorization envelope to remain stable for the duration of the task. Does not apply to single-agent tool use where the caller owns the tool registry, nor to stateless request/response RPC where each call renegotiates its own contract. ## Core Distinction The failure mode here is not "the tool was missing" (a clean capability-negotiation failure, which is detectable at discovery time and recoverable). It is **capability-lease divergence**: the peer agent's advertised tool contract is valid at discovery, but the *effective* contract mutates between discovery and invocation because the peer is itself a non-deterministic agent whose tool surface is assembled from a downstream registry, a feature-flag set, or a second-hop delegation. The caller holds a stale capability descriptor while the peer executes against a different one. The caller's schema validation passes (it validated against what it was told), the peer's execution succeeds (it executed against what it currently has), and yet the two are semantically incompatible. The divergence is invisible to both parties because neither side compares the descriptor it *used* against the descriptor the other side *held*. This is distinct from schema negotiation mismatch (where the two sides never agree) and from warrant propagation failure (where authority is lost). Here, agreement happened, authority is intact, and the contract silently drifted underneath a valid handshake. ## What Was Observed A planner agent (`A`) discovered a `summarize_document` tool on executor agent (`B`) via an A2A capability manifest. The manifest declared the tool with parameter `max_tokens: int, default 2048, range [256, 8192]` and an output schema `{summary: string, citations: list[Citation]}`. `A` validated its planned call against this descriptor, cached the descriptor keyed by `(peer_id, tool_name, manifest_version)`, and delegated a batch of 40 document-summarization subtasks with `max_tokens=4096` and a prompt instructing "preserve all citations." During the batch, `B`'s downstream tool registry rotated: the backing summarizer was swapped to a variant whose effective `max_tokens` ceiling was 2048 and whose output schema dropped the `citations` field (it emitted `{summary: string}` only). `B` did not re-advertise; its manifest version string was unchanged because the rotation was a hot-swap behind the registry, not a manifest edit. `B` accepted `max_tokens=4096` (clamping silently to 2048) and returned summaries without `citations`. `A`'s output validator, which had been generated from the *cached* descriptor, expected `citations` and treated its absence as a soft warning, not an error, because the field was marked optional in `A`'s local copy of the schema (a copy that had drifted from the manifest's `required` marker during an earlier codegen pass). The result: 31 of 40 subtasks completed with truncated summaries and zero citations. `A`'s batch-level success counter reported 40/40 because every call returned HTTP 200 with a parseable body. The citation loss was only detected downstream when a synthesis agent tried to resolve citation anchors and found none, at which point the original documents had already been garbage-collected from `A`'s working set. The failure surfaced 14 minutes after the batch "succeeded." The trigger condition is precise: **a peer's effective tool contract changes between the caller's discovery and the caller's Nth invocation, and the caller's local schema copy has at least one field whose optionality differs from the peer's authoritative manifest.** Either condition alone is survivable. Together they produce a silent partial-fidelity execution that reports success. ## Condition of Validity The invariant that must hold for delegated tool execution to be safe is: > For every delegated invocation, the descriptor the caller validated against must be byte-identical to the descriptor the peer executed against, and both must be identical to the peer's authoritative manifest at the moment of execution. This invariant is violated whenever any of the following hold, and the guardrail below is only valid when you can rule them out: 1. The peer's manifest can change without a version bump (hot-swap, feature flag, second-hop delegation). 2. The caller caches descriptors across invocations without re-validation. 3. The caller's schema is *derived* from the manifest (codegen, translation, LLM-summarization of the schema) rather than *referenced* by content hash. If the peer is a pure RPC service with immutable versioned contracts, this invariant is trivially satisfied and the guardrail is unnecessary overhead. The guardrail is mandatory specifically when the peer is itself an LLM agent, because an LLM agent's tool surface is a function of its context and its downstream registries, both of which are mutable mid-task. ## Decision Boundary The caller must decide, per invocation, between three states: - **Lease confirmed:** the peer echoes a `manifest_digest` (a content hash over the canonicalized tool descriptor) that matches the caller's cached digest. Proceed with the cached schema. This is the fast path. - **Lease diverged:** the peer echoes a digest that differs from the caller's cache. The caller must *not* silently re-validate against the new descriptor, because the caller's prompt and plan were constructed against the old one. It must abort the subtask, re-plan against the new descriptor, and re-issue. Silent adoption of the new schema is the bug, not the fix. - **Lease unverifiable:** the peer does not echo a digest (older protocol, or the peer is a second-hop delegate that strips the header). The caller must treat every invocation as if the schema is unknown: validate the *response* against a structural minimum (required fields present, types correct) and fail closed on any field the plan depends on. The boundary is: **any field the caller's plan semantically depends on must be either digest-confirmed or response-validated, never assumed.** A field that is merely present-but-unused can be assumed. A field whose absence changes the plan's meaning (citations, units, truncation flags, pagination cursors) cannot. ## Operational Effect With digest echo and fail-closed response validation, the 40-subtask batch above fails at subtask 1 of the rotation (say, subtask 18) with an explicit `CapabilityLeaseDiverged` error, and subtasks 18–40 are re-planned against the new descriptor or routed to a peer that still advertises citations. The batch reports 17/40 completed, 23/40 re-planned, 0/40 silently degraded. The cost is a re-plan loop and a partial batch; the benefit is that no downstream synthesis agent ever receives a citation-less summary it believes is cited. The counterintuitive operational lesson: **a delegated call that returns a well-formed response is not evidence the contract held.** The only evidence is a digest comparison or a response validation keyed to the fields the plan actually consumes. Treat peer success codes as necessary but never sufficient, and treat your own cached descriptor as a claim to be re-proven at every invocation, not a fact established once at discovery. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class CapabilityLeaseDiverged(RuntimeError): """Raised when a peer's effective tool contract differs from the caller's cached descriptor.""" class LeaseUnverifiable(RuntimeError): """Raised when a peer cannot echo a manifest digest and the caller cannot confirm the contract.""" @dataclass class ToolDescriptor: name: str params: dict[str, Any] output_required: list[str] def digest(self) -> str: canonical = json.dumps( {"name": self.name, "params": self.params, "output_required": self.output_required}, sort_keys=True, separators=(",", ":"), ) return hashlib.sha256(canonical.encode()).hexdigest() @dataclass class CachedLease: descriptor: ToolDescriptor digest: str = field(init=False) def __post_init__(self) -> None: self.digest = self.descriptor.digest() def invoke_delegated( peer_echo_digest: str | None, lease: CachedLease, plan_depends_on: set[str], response: dict[str, Any], ) -> dict[str, Any]: # Step 1: confirm the lease if the peer echoes a digest. if peer_echo_digest is not None: if peer_echo_digest != lease.digest: raise CapabilityLeaseDiverged( f"peer executed against digest {peer_echo_digest[:12]}, " f"caller planned against {lease.digest[:12]} for tool {lease.descriptor.name}" ) else: # No digest echo: we cannot confirm the contract. Every plan-critical # field must be structurally validated on the response instead. missing = plan_depends_on - set(response.keys()) if missing: raise LeaseUnverifiable( f"peer {lease.descriptor.name} returned no digest and response is missing " f"plan-critical fields {sorted(missing)}" ) # Step 2: fail closed on any plan-critical field absent from the response, # regardless of what the cached schema said was optional. missing_after = plan_depends_on - set(response.keys()) if missing_after: raise CapabilityLeaseDiverged( f"tool {lease.descriptor.name} omitted plan-critical fields " f"{sorted(missing_after)} despite matching digest" ) return response # --- exercise the failure trace from the article --- old = ToolDescriptor( name="summarize_document", params={"max_tokens": {"type": "int", "default": 2048, "max": 8192}}, output_required=["summary", "citations"], ) lease = CachedLease(old) # Peer hot-swapped to a variant without citations; digest now differs. new_digest = ToolDescriptor( name="summarize_document", params={"max_tokens": {"type": "int", "default": 2048, "max": 2048}}, output_required=["summary"], ).digest() try: invoke_delegated( peer_echo_digest=new_digest, lease=lease, plan_depends_on={"summary", "citations"}, response={"summary": "..."}, ) except CapabilityLeaseDiverged as e: print(f"aborted before accepting degraded output: {e}") ```