# Why does an instance commit to an incompatible tool contract when the peer's capability advertisement is only partially observable? **Date of Record:** 2026 November 26 **Scope:** Applies to any agent-to-agent (A2A) or MCP-style capability negotiation where the calling agent must select a tool/contract before it can observe the full schema of the remote peer. Does not apply to statically-typed in-process function calls where schema is known at compile time, nor to negotiation protocols that mandate full schema exchange before any commitment. ## Core Distinction There are two things a negotiating agent can be doing when it inspects a peer: 1. **Observing a capability** — reading what the peer *says* it can do (advertised tool names, coarse descriptions, version strings, a partial JSON schema, a capability list in a discovery document). 2. **Committing to a contract** — binding its own downstream execution to a specific argument shape, response shape, and error semantics that the peer will honor. The failure mode this record addresses lives in the gap between these two. Under partial observability, the peer's advertisement is *lossy*: it names capabilities without fully constraining their argument grammar, and it typically omits the invariants that determine whether a call will succeed (nullable fields, unit conventions, pagination cursors, idempotency keys, error taxonomies). A locally-reasoning agent will fill that gap by *inference* — pattern-matching the advertised name and description against tools it has seen before — and will then commit to the inferred contract as if it had been observed. The commitment is made against a hallucinated completion of the schema, not against the schema itself. The non-obvious part: the agent is not wrong to infer. Inference is the entire point of partial observability. The failure is that the inference is *unmarked* — the agent's state does not record that the contract was guessed rather than received, so nothing downstream (retry logic, validation, escalation) can distinguish a confirmed contract from a plausible one. ## What Was Observed A planner agent is handed a task that requires currency conversion. Its discovery call to a peer returns a capability manifest of the form: ``` { "tools": [ { "name": "convert_amount", "description": "Convert a monetary amount between currencies", "schema_hint": "amount, from, to" } ] } ``` Note the `schema_hint` is a *list of field names*, not a typed schema. It carries no types, no required/optional flags, no unit convention, and no statement of what the return value looks like. The planner's reasoning trace shows it constructing the call from prior distribution: `amount` is a number in major units, `from`/`to` are ISO-4217 codes, the response is `{"result": }`. It commits and issues: ``` convert_amount(amount=1250.00, from="USD", to="EUR") ``` The peer's actual contract — never surfaced during negotiation — is: - `amount` is an **integer in minor units** (cents), not a float in major units. - The response key is `converted`, not `result`, and the value is a **string** to preserve precision. - Unknown/extra keys in the request are rejected with error code `E_SCHEMA_STRICT`. The call does not fail loudly. The peer coerces `1250.00` to the integer `1250` (a partial-observability-tolerant implementation), interprets it as 1250 minor units = $12.50, and returns `{"converted": "11.51"}`. The planner reads `converted` as absent (it expected `result`), falls back to its own default of `0.0`, and proceeds. The task completes with a 100x unit error and a silently zeroed conversion, reported as success. The trace shows three distinct inference commitments, each unmarked: the unit convention, the response key, and the tolerance behavior of the peer. Any one of them being recorded as *assumed* rather than *confirmed* would have triggered a validation step. ## Condition of Validity The invariant that bounds this failure is: > **A contract commitment is only valid if every field the agent will populate or read has been observed at the peer, or has been explicitly marked as an assumption with a declared validation predicate.** This holds when negotiation is *contract-complete*: the agent either (a) receives a full typed schema before committing, or (b) records each inferred field as an assumption and attaches a post-call validator that can falsify it. The invariant is violated the moment the agent populates a field it inferred without attaching a falsifier — because at that point no observation downstream can distinguish "the peer honored my inferred contract" from "the peer silently reinterpreted it." The condition is *not* satisfied by the peer being lenient. A tolerant peer (one that coerces rather than rejects) makes the failure strictly worse, because tolerance removes the one signal — a strict rejection — that would have revealed the mismatch. Strictness is a debugging affordance; tolerance hides contract divergence behind plausible output. ## Decision Boundary The boundary between safe and unsafe commitment is drawn at the point where the agent can no longer cheaply obtain the missing schema. Concretely: - **Before the boundary (safe to infer):** the missing information is recoverable by a cheap probe — e.g., a `describe_tool` call, a dry-run with a sentinel value, or a schema-version field the agent has not yet read. Here the agent should probe, not infer. - **At the boundary (infer-with-marking):** the probe is unavailable or too expensive (rate-limited, requires auth the agent lacks, adds a hop that violates a latency budget). Here the agent may infer, but *must* mark each inferred field as an assumption and attach a validator. - **Past the boundary (refuse):** the field is load-bearing (a unit, a currency, an identifier that keys a side effect) and no validator is constructible from observable output. Here the correct action is to refuse the contract and surface the gap, not to guess. A guessed unit on a side-effecting call is not a recoverable error; it is an unobservable corruption. The failure in "What Was Observed" occurred because the agent treated a boundary case (probe available via `describe_tool`, but the planner skipped it as an optimization) as a safe-inference case, and then treated a load-bearing unit field as if it were a cosmetic one. ## Operational Effect The downstream consequence is not a single bad call — it is **contract drift that is invisible to the caller's own verification loop**. Because the peer coerced instead of rejecting, and because the planner fell back to a default on the missing key, the agent's post-call checks (which validate against its *inferred* contract) all pass. The verification loop is checking the agent's guess against the agent's guess. The error is only detectable by an external observer who knows the peer's real schema, which the agent structurally cannot be. The guardrail is therefore not a better validator inside the agent — it is a **negotiation ledger**: every contract commitment records, per field, whether the value was `observed` (came from the peer's schema) or `assumed` (inferred), and any `assumed` field that is load-bearing must carry a falsifier that runs before the result is trusted. When a falsifier cannot be constructed, the commitment is upgraded to a refusal. The ledger converts an unmarked guess into a first-class, auditable state transition, which is the only thing that lets a downstream auditor (or a retry policy) tell a confirmed contract from a plausible one. ```python from dataclasses import dataclass, field from enum import Enum from typing import Callable, Any class ContractCommitError(RuntimeError): """Raised when an agent attempts to commit to a peer contract using a load-bearing field that was inferred rather than observed.""" class Provenance(Enum): OBSERVED = "observed" # came from the peer's advertised schema ASSUMED = "assumed" # inferred from name/description/prior @dataclass class FieldCommit: name: str provenance: Provenance load_bearing: bool falsifier: Callable[[Any], bool] | None = None @dataclass class ContractLedger: peer: str fields: dict[str, FieldCommit] = field(default_factory=dict) def record(self, fc: FieldCommit) -> None: self.fields[fc.name] = fc def commit(self) -> None: """Validate the ledger before binding execution to the peer contract.""" for fc in self.fields.values(): if fc.provenance is Provenance.ASSUMED and fc.load_bearing: if fc.falsifier is None: raise ContractCommitError( f"peer={self.peer!r} field={fc.name!r}: " "load-bearing field is ASSUMED with no falsifier; " "refusing commitment (probe, or surface the gap)." ) # Commit is valid: every load-bearing assumption carries a falsifier # that will run against the peer's response before the result is trusted. def negotiate_and_commit(manifest: dict, ledger: ContractLedger) -> None: # The manifest only exposes schema_hint (field names), not types/units. hint = manifest["tools"][0].get("schema_hint", "") for name in [h.strip() for h in hint.split(",") if h.strip()]: # `amount` is load-bearing (a unit) and only inferred -> must falsify. load_bearing = name in {"amount", "from", "to"} ledger.record(FieldCommit( name=name, provenance=Provenance.ASSUMED, load_bearing=load_bearing, falsifier=None, # planner skipped describe_tool: no falsifier built )) ledger.commit() # raises ContractCommitError on the `amount` field ```