Skip to content
AI.info

Papers

Invariant-Aware Harness Enforcement to Protect LLM Agents from Silent API Failures

SilentGuard moves API-result validation into harness-level invariants, cutting agent wrong answers on silent API faults from 74% to 1.7% with released code and data.

The paper’s first page · arXiv:2611.20595
arXiv
2611.20595 · Preprint · not peer-reviewed
Published
2026-11-16
Authors
Sajib Acharjee Dip, Brian Ouyang, Lala Motlhabi

In plain words

LLM agents answer questions by calling APIs and trusting what comes back, but an API can ignore a misnamed filter, drop a value with a typo, or silently cap a page and still return HTTP 200 with a plausible-looking wrong number.

AI summary

Overview

Research area: Natural Language Processing / LLM agent reliability, tool-use safety, and API verification.

Technical level: Intermediate. The ideas build on familiar agent concepts (tool calls, harnesses, prompting) and the paper defines its terms, but readers should be comfortable with how LLM agents call APIs and how invariant/metamorphic checks work.

Scope: The paper measures "silent API failures" — HTTP 200 responses that answer a different question than the one asked — in real and synthetic APIs, and proposes SilentGuard, a harness-level enforcement layer that tests every tool result against exact invariants and withholds values that fail.

What This Paper Is About

LLM agents answer questions by calling APIs and trusting what comes back, but an API can ignore a misnamed filter, drop a value with a typo, or silently cap a page and still return HTTP 200 with a plausible-looking wrong number. Current defenses (checklists, reviewer models, LLM judges, Outcome Monitors) all ask the model to catch the problem, and the paper shows that models often see the flag yet report the wrong value anyway. The goal is to move the decision out of the model and into the harness that runs tool calls, by checking each result against invariants any correct API must satisfy and withholding values that break them.

Key Contributions

  1. A measurement of silent failures in 15 real public APIs, covering three kinds of fault (ignored/misnamed filters, silently capped page sizes, and filters dropped due to value typos).
  2. Controlled comparisons on 7 open models that separate three ingredients — evidence (a test showing the response cannot be right), permission (a prompt allowing "cannot be determined"), and enforcement (the harness, not the model, deciding what happens to a failed result).
  3. SilentGuard, a set of invariant checks enforced by the harness that withholds results failing an exact check and only warns on results failing a learned check, with no extra model call.
  4. AgentOrchBench, a benchmark with exactly gradeable answers (counts over 400 catalog records and list answers), plus an evaluation protocol in which predictions were written down and the code hash-frozen before planned runs.

