Invariant-Aware Harness Enforcement to Protect LLM Agents from Silent API Failures
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 against invariants that any correct API must satisfy and withholds values that break one. We find silent failures in 11 of 15 public research APIs, with counts inflated up to 691 times. Current fixes leave over 70% of answers wrong, and agents report 77.4% of counts a judge flags. Across 7 open models, SilentGuard cuts wrong answers on its target faults from 74.0% to 1.7%, with no loss on fault-free tasks. On three frontier models they fall from 70.2% to 0.5%. A warning from the same check leaves 70.1% wrong, so enforcement is the key. On new fault types, the harness alone cuts wrong answers from 61.1% to 24.5%. It avoids wrong answers by abstaining rather than recovering.
Community
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 against invariants that any correct API must satisfy and withholds values that break one. We find silent failures in 11 of 15 public research APIs, with counts inflated up to 691 times. Current fixes leave over 70% of answers wrong, and agents report 77.4% of counts a judge flags. Across 7 open models, SilentGuard cuts wrong answers on its target faults from 74.0% to 1.7%, with no loss on fault-free tasks. On three frontier models they fall from 70.2% to 0.5%. A warning from the same check leaves 70.1% wrong, so enforcement is the key. On new fault types, the harness alone cuts wrong answers from61.1%to24.5%. It avoids wrong answers by abstaining rather than recovering.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- SPRING-5: Measuring Tool Documentation Repair for LLM Agents by Efficiency (2026)
- Done Is Not Correct: Measuring Silent Failures and Self-Verification Calibration When LLM Agents Take CAD Actions (2026)
- Loud Failures, Quiet Failures: Fault Detection and Recovery in Tool-Using Language Model Agents (2026)
- When Do Summaries Become Instructions? Unsupported Policy in LLM Agents'Self-Written Handoff Summaries (2026)
- Where Does Exactly-Once Live? Model, Harness, and Tool-Contract Effects on Duplicate Side Effects in LLM Agents (2026)
- Judges Follow the Reference: The Derivation Gap in Verifying Tool-Call Arguments (2026)
- CapLite: Prompt-Injection Defense for Small Language Model Agents without Model-Written Security Artifacts (2026)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment: @librarian-bot recommend
The ablation I find most useful is the warning one: the same invariant check delivered as a warning still leaves 70.1% wrong, while enforcing it in the harness brings it to 1.7%. That fits the noticing-vs-repairing gap other agent-recovery work reports. Question: how do you handle invariants that legitimately break, e.g. an API that returns a capped page when the true count is larger? Is an abstention there counted as correct or as a miss in the 1.7% / 24.5% numbers?
Thanks for reading closely, Igor, and good question!
Capped pages. The count identity is checked on the total the API reports, not on the number of records in a page. A correct API that returns a capped page with the true total passes. The list check only compares the record count to the total when the page should hold everything, that is, when fewer records come back than the page size. What we do catch is an API that reports the page size as the total (our cap_total fault). That breaks the identity, and that's the bug we want to flag.
Invariants that break on a correct answer. These do happen when an API's logic differs from plain Boolean logic. Two examples:
Our "ignore NOT" fault fires the check even when the count may be right.
Fields that are missing on some records can make "not C" drop those rows.
In those cases SilentGuard abstains. That costs coverage but never produces a wrong answer. It's also why we only warn, and never withhold, on learned checks, since they raise false alarms more often.
Scoring. Every run gets one of three outcomes: correct, wrong or unknown (abstained). An abstention is never counted as correct and never as wrong:
Main faults: the 1.7% is the share of wrong answers, down from 74.0%. Correct answers under faults also fall, from 16.4% to 2.4%, so SilentGuard mostly abstains there rather than recovering the answer.
Clean tasks: an abstention counts as a miss, and clean accuracy stays at 84.9%, the same as with no guard.
New fault types (harness alone): wrong answers fall from 61.1% to 24.5%, and correct answers fall from 38.9% to 19.0%.
Since abstaining is the price, we also report risk against coverage. At a 25% fault rate, SilentGuard answers 67% of tasks with 3.3% of those answers wrong, while no guard answers 90% with 24.6% wrong (Figure 2).
Happy to share per-fault breakdowns if useful. They're in the appendix and in the repo.
Get this paper in your agent:
hf papers read 2611.20595 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper