Calibrating Output Contracts to Catch Confident Incorrectness at the Instruction Layer
Instruction-layer contracts catch wrong answers that look right.

Silent failure detection for AI agents in production means checking both whether a run finished and whether its results follow the agent’s instructions. Confident incorrectness passes completion and consistency checks because the agent gives a result that looks valid and shows no doubt. Output contracts at the instruction layer catch that gap by checking structural validity, business rules, and when the agent has support for an answer or must choose abstention.
Why completion metrics cannot detect confident incorrectness
Snowflake AI Research’s study separates submit rate from resolve rate and finds a sharp divergence. GPT-5 submits a patch on every run yet resolves fewer than half, while Llama 4 submits on nearly every run yet resolves fewer than one in five. On many tasks, the same wrong patch appears on every repeated run, so getting the same result each time does not show that it is correct.
The study names this pattern silent semantic failure. The output is well formed, but its meaning is wrong, and neither completion-based nor consistency-based monitoring reveals the discrepancy. A second test finds that most models edit code that is already correct. Completion metrics reward the action without distinguishing a necessary change from an unnecessary one.
Arize AI’s production analysis shows a related tool-call failure. An agent invents a plausible argument such as user_id where the schema requires customer_uuid, the database returns a valid empty result, and the agent reports a factual answer. Nothing crashes or raises an execution error. The tool’s response therefore looks like evidence about the customer when the underlying problem is the agent’s request.
Why standard uncertainty signals fail on this specific failure class
Token-level and semantic entropy detect signs that a model is unsure. Confident fabrication need not produce those signs. The Snowflake study finds that silent-failure patches are far more self-similar than variable-failure patches because the agent repeatedly derives the same wrong fix. Once the model commits to an incorrect reading, consistency reinforces the misinterpretation.
This can lead to runs that are short, confident, and consistent. Those are the very signals a reliability dashboard may treat as healthy. Arize’s analysis also describes pre-training parametric knowledge overriding retrieved context when contextual confidence falls below a threshold, leaving the model to answer confidently from memory. A stack built around completion rates, retry counts, and token-level confidence thus has no direct check that the answer follows the evidence it was given. Adding another uncertainty score does not supply that missing comparison.
What silent semantic failure costs in production contexts where agents act, not just answer
The cost grows with the irreversibility of the action. In support, finance, and CRM workflows, hallucinated tool arguments, fabricated policy responses, and wrong routing decisions can affect more than the text a user reads. Arize’s analysis documents agents fabricating refund policies to respond with empathy, producing answers that are structurally valid but violate policy.
The Outcome Monitors paper cites a production incident in which a cached HTTP error page was consumed as content and became a confident fabricated analysis. Its 2026 research found that 70% of that runtime’s silent failures were first caught by a human reading the output. Successful delivery did not establish usable evidence. The incident illustrates how an apparently ordinary tool result can contaminate the reasoning that follows it.
When an agent triggers a payment, updates a customer record, or closes a ticket, parsing success is not the relevant business outcome. A tamper-resistant trace of what the agent saw, decided, and called is the minimum audit surface for examining whether the action was correct. Arize’s analysis finds that production failures recur in trackable patterns, which makes it practical to turn those traces into explicit conditions that future results must satisfy.
What outcome contracts are and why they must be defined at the instruction layer
An output contract is a declared invariant over what an agent’s result must satisfy given its instructions. Sugam Panthi and Rabab Abdelfattah define outcome contracts as “expected relationships between tool calls and their results, mined from nominal executions or derived from public schemas”. The invariant comes from the agent’s operating context. The instruction layer is where its rules, policies, and task scope live, so contracts defined there can express correctness relative to the work the agent is authorized to perform.
Structural contracts establish the minimum viable layer. Zod, Pydantic, and JSON Schema can express requirements for fields, types, and allowed enum values. Enforcing those requirements excludes outputs that do not meet the declared structure. Yet a correctly typed customer identifier can still name the wrong customer, and a well-formed refund decision can still cite an invented policy.
A customer ID returned by the agent must exist in the database before the agent acts on it, a date extracted from a historical document must not be in the future, and a refund decision must reference a policy the agent was given. These conditions connect the result to its authorized context. Abstention contracts then define the boundary of licensed knowledge, as in “if no source in context supports this answer, respond with 'I don't know' and propose next steps”. With such a contract, declining to answer counts as a valid outcome, and taking action no longer counts as success by default.
How the Outcome Monitors architecture separates detection from recovery without overriding the agent
Outcome Monitors detect a contract violation, keep the tool result, and give the agent a nonbinding receipt that names the property that was violated and the public recovery tools. The agent retains its available action set. The monitor neither blocks actions nor selects the repair, separating the judgment that something is wrong from the decision about what to do next.
The paper reports that Outcome Monitors raise ToolMaze completion from roughly one in nine runs to more than one in four across four models in two provider families, with replication in a third. Gains concentrate where the fault blocks baseline completion. On τ-bench retail, completion improves by substantial margins on both tested tiers, with categorical violations showing the sharpest gains. These results concern recovery from detected faults.
The controls identify recovery affordances as the active ingredient. Without the recovery-tool list, the warning performs at baseline, and adding the list back brings back the gains. Neither the diagnostic detail nor when it is given makes a detectable difference. In production instrumentation, this maps to span-level checks on tool outputs and advisory signals routed to the agent or a human review queue, without silently swallowing the failure. However, detection falls sharply outside the mined contract vocabulary on a held-out incident taxonomy suite, so the architecture’s usefulness depends on what its contracts can describe.
Calibrating contracts to the vocabulary of failure your agent actually produces
A fixed schema cannot anticipate every production failure. The practical response is to grow the contract vocabulary from real execution traces rather than treating the initial invariant set as complete. The Snowflake study finds that 33 of 50 Llama 4 tasks show the same silent-failure pattern. Combined with Arize’s finding that production failures recur, that concentration makes trace analysis a focused search for repeated violations rather than an attempt to enumerate every possible mistake.
Span-level tool tracing supplies the necessary evidence. Capturing the raw JSON payload before it reaches the database exposes the argument the agent actually generated, while capturing the full tool result preserves what the agent later interprets. Those surfaces support both violation detection and the mining of new invariants. Without them, a wrong factual answer may be in view while the tool-level mismatch that caused it stays out of reach.
The calibration process should use layered detection. Deterministic checks for schema violations and known bad patterns run first, while semantic scoring by a verifier model is reserved for high-stakes outputs that trigger irreversible actions because that layer is expensive. When a production failure shows a gap in the contract vocabulary, closing the incident should include adding a new contract. The sequence is to trace the failure, identify the violated invariant, add it to the contract set, and rerun the case to establish that the new check catches the pattern.
Applying output contracts across the frameworks teams are running in production
The framework changes the placement of a contract check while the property it tests stays the same. The 2026 instrumentation baseline described here is OpenTelemetry traces from every framework call plus span-level evaluation. As of November 2026, OpenTelemetry GenAI agent spans and metrics are live but still marked Development. The semantic conventions are not yet frozen.
OpenAI Agents SDK provides built-in guardrails for input and output validation, with tracing enabled by default and sent to OpenAI’s platform. The versions specified in the source material are Python 0.24.0 and TypeScript 0.21.0. Contract checks can run as output guardrails before handoff, and hosted MCP tool support is available. This provides a validation surface, but it is distinct from the advisory-only design of Outcome Monitors. The distinction is whether the check constrains progression or informs recovery while leaving the action set intact.
Mastra provides a different place to attach checks. Its TypeScript-first graph workflows use .then(), .branch(), and .parallel(), allowing contract checks to be wired into workflow branches. The specified version, @mastra/core 1.82.0, includes native evals and observability and can author MCP servers that expose agents and tools. Vercel AI SDK instead targets TypeScript/Next.js teams adding AI features without full multi-agent orchestration. It introduced experimental MCP support in March 2025 with AI SDK 4.2 and shipped stable native MCP support in December 2025 with AI SDK 6.
Across these frameworks, the advisory instrumentation sequence stays consistent. Teams capture the raw tool result at the span level before the agent interprets it, then check it against the mined or declared invariant. On violation, they issue a signal to the agent, a Slack alert, or a human review queue without blocking the action set. The shared detection boundary is the tool result. Framework-native tracing and workflow features provide the route to that boundary, while the contract supplies the criterion for correctness.
Closing the loop from detected violation to verified fix
An alert alone leaves the repair unresolved. Contract-based evaluation can run at the session, trace, or span level, with production samples sent for human review and alerts delivered through Slack or PagerDuty. The alert should include the violated property and the trace context alongside a failure count.
Recurring violations should be grouped into issues. When a wrong-field hallucination appears on every run of the same input class, it points to a systematic instruction-layer failure that goes beyond a single malformed request. The violated invariant and failing traces can then be handed to a coding agent over MCP with enough context to propose a prompt or instruction change. The proposed fix is tested on those failing traces before it ships.
The corrected trace becomes a new eval. A real production failure is converted into a permanent regression test, so a recurrence of the same violation can be caught at the next deploy. The Snowflake study argues for test-verified correctness over repeated runs, reported uncertainty, and credit for knowing when not to act. Contract-based online evals operationalize that standard by connecting an observed violation to an explicit invariant and a tested fix. The endpoint is not an agent that merely finishes, but a result whose correctness has been checked against the rules that authorized it.


