[Paper Review] ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedback
ToolSafe introduces TS-Bench, TS-Guard, and TS-Flow to enable proactive, step-level safety monitoring of tool invocations in LLM-based agents, reducing harmful calls up to 65% and boosting benign task completion by ~10%.
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.
Motivation & Objective
- Identify step-level signals that indicate unsafe tool invocation before execution.
- Create TS-Bench as a benchmark for step-level tool invocation safety in LLM agents.
- Develop TS-Guard as a multi-task RL-trained guardrail for pre-execution safety judgments and interpretable feedback.
- Propose TS-Flow to provide feedback-driven reasoning to guide safer and more effective tool use.
Proposed method
- Construct TS-Bench from interaction logs to label step-level safety as safe, controversial, or unsafe across four unsafe patterns (MUR, PI, HT, BTRA).
- Train TS-Guard via reinforcement learning with a multi-task reward for predicting harmfulness, attack links, and final safety label, plus a brief analysis/reasoning output.
- Use Group Relative Policy Optimization (GRPO) to optimize TS-Guard with a balanced multi-task reward.
- Develop TS-Flow as a guardrail-feedback-driven reasoning framework that provides pre-execution feedback instead of aborting tasks.
- Evaluate guardrails on step-level detection (TS-Bench) and guarded agent performance across multiple benchmarks (AgentDojo, ASB, AgentHarm).

Experimental results
Research questions
- RQ1What step-level signals in LLM-based agents indicate potentially unsafe tool invocation before execution?
- RQ2How can we train a generalizable guardrail model to detect step-level unsafe tool invocation before execution?
- RQ3How can step-level guardrails be integrated into LLM-based agents to improve safety without compromising benign task performance?
- RQ4How robust are guardrails to prompt injection and related attack vectors in real-world agent scenarios?
Key findings
- TS-Guard consistently outperforms baselines on TS-Bench across four unsafe patterns.
- TS-Flow reduces harmful tool invocations by up to 65% on average, while benign task completion improves by ~10%.
- Guardrail feedback increases agent output entropy in risky steps, promoting safety-aware exploration.
- Multi-task supervision (harmfulness, attack linkage, safety) improves F1 and reduces false positives.
- Dynamic guardrail feedback (TS-Flow) yields better safety-utility trade-offs than detect-and-abort approaches.
- Richer guardrail feedback (full TS-Guard output) further enhances safety and utility compared to using only safety ratings.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.