arXiv:2610.17039cs.CLOct 2026

Manuscript Offprint

arXiv:2610.17039

MENTOR: Procedural Shielding of Tool-Using LLM Agents

Ashwani Anand, Ivi Chatzi, Ritam Raha, Anne-Kathrin Schmuck

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Tool-using LLM agents are increasingly used to automate workflows governed by procedural manuals, such as company rules for booking travel or procuring hardware. These manuals are written in natural language for humans and describe general requirements over such complex workflows. Ensuring compliance of LLM agents with these manuals is difficult, and state-of-the-art techniques use either LLM judges or manually written rules to forbid problematic tool-calls locally at runtime. This is insufficient because (i) only blocking tool calls keeps the agent clueless about how to make correct progress towards fulfilling its task, and (ii) can lead to overly conservative behavior of the agent, as tool calls might only be problematic in certain contexts. To overcome these challenges, we introduce MENTOR, which (i) additionally provides guidance for the agent to make procedural-compliant progress on the task, and (ii) ensures that this compliance is context-aware. We achieve these goals by building a novel history-dependent runtime shield that is obtained from the procedural manual via a multi-step autoformalization pipeline. At its core, MENTOR utilizes a game-based technique to ensure robustness against runtime uncertainty without over-restricting agents' behavior. This yields a formally assisted framework for procedural shielding of LLM agents that improves compliance well beyond existing methods. In particular, MENTOR lifts the compliance of shielded light-weight open-source LLMs above that of non-shielded proprietary models. Since a shield is synthesized once per manual and then serves every task, a MENTOR-shielded agent becomes a viable choice for repeatedly executed workflows, potentially reducing deployment costs when the offline construction cost is amortized over repeated tasks.

1 INTRODUCTION

The abilities of tool-using large language model (LLM) agents allow them to be used to automate workflows such as hardware procurement (Zdravković et al., 2022; Ozman, 2025), patient diagnosis (Tu et al., 2025; Ghezloo et al., 2025) or travel bookings (Dwivedi et al., 2025). Such workflows are governed by procedural manuals, written in natural language for human operators, that specify how such tasks must be executed. For example, Fig. 1 (top right) shows a simple manual for booking a business trip.

While such workflows may seem natural for humans, LLM agents have been observed to struggle with them, both in existing work about evaluating compliance post-hoc (Li et al., 2025; Nandi et al., 2026; Anand et al., 2026a), and in our own experiments. For instance in the domain of Fig. 1, checking agents' tool call traces reveals they often attempt to book business class after inventing a fake "urgent reason", or never book anything at all.

To aid LLM agents in such tasks, we introduce MENTOR, a procedural shield that checks proposed tool calls against formalized requirements and guides agents towards fulfilling outstanding obligations. Shielding is a well-established technique for policies obtained by reinforcement learning (RL), where a shield monitors the actions a policy proposes at runtime and blocks those that violate a formal specification (Könighofer et al., 2022; Hsu et al., 2024). We develop this approach for tool-using LLM agents around four interconnected challenges.

∗^{*}Equal contribution.

Figure

Figure 1: Running example. Our procedural shield MENTOR is generated from a procedural manual (top right) and applied to a travel-booking task (top left). MENTOR shields the interaction between an LLM agent (pink) and the environment (brown). MENTOR blocks tool calls (red), allows tool calls (green), and provides guidance towards task completion (orange).

⟨C1⟩\langle C1\rangle Context-dependence & guidance. A procedural manual, as e.g. the one in Fig. 1, induces a partial temporal order over tool calls, so whether a tool call complies is context-dependent (e.g., booking a flight is allowed in step 5 but not in step 2). This context-dependence introduces obligations an agent needs to fulfill before another necessary call would be allowed (e.g., checking the distance before any booking) and it must eventually make some specific tool calls to complete its task (e.g., the booking itself). Blocking a call without identifying a compliant next step can leave the agent repeatedly attempting blocked calls and failing to complete its task, as illustrated by our experiments (Fig. 5 in App. A.2). Shields that also incorporate context-dependent progress guidance were only recently introduced for RL as strategy template based runtime shields (STARS) (Anand et al., 2026b). MENTOR adapts this idea to LLM agents, by first auto-formalizing the manual into Linear Temporal Logic (LTL) and then synthesizing a strategy template from it.

