LEANGUARD: Lean-Verified Guardrails for Tool-Using Agents

Sreehari Sankar, Debargha Ganguly, Vikash Singh, Mohsen Hariri, Weicong Chen +15 more
11/2/2026
cs.AIcs.CL

No confident code implementation found for this paper.

Abstract

Tool-using language-model agents often execute actions that their domain policies forbid. We present LeanGuard, a runtime that checks every proposed tool call against a policy written in Lean4 before the call reaches the environment.

Show full abstract

Policies combine state predicates with scoped past-time temporal operators over the execution history, evaluation is fail-closed, and the decision procedure is proved equivalent to a LeanLTL semantics. A denied call can be corrected in two ways. With feedback, the agent receives the violated rule and a hint; with proof-guided repair, Lean metaprogramming searches for a nearby call that preserves the user's intent and proves that the policy admits it, without the model. On Tau-Bench with five Qwen models (0.8B-27B), unguarded agents execute at least 33 calls that the Lean policy forbids, while LeanGuard executes none; with feedback, task success does not change significantly. On DTap, LeanGuard reduces direct prompt-injection success from 57.9% to 5.9%, and in telecom, where benign tasks need no writes, benign success is unchanged. Feedback reduces repeated blocked calls and raises task success for four of five models over a bare denial. On replayed denials, repair proves an admissible edit for 88 of 252 denials caused by argument values, in a median of 2,ms.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{sankar2026leanguard,
  title  = {LEANGUARD: Lean-Verified Guardrails for Tool-Using Agents},
  author = {Sreehari Sankar and Debargha Ganguly and Vikash Singh and Mohsen Hariri and Weicong Chen and Yanyan Zhang and Shouren Wang and Wang Yang and Chaoda Song and Alexander Nemecek and Osama Zafar and Idan Davidovich and Yuting Shao and Kai Ye and Biyao Zhang and Xinpeng Li and Joe Stubbs and Erman Ayday and Jing Ma and Vipin Chaudhary},
  year   = {2026},
  eprint = {2611.02332},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.02332v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.02332.svg)](https://codeofpaper.com/paper/2611.02332)

Discussion