ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedback

Yutao Mou, Zhangchi Xue, Lijun Li, Peiyang Liu, Shikun Zhang +2 more
1/15/2026
cs.CL

No official code found. Best implementation: MurrayTom/ToolSafe (74 stars, last commit 2026-03-25).

Abstract

While LLM-based agents can interact with environments via invoking external tools, their expanded capabilities also amplify security risks. Monitoring step-level tool invocation behaviors in real time and proactively intervening before unsafe execution is critical for agent deployment, yet remains under-explored. In this work, we first construct TS-Bench, a novel benchmark for step-level tool invocation safety detection in LLM agents. We then develop a guardrail model, TS-Guard, using multi-task reinforcement learning. The model proactively detects unsafe tool invocation actions before execution by reasoning over the interaction history. It assesses request harmfulness and action-attack correlations, producing interpretable and generalizable safety judgments and feedback. Furthermore, we introduce TS-Flow, a guardrail-feedback-driven reasoning framework for LLM agents, which reduces harmful tool invocations of ReAct-style agents by 65 percent on average and improves benign task completion by approximately 10 percent under prompt injection attacks.

View on arXivView PDF

Code Implementations(1)

MurrayTom/ToolSafeCommunity76%

Official Implementation of "ToolSafe: Enhancing Tool Invocation Safety of LLM-based Agents via Proactive Step-level Guardrail and Feedback"

745Shell, PythonJan 8, 20266 months ago

Similar Papers

Cite this paper

@article{mou2026toolsafe,
  title  = {ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedback},
  author = {Yutao Mou and Zhangchi Xue and Lijun Li and Peiyang Liu and Shikun Zhang and Wei Ye and Jing Shao},
  year   = {2026},
  eprint = {2601.10156},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.10156v1}
}

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/2601.10156.svg)](https://codeofpaper.com/paper/2601.10156)

Discussion