Invariant-Aware Harness Enforcement to Protect LLM Agents from Silent API Failures
Organizations: Virginia Tech, Blacksburg, VA, USA · Genentech, South San Francisco, CA, USA
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.
Figures & tables
| Operation | Silent failure | Check that must hold | Tested |
| Exact checks | |||
| Count, filtered | filter ignored, joined with OR, capped | count identity at every position (Eq. 1 ) | ✓ |
| List, filtered | records outside the filter, repeats | each record meets the filter, no repeats, size = total | ✓ |
| Documented API | unknown parameter accepted | parameter is in the published spec | ✓ |
| One filter | filter ignored | value swap (a different value changes the result) | ✓ |
| Pages, ranges, sorting, writes | records skipped, or bound, order or update ignored | pages do not overlap, results in bound and in order, a read returns the write | |
| (a) One LLM judge | Advises | Blocks |
|---|---|---|
| Without the check’s results | 71.7 | 70.8 |
| With the check’s results | 71.2 | 6.1 |
| (b) Acting on the check | Wrong | Clean |
| No guard (no check) | 74.0 (32–87) | 84.9 |
| Warning | 70.1 (19–87) | 86.3 |
| Warning + may abstain | 18.2 (0–59) | 83.5 |
| Method | Wrong | Corr. | Unk. | Clean |
|---|---|---|---|---|
| Baselines and controls | ||||
| No guard | 74.0 7.1 | 16.4 | 9.6 | 84.9 10.6 |
| Caution prompt | 73.3 7.3 | 16.4 | 10.3 | 86.1 9.1 |
| Self-verification | 56.2 9.2 | 14.2 | 29.6 | 76.6 12.8 |
| Re-query | 74.9 5.0 | 17.0 | 8.1 | 84.7 8.6 |
| Blind retry | 74.4 5.1 | 17.3 | 8.3 | 88.3 7.4 |
| Retail domain | Wrong | Correct | Clean |
|---|---|---|---|
| No guard | 78.6 9.9 | 7.2 2.4 | 36.2 11.5 |
| Auto-repair | 15.0 4.0 | 30.5 10.0 | 35.7 11.8 |
| Enforce | 12.3 3.8 | 6.5 2.3 | 33.8 11.5 |
| SilentGuard (ours) | 11.0 2.8 | 7.1 2.0 | 38.5 11.5 |
| Real APIs (9) | Wrong | Correct | Right docs |
| No guard | 89.8 5.3 | 3.5 2.8 | 92.1 6.5 |
| Model | None | Self-v. | Warn | W+A | Enf. | Ours |
|---|---|---|---|---|---|---|
| Wrong answers under silent faults (%, ) | ||||||
| Open models | 74.0 | 56.2 | 70.1 | 18.2 | 8.8 | 1.7 |
| GPT-5.6 Sol | 89.4 | 2.5 | 11.3 | 2.3 | 31.5 | 0.0 |
| GPT-5.6 Terra | 62.3 | 3.9 | 53.9 | 35.9 | 34.0 | 0.2 |
| GPT-5.6 Luna | 59.0 | 6.9 | 63.2 | 45.1 | 36.1 | 1.4 |
| Correct on clean tasks (%, ) | ||||||
| Unseen fault | Fired | No guard | SilentGuard | Auto-repair |
|---|---|---|---|---|
| Word-stem match | 0/36 | 32/4/0 | 32/4/0 | 32/4/0 |
| NOT drops empty | 0/36 | 0/36/0 | 0/36/0 | 0/36/0 |
| Partial shard | 36/36 | 20/16/0 | 0/0/36 | 34/2/0 |
| Tag-join double | 15/36 | 36/0/0 | 21/0/15 | 36/0/0 |
| Cursor skips ties | 36/36 | 9/27/0 | 0/0/36 | 0/36/0 |
| Lossy index | 35/36 | 35/1/0 | 0/1/35 | 0/1/35 |
Appendix figures & tables30 assets
Supplementary material from the paper’s appendix.
Appendix
| Fault | API behavior | Modeled on | Check |
| Drop last | drops last filter | wrong filter name | ✓ |
| Cap total | reports at most 5 | page size as total | ✓ |
| AND OR | uses OR | query builder | ✓ |
| Ignore field | ignores any filter | unindexed field | ✓ |
| Ignore NOT | drops negation | unsupported NOT | FA |
| Off by one | count | range bug | ✓ |
| API | Returned | Correct | Over | Caught |
| Misnamed filter ignored (HTTP 200) | ||||
| ChEMBL | 2,921,148 | 4,225 | 691 | 3/3 |
| UniProtKB | 55,460 | 666 | 83 | 3/3 |
| arXiv | 186,698 | 2,799 | 67 | 2/2 |
| NCBI gene | 37,885 | 1,567 | 24 | 3/3 |
| Europe PMC | 291,095 | 15,436 | 19 | 3/3 |
| Wrong | Correct | ||||
| API | None | Retry | Ours | None | Ours |
| NCBI gene | 86 | 91 | 57 | 6 | 29 |
| UniProtKB | 80 | 83 | 40 | 6 | 51 |
| Europe PMC | 91 | 97 | 51 | 0 | 26 |
| GBIF | 94 | 91 | 6 | 0 | 94 |
| Zenodo | 100 | 91 | 3 | 0 | 83 |
| No guard | SilentGuard | Right docs | ||
| Model | Wrong | Wrong | Corr. | Corr. |
| Llama-4-Scout | 97.8 | 35.6 | 48.9 | 97.8 |
| Llama-4-Maverick | 93.3 | 6.7 | 93.3 | 100.0 |
| Llama-3.3-70B | 100.0 | 28.9 | 68.9 | 97.8 |
| gpt-oss-120b | 80.0 | 11.1 | 88.9 | 100.0 |
| Nemotron-3-Ultra | 100.0 | 20.0 | 80.0 | 100.0 |
| Misnamed | Bad filter | Page over | |
|---|---|---|---|
| API | filter | value | limit |
| NCBI gene | ignored | applied | honored |
| UniProtKB | ignored | rejected | rejected |
| ClinicalTrials.gov | rejected | rejected | capped |
| Europe PMC | ignored | ignored | rejected |
| OpenAlex | rejected | rejected | rejected |
| API | Typo in | Ignored | Over | Fired | FA |
|---|---|---|---|---|---|
| Europe PMC | query string | 5/5 | 19–40 | 5/5 | 0/5 |
| GitHub search | query string | 5/5 | 3.2–4.4 | 5/5 | 0/5 |
| iNaturalist | parameter | 5/5 | 1.1–1.5 | 5/5 | 0/5 |
| Method | Wrong | Correct | Unknown |
|---|---|---|---|
| No guard | 97.1 | 0.0 | 2.9 |
| Spec check alone | 100.0 | 0.0 | 0.0 |
| SilentGuard | 20.0 | 2.9 | 77.1 |
| Operation kind | Operations | Exact check |
|---|---|---|
| Search or list | 43 | 43 |
| Get by ID | 16 | 5 |
| Other read | 9 | 4 |
| Aggregate | 6 | 5 |
| Write | 5 | 0 |
| Pagination | 4 | 3 |
| Measure | Against | Difference [95% interval] |
| AgentOrchBench | ||
| wrong | No guard | [ , ] |
| wrong | Self-verification | [ , ] |
| wrong | LLM judge | [ , ] |
| wrong | Outcome Monitors | [ , ] |
| wrong | Blind retry | [ , ] |
| Against | Other | SilentGuard | |
|---|---|---|---|
| AgentOrchBench, seen faults (7 models) | |||
| No guard | 16.4 / 74.0 | 2.4 / 1.7 | 0.2 |
| Auto-repair | 57.3 / 3.0 | 2.4 / 1.7 | 43.6 |
| Lists, seen faults (7 models) | |||
| No guard | 43.7 / 49.3 | 21.1 / 9.1 | 0.6 |
| Auto-repair | 47.9 / 14.6 | 21.1 / 9.1 | 4.9 |
| Wrong answers by fault type | All faults | |||||||||
| Drop | Cap | AND | Ignore | Ignore | Off by | |||||
| Method | last | total | OR | field | NOT | one | Wrong | Correct | Unknown | Clean |
| No guard | 89.7 | 92.9 | 89.3 | 77.4 | 6.2 | 88.9 | 74.0 7.1 | 16.4 1.8 | 9.6 8.7 | 84.9 10.6 |
| Caution prompt | 88.3 | 91.3 | 87.7 | 75.4 | 4.6 | 92.9 | 73.3 7.3 | 16.4 2.2 | 10.3 9.3 | 86.1 9.1 |
| LLM judge | 88.7 | 91.7 | 84.7 | 73.0 | 6.2 | 82.9 | 71.2 7.8 | 17.4 2.1 | 11.4 9.7 | 86.5 8.5 |
| Checklist | 87.7 | 90.7 | 87.7 | 73.4 | 4.8 | 89.3 | 72.3 8.1 | 16.2 2.2 | 11.5 10.3 | 84.1 10.6 |
| AgentOrchBench | Wrong | Correct | Unknown | Clean |
|---|---|---|---|---|
| No guard | [56.8, 91.3] | [11.9, 20.9] | [0.0, 30.8] | [59.1, 100.0] |
| Caution prompt | [55.5, 91.2] | [11.1, 21.6] | [0.0, 33.1] | [63.9, 100.0] |
| Self-verification | [33.6, 78.8] | [9.2, 19.2] | [2.4, 56.7] | [45.4, 100.0] |
| Re-query | [62.6, 87.1] | [12.6, 21.4] | [0.0, 24.7] | [63.6, 100.0] |
| Blind retry | [62.0, 86.9] | [13.9, 20.7] | [0.0, 24.1] | [70.1, 100.0] |
| LLM judge | [52.1, 90.3] | [12.2, 22.5] | [0.0, 35.2] | [65.8, 100.0] |
| Model | None | Check. | Rev. | OM | Judge | Retry | Self-v. | Enf. | Ours |
|---|---|---|---|---|---|---|---|---|---|
| Llama-4-Scout | 86.6 | 79.2 | 79.6 | 81.2 | 83.6 | 78.0 | 79.6 | 7.2 | 2.1 |
| Llama-4-Maverick | 80.8 | 80.3 | 79.9 | 79.6 | 80.1 | 80.1 | 36.3 | 0.5 | 0.5 |
| Llama-3.3-70B | 80.6 | 80.8 | 80.6 | 80.6 | 78.7 | 80.3 | 69.2 | 1.2 | 0.0 |
| gpt-oss-120b | 80.8 | 80.6 | 79.8 | 80.8 | 74.1 | 80.8 | 53.5 | 24.8 | 1.2 |
| Nemotron-3-Ultra | 80.6 | 80.6 | 80.6 | 80.6 | 79.9 | 80.6 | 78.5 | 12.0 | 3.7 |
| Gemma-3-27B | 76.9 | 81.0 | 76.2 | 78.9 | 77.3 | 77.3 | 63.9 | 6.5 | 3.5 |
| AgentOrchBench (wrong ) | ToolMaze (success ) | |||||
|---|---|---|---|---|---|---|
| Model | None | Ours | C+OM | Ours | ||
| Llama-4-Scout | 86.6 | 2.1 | 31.7 | 38.6 | ||
| Llama-4-Maverick | 80.8 | 0.5 | 38.9 | 45.6 | ||
| Llama-3.3-70B | 80.6 | 0.0 | 36.9 | 38.6 | ||
| gpt-oss-120b | 80.8 | 1.2 | 38.6 | 35.6 | ||
| Nemotron-3-Ultra | 80.6 | 3.7 | 31.9 | 37.5 | ||
| Method | P3 | P4 | P3+P4 | P0 | P1+P2 |
|---|---|---|---|---|---|
| Checklist | 26.8 4.3 | 19.5 2.6 | 23.2 3.3 | 55.5 4.1 | 38.3 4.2 |
| Outcome Monitors | 36.3 2.2 | 24.8 1.6 | 30.5 1.3 | 57.1 3.6 | 40.7 2.2 |
| Checklist + OM | 39.9 3.1 | 25.6 2.0 | 32.7 2.2 | 54.8 4.1 | 39.8 2.6 |
| Blind retry | 60.4 3.1 | 27.0 1.4 | 43.7 1.7 | 54.2 2.6 | – |
| SilentGuard | 47.6 3.7 | 24.4 1.5 | 36.0 2.5 | 52.5 4.2 | 39.8 2.9 |
| ToolMaze success | Real APIs | Repeated | |||
|---|---|---|---|---|---|
| Harness | 1-call fault | 2-call fault | Lasting | wrong | actions |
| No re-check | 39.9 | 32.5 | 25.6 | – | – |
| Blind retry | 60.4 | 56.0 | 27.0 | 89.5 | 2.36 |
| SilentGuard | 47.6 | 46.4 | 24.4 | 21.3 | 0.24 |
| Model | No re-check | Blind retry | SilentGuard |
|---|---|---|---|
| Llama-4-Scout | 32.8 | 60.0 | 50.6 |
| Llama-4-Maverick | 31.7 | 56.1 | 47.2 |
| Llama-3.3-70B | 32.2 | 66.1 | 57.2 |
| gpt-oss-120b | 36.4 | 51.2 | 43.4 |
| Nemotron-3-Ultra | 38.9 | 65.6 | 53.9 |
| Gemma-3-27B | 12.2 | 34.4 | 22.8 |
| Method | Wrong | Correct | Unknown | Right docs |
|---|---|---|---|---|
| No guard | 89.8 5.3 | 3.5 2.8 | 6.0 4.6 | 92.1 6.5 |
| Blind retry | 89.5 5.8 | 3.2 2.5 | 4.8 3.7 | 93.0 5.5 |
| Value-swap check alone | 17.8 2.5 | 25.7 11.4 | 55.2 12.8 | 91.1 7.8 |
| Spec check alone | 21.0 4.6 | 70.8 6.8 | 7.0 4.6 | 92.1 6.5 |
| SilentGuard | 21.3 3.8 | 69.5 7.5 | 7.9 4.9 | 92.4 7.3 |
| AgentOrchBench | Retail | |||||
|---|---|---|---|---|---|---|
| Harness action | Wrong | Correct | Unknown | Clean | Wrong | Clean |
| Warning (last condition) | 63.1 | 11.4 | 25.4 | 85.5 | 71.5 | 35.7 |
| Warning | 70.1 | 14.1 | 15.9 | 86.3 | – | – |
| Warning + tip | 37.2 | 9.8 | 52.9 | 82.5 | 59.6 | 36.9 |
| Auto-repair | 3.0 | 57.3 | 39.7 | 83.3 | 15.0 | 35.7 |
| Answer gate (last condition) | 32.9 | 5.2 | 61.9 | 84.9 | – | – |
| Seen faults | Unseen faults | Clean | |||
|---|---|---|---|---|---|
| Method | Wrong | Corr. | Wrong | Corr. | Corr. |
| No guard | 49.3 | 43.7 | 37.8 | 56.7 | 80.5 |
| Auto-repair | 14.6 | 47.9 | 16.9 | 37.5 | 81.0 |
| Checked lists only | 11.2 | 22.1 | 11.7 | 7.5 | 81.0 |
| SilentGuard | 9.1 | 21.1 | 11.5 | 7.1 | 84.8 |
| Tool | Time | Extra LLM | ||
|---|---|---|---|---|
| Method | calls | Tokens | (s) | calls |
| No guard | 2.0 | 3,183 | 9.2 | 0.0 |
| Caution prompt | 2.0 | 3,734 | 11.3 | 0.0 |
| LLM judge | 3.2 | 6,287 | 47.2 | 2.0 |
| Checklist | 1.9 | 3,429 | 8.7 | 0.0 |
| Reviewer | 1.9 | 9,276 | 25.0 | 2.6 |
| Greedy decoding | Sampling, , 3 seeds | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Model | Training | Seen | Unseen | Consistent lie | Reworded | Clean | Seen | Unseen | Clean |
| Phi-4-mini | Base model | 100.0 | 73.3 | 100.0 | 100.0 | 86.7 | 57.8 | 72.8 | 25.6 |
| Phi-4-mini | SFT to refuse (trained on drop-last) | 0.0 | 6.7 | 100.0 | 0.0 | 100.0 | 0.0 | 6.1 | 100.0 |
| Phi-4-mini | SFT to repair | 0.0 | 45.3 | 100.0 | 0.0 | 100.0 | 1.1 | 90.0 | 100.0 |
| Phi-4-mini | RL (DAPO, false-equation penalty) | 0.0 | 28.7 | 100.0 | 0.0 | 100.0 | 0.0 | 59.4 | 100.0 |
| Mistral-7B | Base model | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 2.2 | 1.1 | 0.0 |
| Cutoff | Min. support | Withheld (%) | Changed |
|---|---|---|---|
| 0.1% | 998 | 0.0 | 0 |
| 0.5% | 198 | 0.0 | 0 |
| 1% | 98 | 0.0 | 0 |
| 2% | 48 | 4.4 | 108 |
| 5% | 18 | 34.6 | 847 |
| 10% | 8 | 73.0 | 1,788 |
| Extra queries | Seen faults | Check-aware | |||
|---|---|---|---|---|---|
| Positions checked | clean | faulted | caught | wrong | caught |
| No check | 0.0 | 0.0 | 0.0 | 80.6 | 0.0 |
| Last condition only | 2.0 | 2.0 | 88.0 | 8.8 | 0.0 |
| 1 random condition | 2.0 | 2.0 | 88.4 | 8.6 | 0.9 |
| 2 random conditions | 4.0 | 4.0 | 94.4 | 2.8 | 1.9 |
| All, stop at first failure | 5.2 | 2.3 | 97.2 | 0.0 | 2.8 |
| ID | Prediction, written before the run | Observed | Outcome |
|---|---|---|---|
| A1 | SilentGuard blind retry on lasting faults (ToolMaze P4) | 24.4 vs 27.0 | failed |
| A2 | SilentGuard blind retry on one-time faults (P3) | 47.6 vs 60.4 | failed |
| A3 | Blind retry repeats action calls | 2.36 vs 0.24 per run | held |
| B1 | Loud faults: SilentGuard within 3 points of Checklist + OM | 39.8 vs 39.8 | held |
| C1 | AgentOrchBench wrong within 5 points of Enforce | 1.7 vs 8.8 | failed |
| C2 | AgentOrchBench correct answer gate | 2.4 vs 5.2 | held |
Runtime Enforcement for AI Agents
Runtime enforcement for AI agents checks and constrains actions as they execute, helping prevent unsafe or unauthorized effects.
See all 312 papers