Main Findings

  • Silent failures are common in real APIs. Of 15 public research APIs, 10 returned HTTP 200 with exactly the unfiltered count and no warning for at least one plausible wrong filter name, with counts inflated up to 691 times. In all, 11 of 15 APIs showed at least one silent fault. 6 of the 14 APIs that could be tested returned fewer records than requested with no error, and 3 APIs silently dropped a filter whose value had a typo.
  • Existing fixes barely help. With no guard, agents reported a wrong count in 74.0% of faulted runs; checklist 72.3%, reviewer 73.8%, Outcome Monitors 72.2%, LLM judge 71.2%, caution prompt 73.3%, re-query 74.9%, blind retry 74.4%.
  • Agents see the problem and answer anyway. A judge shown the check's results flagged 82.4% of faulted runs (and 13.9% of clean runs), yet agents reported the flagged count in 77.4% of flagged runs and in 64.4% of warned runs. After a warning, stated confidence fell from 1.00 on clean runs to 0.43, and 40% of wrong answers mentioned the warning.
  • Evidence is necessary. A judge without the check's extra queries left 71.7% wrong as advice and 70.8% when the harness blocked on it; Outcome Monitors with blocking left 70.9%, because their contracts fired on only 3.5% of faulted runs. With evidence, the judge as advice still left 71.2% wrong, but with evidence plus blocking left 6.1%.
  • Permission helps but unevenly. A prompt allowing the answer "cannot be determined" cut wrong answers after a warning from 70.1% to 18.2%, but ranged 0–59% by model, and the same permission without evidence did nothing.
  • Enforcement is what makes it reliable. SilentGuard cut wrong answers from 74.0% to 1.7% across 7 open models (at most 4% on any model), with clean accuracy unchanged at 84.9%. It beat no guard, each published method, and blind retry on 7 of 7 models (p = 0.016).
  • Frontier models fall for the same faults. With no guard they reported wrong counts in 59.0–89.4% of faulted runs (GPT-5.6 Sol highest); SilentGuard left 0.0–1.4% wrong with clean accuracy at 98.1%, versus 70.2% to 0.5% as the aggregate reported in the abstract. Self-verification nearly stopped wrong answers (4.5%) only because clean accuracy collapsed from 92.1% to 20.4%.
  • It abstains rather than recovers. Under faults, correct answers fell from 16.4% to 2.4% while "unknown" answers rose to 95.8%. At a 25% fault rate SilentGuard answered 67% of tasks with 3.3% of answers wrong, against 90% coverage at 24.6% risk for no guard and 91% at 24.0% for the LLM judge.
  • Unseen faults are only partly covered. On six fault types written after the method was frozen, the harness alone cut wrong answers from 61.1% to 24.5% and correct answers from 38.9% to 19.0%, because its checks cannot see faults that keep the count identity true.
  • Auto-repair is dangerous. On the new fault types it returned more correct counts than SilentGuard (79 against 41) but also 102 wrong ones, and 49 of its repairs were wrong while marked as verified.
  • Gains transfer unevenly to real APIs. With deliberately misnamed filters in the documentation, wrong answers fell from 89.8% to 21.3% and correct answers rose from 3.5% to 69.5%; the spec (parameter) check alone did as well at 21.0%. The gain was 38.6% wrong on the four APIs chosen before freezing versus 7.4% on the five added later, and the check fails when filters live inside a query string or when the documentation gives a wrong value format (iNaturalist dates: 100.0% wrong versus 97.1% with no guard).
  • Other benchmarks. On a retail orders schema, wrong answers fell from 78.6% to 11.0%. On ToolMaze, where only learned checks exist, SilentGuard reached 36.0% task success under silent faults against 32.7% for checklist plus Outcome Monitors (on 5 of 7 models, 95% interval [1.8, 4.9] points), with clean success 4.6 points below Outcome Monitors. Blind retry beat SilentGuard on ToolMaze's one-time faults (60.4% versus 47.6%) and repeats a booking, payment or message 2.36 times per run versus 0.24 for SilentGuard.
  • Cost. SilentGuard makes no extra model call; per faulted run it took 18.9 s versus 47.2 s for the LLM judge, but used more tokens.

Methodology in Plain English

The researchers first probed real public research APIs (NCBI, UniProt, Europe PMC, GBIF, Zenodo, ChEMBL, arXiv, DataCite, iNaturalist and others) by sending an unfiltered query, the documented filtered query, and a few plausible wrong filter names, then comparing the returned counts.

For controlled testing they built AgentOrchBench, where an agent works from a shell using curl against eight local REST services and must count how many of 400 synthetic catalog records match two or three conditions. Because faults are injected inside the server and repeat on every call, the wrong answer is stable and the correct answer is known exactly, so grading needs no judge. Additional settings include a retail orders API with a different schema, 9 real public APIs run with correct or slightly wrong documentation, and ToolMaze (180 of its 400 workflows never used in design).

The core mechanism, SilentGuard, checks every tool result in the harness. For count queries it uses the identity N(F) + N(F_<k ∧ ¬C_k) = N(F_<k), issuing the two extra queries itself and repeating the test at every position in the condition list, so an ignored filter anywhere is caught. For lists it requires every returned record to meet the filter, no repeats, and a size matching the reported total. When an API publishes its parameter list, requests using undocumented parameters are rejected before they run. Where no exact invariant exists, it mines learned contracts (field presence, types, echoed arguments, ranges, date order) from clean responses.

A failing result is re-checked once with the same call. If it fails again, the action depends on the check's estimated false-alarm rate, α̂_j = 1/(n_j + 2), with cutoff τ = 1%: exact checks have α̂_j = 0, so the value is withheld and only checked counts may be reported (eventually answering that the count cannot be determined); learned checks only produce a warning. The harness never repairs a value itself.

The team compared this against published methods (checklist, reviewer, Outcome Monitors), baselines (no guard, caution prompt, LLM judge, self-verification, blind retry, re-query), and harness ablations (warning, warning plus recovery tip, Enforce, auto-repair). Runs used 7 open models (Phi-4, gpt-oss-120b, Gemma-3-27B, Llama-3.3-70B, Llama-4-Scout, Llama-4-Maverick, Nemotron-3-Ultra) and 3 frontier models (GPT-5.6 Sol, Terra, Luna), at most 16 turns (25 on ToolMaze) and 2,000 output tokens per turn, with open models at temperature 0.

Why This Matters

Impact on research. The paper reframes agent reliability as a harness responsibility rather than a model capability, and provides controlled evidence that detection, permission to abstain, and enforcement are separate ingredients with very different effects. It also questions evaluation practice: benchmarks that report only accuracy under faults can reward agents that guess, and the paper argues for risk-versus-coverage reporting.

Real-world applications:

  • Scientific and biomedical data retrieval: the demonstrated faults are drawn from literature, gene/protein, biodiversity and sample-catalog APIs used in research pipelines.
  • Enterprise tool-using agents: any deployment where an agent queries internal aggregation endpoints and reports totals into downstream decisions or reports.
  • Coding and operations assistants: agents that read logs, metrics or inventory counts where a wrong total is quietly plausible.
  • API and platform design: guidance to reject unknown parameters and flag truncated pages, which would eliminate a large share of the observed failures at the source.

Industry relevance. The methods require no extra model call and cost less wall-clock time per faulted run than an LLM judge (18.9 s against 47.2 s), which matters for production deployments where adding a reviewer model per call is expensive. The finding that frontier models fail at rates up to 89.4% with no guard, and that only harness enforcement is stable across model families, gives platform teams a concrete argument for putting trust decisions in infrastructure rather than prompts.

Future Directions

  • Covering self-consistent faults. Prefix matching, a "consistent lie" from the API, and filters the agent never sends all pass the count check; the paper leaves these unaddressed and suggests the three-way partition used by Rigger and Su (2020) for fields with missing values.
  • Deciding when repair is safe. Auto-repair recovers many true counts (57.3% correct on its designed faults) but marked 49 wrong repairs as verified on unseen faults; a principled way to confirm a repair would trade some of SilentGuard's abstention for coverage.
  • Extending exact checks beyond counts and lists. Table 1 lists checks for pages, ranges, sorting and writes that were specified but not tested in this work.
  • Strengthening the evidence base. The identity held on all 25 live queries tried, which the authors call a small sample, and the frontier runs were added after the planned experiments with no predictions and no releasable logs; broader replication and per-check false-alarm calibration on more APIs are open.

Target Audience

Agent framework and harness developers who decide how tool results reach a model; applied ML engineers deploying tool-using agents against real or internal APIs; API and platform owners who control how services respond to unknown parameters and truncated pages; and researchers working on tool-use robustness, verification, abstention and selective prediction, who will find the evidence/permission/enforcement decomposition and the risk-versus-coverage protocol directly reusable.

Authors’ abstract

LLM agents answer questions by calling APIs and trusting the results. An API can fail silently. It ignores part of a request, such as a misnamed filter, yet returns HTTP 200 and a plausible but wrong result. Current fixes, such as checklists, reviewer models and LLM judges, ask the model to catch it. But models often see the problem and answer anyway. We present SilentGuard, which moves the decision from the model to the harness running tool calls. It tests each result…

The full abstract on arXiv
Read the original paper

Related papers