⟨C2⟩\langle C2\rangle Argument-based constraints. Context-dependence does not only affect the order of tool calls, but also their arguments. For example, booking an economy class flight is allowed without an urgent reason in step 5, whereas booking business class is not in step 4. The values these arguments can take often range over unbounded domains, such as strings, and might only be revealed at runtime, making it challenging to express constraints over them. The importance of checking argument values is illustrated by our analysis of SOP-Bench (Nandi et al., 2026), whose evaluator accepts some incorrect traces because it does not check the relevant tool arguments (App. C.3). MENTOR addresses this problem with argument constraints using Satisfiability Modulo Theories (SMT) that are checked and, if violated, repaired at runtime.

⟨C3⟩\langle C3\rangle Natural language. Any formally assisted framework for procedural shielding of LLM agents needs to translate natural language texts within the manual, the task description, and tool outputs into formal artifacts. In our work, we automatically translate the manual into a formal specification offline. Then, at runtime, we observe that both cheap proprietary LLMs and fine-tuned small open-weights LLMs can effectively ground the task description and tool outputs.

⟨C4⟩\langle C4\rangle Delivering the shield. A classical shield for an RL policy intervenes directly on the action the policy proposes. In the context of LLM agents, however, actions are tool calls which are written token by token. Depending on the availability of the agent's next-token distribution, MENTOR can deliver the blocking and advice of tool calls to the agent in two ways: (i) via a prompt shield that injects textual feedback in the tool call outputs, and (ii) via a token shield, which masks the tokens of unsafe calls and boosts those of progressing calls during generation.

To show its impact on procedural compliance of shielded agents, we evaluate MENTOR on 3 benchmarks covering 8 domains using both proprietary and open-weights agents. The experiments show that MENTOR clearly outperforms unshielded agents and other guarding methods, and lifts the compliance of small open-weight models above those of unshielded proprietary ones. We provide all our code and parameters at https://anonymous.4open.science/r/mentor-llm-shield/.

Related Work. Shielding LLM agents has received increasing attention very recently, but none of the existing approaches addresses the outlined challenges appropriately. We compare them here and in Table 2 in App. A in more detail.

Figure

Figure 2: Overview of MENTOR. Manual and tool schema are formalized into an LTL-based template and an SMT-based solver (offline, top right), used to shield every tool call (online, left) by deterministically evaluating (bottom right) if tool calls are safe and progressing (violet, LTL), and use correct arguments (blue, SMT); unsafe and non-progressing calls receive advice (orange).

One line of work on LLM shielding techniques delegate compliance decisions to a guardrail LLM (Xiang et al., 2024; Hoover et al., 2026; Kang et al., 2026) which can interpret natural language ( ⟨C3⟩\langle C3\rangle) within the manual, tasks, and tool outputs. However, the resulting judgements can be unreliable due to the stochastic nature of LLMs. Alternatively, deterministic guards hard-code procedural constraints, which are either written by hand in a dedicated language (Wang et al., 2026; Winston et al., 2026; Palumbo et al., 2026; Reddy et al., 2026; Kamath et al., 2025) or extracted by an LLM (Shi et al., 2025; Mondl et al., 2026). Such deterministic guards, however, cannot interpret natural language tool outputs during their execution. As a result, they cannot provide rich enough context-dependent guidance to the agent ( ⟨C1⟩\langle C1\rangle). In addition, manually translating the procedural manual into formal constraints can make shield synthesis labor intensive and hard to extend to new domains, and this task is known to be difficult even for experts (Czepa et al., 2019; Greenman et al., 2023). MENTOR combines the strengths of both approaches by using a refinement-based auto-formalization technique to build a deterministic tool-call evaluator which is paired with a labeler to ground tool call outputs.

LTL was recently proposed as the right formalism to capture procedural dependencies (Anand et al., 2026a; Aminof et al., 2026), and translating natural language into LTL is well studied (Chen et al., 2023; Cosler et al., 2023; Fuggitti et al., 2023; Liu et al., 2023; Ma et al., 2025; Wang et al., 2025). However, none of the above work used LTL in the context of shielding LLM agents. In addition, LTL constraints are propositional and cannot express numeric ranges or unbounded argument domains ( ⟨C2⟩\langle C2\rangle). Auto-generated SMT-based constraints have so far only served post-hoc verification (An et al., 2025; Anand et al., 2026a), not runtime shielding.