ToolGate: Contract-Grounded and Verified Tool Execution for LLMs

Yanming Liu Xinyue Peng Jiannan Cao Xinyi Wang Songhang Deng, Jintao Chen Jianwei Yin Xuhong Zhang · 2026

Read ToolGate: Contract-Grounded and Verified Tool Execution for LLMs by Yanming Liu Xinyue Peng Jiannan Cao Xinyi Wang Songhang Deng, Jintao Chen Jianwei Yin Xuhong Zhang (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-04688.txt.

Introduction

Yanming Liu and seven co-authors put language model tool use under contract law, in a 2026 arXiv paper. Tool-augmented models decide in free-form reasoning when to call a tool and whether to believe what comes back, which leaves no formal guarantee that a hallucinated result will not poison everything downstream. ToolGate replaces that looseness with verified execution.

The framework keeps an explicit symbolic state — a typed key-value store of trusted facts — and formalizes every tool as a Hoare-style contract with a precondition and a postcondition. The precondition gates the call: the current state must provably satisfy it. The postcondition gates the commit: the tool's output is runtime-verified before it may update the state. State therefore evolves only through verified steps. Experiments show significantly better reliability and verifiability on complex multi-step reasoning tasks, at competitive performance, giving tool-using systems an audit trail by construction.

Catalog record

CREATORYanming Liu Xinyue Peng Jiannan Cao Xinyi Wang Songhang Deng, Jintao Chen Jianwei Yin Xuhong Zhang
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE65 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-04688

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

ToolGate: Contract-Grounded and Verified Tool Execution for LLMs Yanming Liu Xinyue Peng Jiannan Cao Xinyi Wang Songhang Deng, Jintao Chen Jianwei Yin Xuhong Zhang Abstract Large Language Models (LLMs) augmented with external tools have demonstrated remarkable capabilities in complex reasoning tasks. However, existing frameworks rely heavily on natural language reasoning to determine when tools can be invoked and whether their results should be committed, lacking formal guarantees for logical safety and verifiability. We present ToolGate , a forward execution framework that provides logical safety guarantees and verifiable state evolution for LLM tool calling. ToolGate maintains an explicit symbolic state space as a typed key-value mapping representing trusted world information throughout the reasoning process. Each tool is formalized as a Hoare-style contract consisting of a precondition and a postcondition, where the precondition gates tool invocation by checking whether the current state satisfies the required conditions, and the postcondition determines whether the tool’s result can be committed to update the state through runtime verification. Our approach guarantees that the symbolic state evolves only through verified tool executions, preventing invalid or hallucinated results from corrupting the world representation. Experimental validation demonstrates that ToolGate significantly improves the reliability and verifiability of tool-augmented LLM systems while maintaining competitive performance on complex multi-step reasoning tasks. This work establishes a foundation for building more trustworthy and debuggable AI systems that integrate language models with external tools. 1 Introduction Large Language Models (LLMs) have achieved remarkable success in various reasoning tasks, particularly when augmented with external tools that enable them to interact with the real world 35 ; 1 ; 2 . The integration of tools with LLMs has opened new possibilities for complex multi-step reasoning, where models can retrieve information, perform computations, and execute actions through API calls 24 . However, existing frameworks for LLM tool calling rely heavily on natural language reasoning to determine when tools should be invoked and whether their results should be trusted and committed to the system’s understanding of the world 33 . This reliance on implicit natural language reasoning creates challenges for ensuring logical safety, verifiability in tool-augmented LLM systems. The fundamental problem lies in the lack of formal guarantees for tool invocation and result validation. Current approaches treat tool calling as a black-box process where the LLM decides based on its internal reasoning, without explicit mechanisms to verify whether the preconditions for tool invocation are satisfied or whether the tool’s output meets the expected postconditions 41 ; 27 . This can lead to several critical issues: tools may be called with insufficient or incorrect parameters, invalid results may be incorporated into the reasoning process, and the system’s internal representation of the world state may become inconsistent or corrupted by hallucinated or erroneous tool outputs 10 . Moreover, as the number of available tools grows into the thousands, efficiently retrieving and selecting appropriate tools becomes increasingly challenging, requiring sophisticated retrieval mechanisms beyond simple keyword matching 31 . Recent approaches still lack a unified framework that provides formal guarantees for when tools can be safely invoked and when their results can be trusted. The absence of explicit state management and contract-based verification means that errors can propagate through the reasoning chain, making it difficult to identify and debug failures in complex multi-step tool-calling scenarios. To address these limitations, we propose ToolGate , a forward execution framework that provides logical safety guarantees and verifiable state evolution for LLM tool calling. ToolGate introduces an explicit symbolic state space that maintains a typed key-value mapping representing trusted world information throughout the reasoning process. Each tool is formalized as a Hoare-style contract with a precondition that gates tool invocation and a postcondition that determines whether the tool’s result can be committed to update the state. By combining Retrieval with embedding semantic search for efficient tool retrieval and hoare contract logical checks for safe tool execution, ToolGate ensures that the symbolic state evolves only through verified tool executions, preventing invalid or hallucinated results from corrupting the world representation. Our Contributions. Our contributions are detailed as follows. • We present ToolGate, a novel framework that formalizes tool calling through Hoare-style contracts, providing logical safety guarantees and verifiable state evolution for LLM tool-augmented systems. • We introduce an explicit symbolic state space that maintains trusted world information throughout reasoning, enabling precise precondition and postcondition checking for tool invocations. • We demonstrate that contract-based verification significantly improves the reliability and debuggability of tool-augmented LLM systems while maintaining competitive performance on complex multi-step reasoning tasks. 2 Related Work 2.1 Tool Learning of LLMs The integration of external tools with Large Language Models has emerged as a critical capability for extending LLM reasoning beyond text generation to real-world interactions. Early work on function calling, such as OpenAI’s function calling API, enables LLMs to invoke external functions with structured parameters 20 . The ReAct framework formalizes the reasoning-acting paradigm, where LLMs explicitly alternate between reasoning steps and tool invocations, demonstrating improved performance on complex multi-step reasoning tasks 33 . Building on this foundation, Tool Learning has emerged as an effective paradigm for significantly expanding the capabilities of Large Language Models 26 ; 25 ; 37 . Early research proposed that by integrating LLMs with external tools—such as program executors or search engines 5 ; 21 . To comprehensively measure performance in tool usage, researchers have introduced a series of benchmarks to systematically evaluate dimensions ranging from API selection and parameter generation quality to generalization capabilities 36 ; 22 ; 4 . These techniques have been extended to multimodal tasks like GUI Agents 38 ; 15 and specialized domains 28 . More recently, Reinforcement Learning (RL) has been incorporated into the framework to further optimize tool-learning performance 23 ; 12 , yielding significant results in information retrieval and dynamic reasoning. These developments demonstrate that tool-augmented LLMs are revealing vast potential for open-domain general reasoning. 2.2 Hoare Logic and Formal Verification Hoare logic 9 provides a formal system for reasoning about program correctness through preconditions and postconditions. In recent years, Formal Verification and Hoare logic has been increasingly introduced into the field of deep learning to characterize and constrain the provable behaviors of neural network systems under different inputs and internal states 3 . As deep learning models are being widely deployed in high-risk and safety-critical domains such as autonomous driving, robotics control, medical decision-making, and industrial systems, ensuring that model outputs are not only effective but also verifiable and compliant with predefined specifications has become an increasingly important problem 18 ; 29 . In this context, the precondition–postcondition framework provided by Hoare logic is used to specify the functional, safety, or robustness properties that neural networks must satisfy under given input conditions or first-order logic 34 ; 8 , and it is further combined with neural network verification and LLMs to form a unified and rigorous approach to reasoning and verification 11 ; 7 ; 30 ; 13 . 3 Methodology 3.1 Problem Setting and Overview Tool learning equips LLMs with the ability to plan, invoke, and reason over external tools. However, hallucination propagation and unreliable tool planning remain major bottlenecks, frequently leading to unstable and unreliable outcomes. To address these problems, we propose ToolGate , a framework integrates both probabilistic reasoning foundations and

Read the complete text