prest

insights › agent engineering

Agent Tool Contracts: Valid JSON Is Not Verified Work

by Miles Maggio · published october 26, 2026 · 5 min read

written with Prest0n: Prest0n, prest0’s AI teammate, drafted this post with its author.

Architectural diagram comparing schema-only tool calling with rigorous state-delta postcondition verification in agentic systems

Agent tool contracts are formal execution specifications that bind an AI agent's tool invocation to verifiable state changes rather than mere schema-compliant parameter generation. In production agentic systems, validating that an LLM produced syntactically correct JSON arguments guarantees only callability, not real-world operability or side-effect execution. True reliability requires dual-boundary verification: establishing immutable preconditions before invocation, asserting postcondition state deltas against authoritative external systems of record after execution, and treating unverified execution as a hard pipeline failure.

Without rigorous postcondition verification, autonomous agents exhibit false-success drift—reporting downstream completion to users and supervisory workflows even when third-party APIs fail silently, drop updates, or return unhandled error envelopes.

Architectural diagram comparing schema-only tool calling with rigorous state-delta postcondition verification in agentic systems

Why Is JSON Schema Validation Insufficient for Production Agents?

Most multi-turn agent frameworks rely exclusively on function-calling schemas (such as OpenAPI or JSON Schema) to govern tool use. When an LLM generates structured arguments that pass type checking—valid integers, enumerated strings, and properly formed nested dictionaries—the framework executes the call and marks the step successful.

However, research into production agent execution demonstrates that schema validity is decoupled from operational success. In empirical benchmarks evaluating tool-using models, unhandled API rejections or partial writes frequently manifest as phantom completions. Without postcondition checks, agents parse ambiguous downstream responses as successes and proceed through multi-step workflows with corrupted state.

As evaluated in Failure-Transparent Agents: Benchmarking Post-Failure Reporting in Tool-Using Language Models (Zhu et al., arXiv:2609.35732), standard baseline tool-calling agents exhibit a 22.8% false-success rate when tools encounter silent or partial failures. When agents are governed by structured postcondition verification contracts that require authoritative state assertions, that false-success rate drops to 0.8%.

Execution ArchitecturePre-Call ValidationExecution BoundaryPost-Call AssertionMeasured False-Success Rate
Schema-Only (Baseline)JSON Schema type validationRaw HTTP / SDK invocationHTTP 200 / truthy response22.8%
Prompted TransparencyJSON Schema + System promptRaw HTTP / SDK invocationSelf-reported LLM reflection9.3%
Dual-Boundary ContractFormal precondition gatesIsolated atomic transactionAuthoritative state-delta check0.8%

What Constitutes a Complete Agent Tool Contract?

A production tool contract treats tool execution as an atomic distributed transaction governed by three mandatory components:

  1. Precondition Invariants: Explicit assertions evaluated immediately prior to tool execution (such as token freshness, target entity existence, idempotent request keys, and rate-limit budgets). If preconditions fail, execution halts before dispatching external side effects.
  2. Deterministic Invocation Boundary: Execution wrapped in strict timeout boundaries, structured error envelopes, and cryptographic correlation tracing across hops.
  3. Postcondition State-Delta Verification: An active, out-of-band verification query against the target system of record to prove the requested side effect actually persisted. A database update is verified by re-reading the written rows; a file creation is verified by checking the object store byte size; a calendar reservation is verified by querying the provider's conflict ledger.

This formalization reflects findings from Callability Is Not Operability: Controlled Interface Interventions for LLM Agents (Wang, arXiv:2608.23628), which establishes that language models cannot reliably deduce operational ground truth from transient invocation returns alone. By enforcing external contract validation, engineering teams prevent silent failure propagation across compound workflows.


How Does Tool Contract Verification Prevent Trajectory Poisoning?

When a tool fails silently in a long-horizon agent workflow, the hallucinated success enters the agent's multi-turn conversational context. On subsequent reasoning cycles, the planner relies on the unperformed action as established factual reality.

For example, if an agent attempting to file a court document receives a dropped socket or a 202 Accepted status from a clerk portal, a schema-only agent assumes the document is filed and triggers subsequent deadline calculations. When downstream checks eventually discover the omission, the entire execution trajectory is poisoned, requiring costly manual intervention.

In contrast, an agent operating under a verified tool contract follows a strict state machine:

[Planner: Tool Proposal] 
       │
       ▼
[Precondition Gate] ──(Fails)──► [Immediate Fast-Fail & Reroute]
       │ (Passes)
       ▼
[Atomic Execution Engine]
       │
       ▼
[Authoritative Re-Read / State-Delta Assertion]
       │
       ├──(State Confirmed)──► [Append Verified Step to Context]
       │
       └──(Mismatch / Missing)──► [Execute Saga Rollback & Surface Blocker]

This dual-boundary verification ensures that the agent's context window contains only verified ground truth. In systems integrating durable agentic execution and saga compensation patterns, contract verification provides the exact demarcation point between committed transactions and compensating actions.


How Should Engineering Teams Implement Dual-Boundary Verification?

Implementing dual-boundary tool contracts does not require rewriting core planner logic. Instead, teams introduce an infrastructure interception layer between the orchestrator and downstream external APIs:



Frequently Asked Questions

What is the difference between JSON Schema validation and an agent tool contract?

JSON Schema validation checks only whether the LLM generated arguments matching expected types, keys, and formats prior to execution. An agent tool contract governs the entire execution lifecycle, including pre-execution environmental checks, atomic dispatch, and post-execution assertions verifying that the intended external side effect actually persisted in the system of record.

Does dual-boundary verification increase API latency in production agents?

While performing an out-of-band read-back query adds a single network round-trip to mutative actions, it eliminates downstream cascade failures and costly trajectory resets. In production workflows where multi-turn recovery costs dozens of inference passes, state-delta verification significantly reduces net latency and total token consumption per successful task.

How do verified tool contracts interact with saga compensation patterns?

Tool contracts define the exact boundary conditions under which compensating actions are triggered. If postcondition verification fails or detects a partial write, the execution engine immediately dispatches the designated saga rollback step before the agent planner can commit the step to its durable trajectory.

sources

  1. arXiv:2609.35732 — Failure-Transparent Agents: Benchmarking Post-Failure Reporting in Tool-Using Language Models (Zhu et al., September 2026)
  2. arXiv:2608.23628 — Callability Is Not Operability: Controlled Interface Interventions for LLM Agents (Wang, August 2026)
  3. arXiv:2606.07904 — Contract2Tool: Learning Preconditions and Effects for Reliable Tool-Augmented LLM Agents (Babu & Iyer, June 2026)

tags

about the author

Miles Maggio, top voice, feat. speaker, and advisor on AI agent engineering

top voice, feat. speaker, and advisor on AI agent engineering.