Skip to content

ToolSafe proposes step-level guardrails TS-Guard and TS-Flow to reduce harmful tool calls by agentsToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedback

arXiv· arXiv:2601.10156· Findings of ACL 2026· Yutao Mou, Zhangchi Xue, Lijun Li, Peiyang Liu, Shikun Zhang, Wei Ye, Jing Shao·Indexed by this site · 2026-10-01· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

Mou et al. propose TS-Bench, TS-Guard, and TS-Flow, performing step-level tool call safety detection before execution and using feedback to guide ReAct agents.

Threat modelThe victim system is a ReAct-style LLM agent interacting with the environment through tools. Risks come from malicious user requests and third-party prompt injection during benign task execution; manifestations include calling harmful tools or passing risky parameters to benign tools. The guardrail makes step-level judgments before candidate action execution based on user request, interaction history, and tool descriptions, without modifying the base model.

Questions
LLM agents calling external tools amplify safety risks, while existing guardrails mostly do static content review or rely on full trajectories, lacking pre-execution step-level intervention.
Methods
The authors construct step-level detection benchmark TS-Bench, train TS-Guard with multi-task GRPO to simultaneously judge request harmfulness, attack association, and action safety and provide feedback; TS-Flow returns feedback to the ReAct agent to correct actions rather than directly terminating.
Experiments and results
The authors say TS-Guard overall outperforms the listed baselines on the strict setting of TS-Bench. The authors say TS-Flow on average reduces harmful tool calls by 65%, and improves benign task completion by about 10% under prompt injection; in Table 4 it preserves Utility better than detect-and-abort.
Limitations and future work
The authors note that when guardrail feedback is directly concatenated into the context, agents sometimes do not adopt it sufficiently; the agent and guardrail trained separately may make reasoning and safety judgments inconsistent, and they plan joint training or tighter coupling. Latency is only called acceptable in the main text and referred to Appendix H.
Experimental setupGPT-4o、TS-Guard et al. · TS-Bench、AgentHarm-Traj et al. · ACC、F1 et al.
Evaluated models
GPT-4oTS-GuardQwen2.5-14B-Instruct
Benchmarks
TS-BenchAgentHarm-TrajASB-TrajAgentDojo-TrajAgentDojoASBAgentHarm
Metrics
ACCF1RecallASRUtilityRefusal RateTask Completion Score
AI summaryToolSafe proposes a step-level guardrail solution for tool call safety in LLM agents, including benchmark TS-Bench, guardrail model TS-Guard, and reasoning framework TS-Flow. TS-Guard is trained with multi-task reinforcement learning, reasons based on interaction history before execution, evaluates request harmfulness and action-attack association, and outputs interpretable, generalizable safety judgments and feedback. TS-Flow is driven by guardrail feedback, reducing harmful tool calls of ReAct-style agents by an average of 65% under prompt injection attacks, while improving benign task completion rate by approximately 10%. The authors state the work is still in progress and code is publicly available.

ToolSafe proposes a step-level guardrail solution for tool call safety in LLM agents, including benchmark TS-Bench, guardrail model TS-Guard, and reasoning framework TS-Flow. TS-Guard is trained with multi-task reinforcement learning, reasons based on interaction history before execution, evaluates request harmfulness and action-attack association, and outputs interpretable, generalizable safety judgments and feedback. TS-Flow is driven by guardrail feedback, reducing harmful tool calls of ReAct-style agents by an average of 65% under prompt injection attacks, while improving benign task completion rate by approximately 10%. The authors state the work is still in progress and code is publicly available.

Related events and news

1 events · 1 news mentions

News that mentions this paper

北大与微信安全团队发布通用智能体全生命周期安全综述

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    To perform step-level safety detection before tool execution, and use feedback to reduce harmful calls while preserving benign tasks.

    LLM agents lack generalizable safety monitoring before each tool call execution, and direct termination after detection harms benign tasks.

    • Scenario: The authors argue that agents act directly on the environment through external tools, amplifying safety risks. Even aligned LLMs may fail to generalize safety guarantees to harmful requests in agents; attackers can also use prompt injection or backdoors to induce unsafe actions. Unlike chatbots, tool call safety is critical for deployment.
    • Existing shortcomings: The authors state that existing guardrail models mainly perform static input-output review and struggle to reason about dynamic tool calls. Agent-oriented guardrails often rely on complete action plans or execution trajectories, while autonomous agents need timely intervention at each tool call step. "Detect-then-terminate" approaches like LlamaFirewall disrupt benign tasks when normal instructions are mixed with injected signals.
    • Core observation: After analyzing interaction logs from four types of agent safety data, the authors believe unsafe tool calls can be characterized along two dimensions: trigger cause is malicious user request or third-party prompt injection, and manifestation is calling harmful tools or passing risky parameters to benign tools. These four patterns can be identified from interaction history and used for pre-execution risk assessment.
    • This paper proposes: Step-level tool call safety detection benchmark TS-Bench; guardrail model TS-Guard trained with multi-task reinforcement learning, judging request harmfulness, action-attack association, and providing interpretable feedback before execution; and feedback-driven reasoning framework TS-Flow, guiding ReAct-style agents to correct tool usage rather than terminating tasks.
    • Threat model:
      • Victim system: LLM agents interacting with the environment via reasoning-action loops, specifically ReAct-style agents in experiments; guardrails do not modify the base model.
      • Risk sources: Malicious user requests directly induce unsafe tool calls; prompt injection during benign task execution leads to unintended tool usage. The introduction also mentions backdoor attacks, but the four patterns focused on are MUR, PI, HT, and BTRA.
      • Guardrail capability and timing: Before candidate action execution, judge whether the action is unsafe based on user request, prior interaction history, and tool descriptions when available, and can output analysis and feedback.
      • Success criteria: Detection tasks are evaluated with safe, controversial, unsafe labels; protected agents are evaluated on both harmful task completion rate (ASR or AgentHarm's refusal rate and score) and benign task completion (Utility).
  2. What related research exists?

    Related work is divided into static LLM guardrails and agent guardrails; the authors position this paper on pre-execution step-level monitoring.

    LLM safety guardrails

    • LlamaGuard: The paper states it pioneered the LLM-based safety guardrail paradigm, fine-tuning a general LLM to classify prompts and responses according to a custom safety taxonomy (this sentence cites Li and Liu, 2024).
    • Qwen3Guard (Zhao et al., 2025): Introduces three-level harmfulness classification and supports 119 languages and dialects. The paper also lists ShieldGemma (Zeng et al., 2024), PolyGuard (Kumar et al., 2025), and WildGuard (Han et al., 2024).
    • Authors' positioning: These guardrails are effective for content moderation but limited to static content review, struggling with safety risks of dynamic tool calls in agents. The same section also mentions guardrails used to defend against input jailbreaks and prompt injection (Li and Liu, 2024; Li et al., 2025) and to review harmful outputs (Inan et al., 2023; Li et al., 2024; Zhao et al., 2025).

    Agent guardrails

    • LlamaFirewall (Chennabasappa et al., 2025): Combines PromptGuard2 (Yuan et al., 2025) with AlignmentCheck. The authors state its risk coverage and generalization are limited.
    • Planning-stage and trajectory-level methods: Safiron (Huang et al., 2025b) identifies risks at the planning stage, before execution. AgentAuditor (Luo et al., 2025a) retrieves reasoning experiences to guide LLM evaluation of complete execution trajectories; Zhang et al. (2024) fine-tune models for the same purpose. The authors note the latter two operate at trajectory level, not step level.
    • Rule-based and complex reasoning pipelines: GuardAgent (Xiang et al., 2024) relies on manual rules; the authors state coverage and generalization are limited to predefined scenarios. ShieldAgent (Chen et al., 2025) and AGrail (Luo et al., 2025b) make safety judgments through complex reasoning and verification pipelines; the authors state high latency makes them unsuitable for step-level monitoring of tool calls. The introduction also extends agent guardrails to memory (Wei et al., 2025), planning (Huang et al., 2025b), and action execution (Sun et al., 2025).

    Detection benchmarks

    • Trajectory-level: R-Judge (Yuan et al., 2024) and ASSEBench (Luo et al., 2025a) have annotation granularity at trajectory level, risk behavior as tool calls, covering MUR, PI, BTRA, not HT (Table 1).
    • Step-level but domain-specific: OS-Safe (Luo et al., 2025b) targets web browsing/code execution, ShieldAgent-Bench (Chen et al., 2025) targets web browsing; both cover MUR and PI, not HT and BTRA (Table 1).
    • Authors' comparison: These benchmarks either only do post-hoc trajectory-level annotation or focus on specific risk behaviors like web browsing or code execution. TS-Bench focuses on unsafe tool calls and provides step-level safety labels.

    Baseline methods and benchmarks

    • Guardrail model baselines: GPT-4o, Qwen3-8B, Qwen2.5-7B-Instruct, LlamaGuard3-8B, Qwen3Guard-8B-Gen, ShieldAgent-THU, Safiron; evaluated on TS-Bench (AgentHarm-Traj, ASB-Traj, AgentDojo-Traj).
    • Guardrail framework baselines: sandwich defense, LlamaFirewall (PromptGuard2 for input filtering, GPT-4o-mini few-shot or TS-Guard for alignment checking). Agent evaluation uses AgentDojo, ASB (DPI and IPI), and AgentHarm's harmful instructions split; agent backbones are GPT-4o and Qwen2.5-14B-Instruct. TS-Flow also integrates ShieldAgent-THU and Safiron separately.

    The authors position this work as: addressing the above coverage, granularity, or latency shortcomings with generalizable step-level tool call safety monitoring and pre-execution feedback to guide reasoning, rather than post-detection termination. The paper states TS-Bench is the first step-level tool call safety detection benchmark to its knowledge.

  3. How does the paper address this problem?

    TS-Bench performs step-level annotation across four risk categories; TS-Guard uses multi-task GRPO to produce feedback, and TS-Flow corrects actions accordingly.

    The overall framework is pre-execution step-level guardrail plus feedback: first use TS-Bench to characterize risks, then train TS-Guard for interpretable judgment, and finally use TS-Flow to return feedback to the ReAct agent.

    Problem setting and four risk categories

    • Interaction form: Given an initial user request, the agent generates actions step by step containing intermediate reasoning and planned tool calls; the environment returns observations after execution until the task ends. The history before step t is denoted H, composed of previous action-observation pairs.
    • Detection goal: Judge whether the candidate action is unsafe before execution. The paper writes y=fguardrail(a,H,u,T), where y indicates whether executing the action poses potential safety risk; tool descriptions are also input when available.
    • Four patterns: Trigger causes are malicious user requests and third-party prompt injection; manifestations are calling harmful tools and benign tools with risky parameters, corresponding to MUR, PI, HT, BTRA. The authors state this comes from analysis of four interaction logs: AgentAlign, AgentHarm, ASB, AgentDojo.
    • Samples and labels: Each sample contains available tool set, user request, history up to current step, candidate tool call, and label. Label set is safe, controversial, unsafe, indicating whether executing the action poses potential risk. Additionally, whether the step is related to prompt injection and whether the user request is harmful are annotated; annotation details are in Appendix B, examples in Appendix C.

    Construction of TS-Bench

    • Data sources: Interaction logs from AgentAlign, AgentHarm, ASB, AgentDojo, covering benign and malicious user requests, prompt injection, and harmful or benign tool sets. Appendix A gives details. Trajectories are sampled with GPT-4o, Claude3.5, Qwen3-30B-A3B, then step-level annotated.
    • Splits: Training set uses AgentAlign trajectories and three selected domains of ASB, covering four unsafe patterns. Evaluation set uses the remaining seven domains of ASB, plus AgentHarm and AgentDojo. The authors state overlap with training set is minimal; Appendix D explains the two splits are largely disjoint with no data leakage.
    • Scale (Table 2): Evaluation set AgentHarm-Traj 731 samples (safe 206, controversial 315, unsafe 210), ASB-Traj 5237 (2700, 1466, 1071), AgentDojo-Traj 1220 (safe 868, controversial N/A, unsafe 352). Training set AgentAlign-Traj 673 (123, 237, 313), ASB-Traj 1520 (720, 469, 331). Controversial refers to disputed or potentially unsafe tool usage steps.

    TS-Guard

    • Three tasks in one inference: The authors believe detecting unsafe calls directly from interaction logs is difficult due to log complexity and limited supervision. The model sequentially predicts request harmfulness, candidate action's association with third-party attacks, and safety of the current tool call in the same inference, and generates brief analysis and reasoning before final judgment. Safety follows Qwen3Guard's three-class classification.
    • Multi-task reward: Training samples have three labels. Reward is 1 minus the weighted sum of three indicator functions, with weights all set to 1/3; any prediction differing from ground truth deducts the corresponding weight. Optimization uses GRPO, with advantage being group-normalized output-level reward uniformly added to all tokens of that output. The paper compares RL with SFT and SFT+RL in Section 6.1, but does not provide learning rate, group size, or training steps in the method section.
    • Output usage: The authors state that fine-grained supervision helps the guardrail perform causal analysis and improve detection; these outputs also have potential as finer-grained step-level feedback to support safer tool call decisions. Output fields in Figure 2(a) include Analysis, Malicious_User_Request, Being_Attacked, and Harmfulness_Rating.

    TS-Flow and comparison paradigms

    • LlamaFirewall: Prompt Guard detects prompt injection and jailbreaks; Alignment Check monitors reasoning to detect goal hijacking, indirect prompt injection, and inconsistency between user request and reasoning. Upon anomaly detection, it terminates the workflow. The authors believe normal instructions and injected signals are often mixed, and termination reduces benign task completion; multiple specialized modules also increase deployment complexity.
    • TS-Flow: Uses TS-Guard to monitor tool call reasoning, providing pre-execution feedback for potentially unsafe actions, allowing the agent to correct behavior rather than being terminated. Figure 2(b) contrasts this "agent-guardrail interaction" with LlamaFirewall's "detect and terminate." The authors state this paradigm improves safety while largely maintaining agent performance.
    • Integration: Feedback is appended as an external signal directly to the agent's input context; the authors state in Limitations that this approach is simple and model-agnostic. The paper does not specify feedback trigger thresholds or maximum feedback count per step in the method section.
  4. What experiments did the paper conduct?

    In strict detection, TS-Guard's ACC/F1 are higher than baselines in the table; TS-Flow reduces ASR and improves some Utility.

    Experimental Setup

    • Two groups of experiments: one compares guardrail models' step-level detection on TS-Bench; the other compares guarded ReAct agents on AgentDojo, ASB, and AgentHarm, looking at benign task completion and attack resistance.
    • Detection models: GPT-4o, Qwen3-8B, Qwen2.5-7B-Instruct, Llama-Guard-3-8B, Qwen3Guard-8B-Gen, ShieldAgent-THU, Safiron, and TS-Guard. Section 6.2 says ShieldAgent-THU and TS-Guard are both trained on Qwen2.5-7B and share the same vocabulary.
    • Agents and defenses: backbones are GPT-4o and Qwen2.5-14B-Instruct. Defenses include sandwich defense, LlamaFirewall (PromptGuard2 for input filtering; alignment check is GPT-4o-mini few-shot or TS-Guard), and TS-Flow with TS-Guard, ShieldAgent-THU, or Safiron respectively.
    • Detection metrics and protocol: ACC, F1, Recall. Recall is the proportion of harmful tool calls correctly identified. The three-level annotation has two readings for binary classification baselines: strict treats potentially harmful or controversial as unsafe, loose treats them as safe. Table 3 is strict; loose is in Appendix G, no numbers in the main text.
    • Agent metrics: AgentDojo and ASB use ASR and Utility, which are completion rates of injected malicious tasks and benign user tasks respectively. ASB is split into DPI and IPI. AgentHarm uses harmful instruction splits, with metrics Refusal Rate and Task Completion Score; higher refusal and lower score mean safer. The paper does not report number of repetitions or query budget per condition.

    Main Results

    In Table 3 (strict), TS-Guard has higher ACC and F1 than other models in the same table on all three subsets.

    Swipe horizontally to read the table

    ModelAgentHarm ACC/F1/RecallASB ACC/F1/RecallAgentDojo ACC/F1/Recall
    GPT-4o75.23 / 84.80 / 96.1965.84 / 63.03 / 60.1155.74 / 56.59 / 100.00
    Qwen3-8B54.46 / 58.94 / 45.5259.66 / 38.93 / 26.5479.65 / 72.32 / 92.31
    Qwen2.5-7B-IT67.99 / 80.17 / 90.0952.10 / 62.96 / 84.0743.97 / 50.47 / 99.14
    Llama-Guard-3-8B81.53 / 86.35 / 81.3354.67 / 24.82 / 15.4574.75 / 33.33 / 21.87
    Qwen3Guard-8B-Gen80.57 / 86.27 / 84.9553.50 / 13.62 / 7.5770.57 / 3.23 / 1.70
    ShieldAgent-THU71.13 / 82.63 / 95.6257.63 / 54.44 / 52.2760.90 / 58.91 / 97.16
    Safiron46.10 / 45.88 / 31.8151.63 / 39.82 / 33.0370.98 / 52.80 / 56.25
    TS-Guard84.81 / 90.16 / 96.9594.97 / 94.76 / 93.8591.72 / 86.18 / 89.49
    • On MUR and PI: most guardrails perform well on unsafe calls caused by malicious user requests, and degrade under prompt injection. The authors give examples: GPT-4o has F1 84.8 and Recall 96.19 on AgentHarm-Traj, dropping to 63.03 and 60.11 on ASB-Traj; Qwen2.5-7B-IT, Llama-Guard-3-8B, Qwen3Guard-8B-Gen, and ShieldAgent-THU show similar drops.
    • Over-defense and HT: the authors say that when prompt injection appears in interaction history, many models judge benign tool calls as unsafe. In the BTRA condition of AgentDojo-Traj, several models have high Recall but low F1; the main text does not list BTRA numbers separately. The authors also say identifying explicitly harmful tools remains difficult, based on these models' poor performance on ASB-Traj. TS-Guard is described by the authors as performing strongly across all four patterns and mitigating over-defense. Recall is not highest everywhere: on AgentDojo-Traj, GPT-4o is 100.00 and Qwen2.5-7B-IT is 99.14, higher than TS-Guard's 89.49.

    The main results for guarded agents are in Table 4. The authors use superscripts to mark TS-Flow (TS-Guard) as the best trade-off between safety and utility. The abstract says harmful tool calls are reduced by 65% on average, the introduction writes up to 65% on average; benign task completion improves by about 10% under prompt injection. The main text does not give the calculation for these aggregate numbers.

    GPT-4o backbone (Table 4, ASR↓ / Utility↑; AgentHarm is Refusal↑ / Score↓):

    Swipe horizontally to read the table

    MethodAgentDojoASB-DPIASB-IPIAgentHarm
    ReAct56.16 / 26.8782.25 / 12.5080.00 / 48.0062.50 / 23.53
    sandwich54.12 / 28.9566.00 / 28.0572.98 / 46.4177.84 / 13.74
    LlamaFirewall (GPT-4o-mini)3.02 / 24.4733.28 / 10.7519.25 / 45.3780.87 / 12.64
    LlamaFirewall (TS-Guard)0.95 / 20.795.50 / 2.755.50 / 46.6396.59 / 4.28
    TS-Flow (TS-Guard)1.16 / 42.786.76 / 18.876.19 / 49.0194.32 / 6.03
    TS-Flow (ShieldAgent-THU)1.35 / 24.8618.75 / 9.5016.25 / 44.8092.10 / 7.12
    TS-Flow (Safiron)7.68 / 22.3962.25 / 8.2565.50 / 47.5073.86 / 18.91

    Qwen2.5-14B-Instruct backbone (Table 4, same metric order):

    Swipe horizontally to read the table

    MethodAgentDojoASB-DPIASB-IPIAgentHarm
    ReAct17.59 / 42.5795.25 / 18.7586.50 / 52.2542.04 / 34.14
    sandwich18.54 / 42.6991.25 / 25.2579.00 / 56.6250.00 / 33.40
    LlamaFirewall (GPT-4o-mini)2.84 / 33.8224.22 / 14.1222.75 / 49.2570.45 / 22.99
    LlamaFirewall (TS-Guard)1.05 / 36.465.75 / 4.006.50 / 50.0097.16 / 6.60
    TS-Flow (TS-Guard)1.79 / 42.727.25 / 30.007.00 / 58.1295.45 / 6.83
    TS-Flow (ShieldAgent-THU)0.93 / 26.4444.50 / 9.2538.25 / 45.2594.88 / 6.31
    TS-Flow (Safiron)6.85 / 25.8262.25 / 10.5069.75 / 49.3767.04 / 19.56
    • Aborting for safety: the authors say detect-and-abort improves safety but sacrifices utility. Putting TS-Guard into LlamaFirewall brings what the authors call the largest safety gain, but because it terminates upon detecting prompt injection, benign task completion drops noticeably. An exception in the table: on AgentDojo ASR with Qwen2.5-14B-Instruct, TS-Flow (ShieldAgent-THU) is 0.93, lower than LlamaFirewall (TS-Guard)'s 1.05.
    • Interaction looks at both sides: the authors say on AgentDojo and ASB, TS-Flow both avoids unsafe tool calls and uses guardrail feedback to guide benign task completion. With GPT-4o as an example, AgentDojo Utility goes from 26.87 with ReAct to 42.78 with TS-Flow (TS-Guard); in the same row ASR is 1.16, higher than LlamaFirewall (TS-Guard)'s 0.95.
    • Trade-off and latency: the authors say TS-Guard trades off ASR and benign task completion better than other guardrail models, partly from step-level detection and partly from richer feedback. The authors also call the latency that guardrail feedback may introduce a potential limitation, and say it remains within an acceptable range, with details in Appendix H; the main text gives no latency numbers.

    Training Methods and Reward Ablation

    • What was tested: Section 6.1 compares SFT, SFT+RL, RL only, and single-task reward vs. multi-task reward in Figure 3. Single-task only predicts the safety rating; multi-task also supervises request harmfulness and attack relevance. The figure's axes are F1, with AgentHarm-Traj and AgentDojo-Traj on the horizontal axis. The main text does not give bar heights.
    • Results: the authors say RL only generalizes better to diverse agent trajectories. Qwen2.5-7B-IT's entropy drops from 0.74 to 0.61 before and after SFT. The authors believe reduced output diversity may limit the benefit of subsequent RL and helps explain why SFT+RL is worse. Multi-task reward is described by the authors as consistently improving F1 and reducing false positives, with richer supervision enhancing generalization and mitigating bias.

    Entropy and Feedback Richness

    • Guardrail entropy: Section 6.2 measures uncertainty with average token-level entropy on TS-Bench. Figure 4's legend is Qwen2.5-7B-IT, ShieldAgent-THU, TS-Guard; (a) horizontal axis is Mean Token Entropy per Sentence, labeled roughly 0.1 to 0.9; (b) horizontal axis is Token Position (Step), labeled to 350. The authors say specialized guardrails have lower entropy than general LLMs; ShieldAgent reduces entropy across the whole output, while TS-Guard mainly reduces entropy at the final judgment token, with higher entropy in intermediate reasoning, encouraging exploration. Endpoint values are not written in the main text.
    • Agent entropy: Figure 5 plots a Qwen2.5-14B-IT ReAct agent, with Entropy on the vertical axis labeled to 5. (a) is AgentHarm's malicious agent tasks, horizontal axis Token Position labeled to 700; (b) is ASB's prompt injection, horizontal axis labeled to 500. The authors say without a guardrail entropy decreases over the process, corresponding to overconfident execution of potentially harmful actions; TS-Flow injects feedback when it detects an unsafe call, and entropy rises. The authors believe this maintains uncertainty in high-risk situations and avoids unsafe behavior through exploration in safety-related reasoning.
    • How much feedback: Section 6.4 compares full TS-Guard output vs. giving only the safety rating of the current action. Table 5's headers are ASB-OPI (ASR, Utility) and AgentHarm (Refusal rate, Score). ReAct is 86.5 / 52.25 and 42.04 / 34.14; full output is 7.00 / 58.12 and 95.45 / 6.83; rating only is 26.04 / 52.45 and 79.54 / 11.11. The authors say richer feedback brings higher safety and utility. Section 6.4 does not state the backbone model; the first two rows' numbers match the corresponding ASB-IPI and AgentHarm rows for Qwen2.5-14B-Instruct in Table 4, and the paper does not say whether they are the same setting.

    Other Ablations and Analysis

    • The introduction summarizes two lessons: TS-Guard's multi-task interpretable signals can correct benign task deviation caused by prompt injection and more effectively reduce harmful behavior; guardrail feedback raises agent output entropy, encouraging exploration of safe and helpful trajectories.
    • Loose-mode results are in Appendix G, no numbers in the main text.
    • Appendix H discusses latency; the main text only says it is within an acceptable range, without milliseconds or multipliers.
    • The paper does not report human agreement on detection tasks in the main text, nor the number of repetitions for each agent metric.
  5. What are some points that can be further explored?

    The authors note that feedback is not necessarily adopted, and that the agent and guardrail trained separately may be inconsistent, and they plan joint training.

    Limitations and future directions noted by the authors

    • Feedback may not be used: TS-Flow appends guardrail feedback as an external signal directly to the agent's input context. The authors state this approach is simple and model-agnostic, but current LLM agents sometimes fail to fully incorporate this feedback, limiting the effectiveness of step-level safety interventions (Limitations).
    • Lack of joint training: The agent and guardrail are trained independently without explicit coordination; the authors believe this may lead to inconsistency between the agent's reasoning process and the guardrail's safety judgments. The authors plan to explore joint training or tighter coupling to better integrate safety feedback and improve both safety and utility (Limitations).
    • Latency: Section 5.4.2 refers to the latency that guardrail feedback may introduce as a potential limitation, and states the authors consider it within an acceptable range; details are in Appendix H. This sentence is not in the Limitations section, and the main text does not provide latency numbers.

    Experimental coverage

    • Detection evaluation: In Table 3, the strict mode covers GPT-4o, Qwen3-8B, Qwen2.5-7B-IT, Llama-Guard-3-8B, Qwen3Guard-8B-Gen, ShieldAgent-THU, Safiron, and TS-Guard, with datasets AgentHarm-Traj, ASB-Traj, AgentDojo-Traj, and metrics ACC, F1, Recall. The loose mode is described in Appendix G.
    • Agent evaluation: In Table 4, the backbones are GPT-4o and Qwen2.5-14B-Instruct; defenses are sandwich defense, two LlamaFirewall variants, and TS-Flow with three guardrail models. Environments are AgentDojo, ASB's DPI and IPI, and AgentHarm's harmful instructions split.
    • Data scale: Table 2 gives the counts of safe, controversial, and unsafe samples in training and evaluation splits; training comes from AgentAlign and three domains of ASB, evaluation from the remaining seven domains of ASB plus AgentHarm and AgentDojo. Appendix D discusses whether the two splits leak.
    • Analysis experiments: Figure 3 compares training strategies and single-task/multi-task rewards, and reports entropy 0.74 and 0.61 before and after SFT. Figures 4 and 5 perform entropy analysis. Table 5 compares full feedback versus safety rating only. The common base of TS-Guard and ShieldAgent-THU is stated as Qwen2.5-7B in Section 6.2.
    • Settings not reported in the paper: The method section mentions GRPO and three reward weights of 1/3, but does not report learning rate, group size, or training steps; agent experiments do not report the number of repetitions. The main text does not provide the loose numbers from Appendix G or the latency numbers from Appendix H.
  6. Summarize the main content of the paper

    TS-Bench labels step-level risk, TS-Guard uses multi-task RL for pre-execution judgment, TS-Flow uses feedback instead of direct termination.

    ToolSafe studies step-level safety of LLM agents before tool execution: benchmark TS-Bench, guardrail TS-Guard, and feedback-driven framework TS-Flow.

    • Problem: Agents may call unsafe tools due to malicious user requests or prompt injection during execution, including harmful tools and risky parameters for benign tools. The authors argue that static content guardrails and agent guardrails relying on full trajectories are difficult to intervene in a timely manner, and direct termination after detection disrupts benign tasks mixed with normal instructions.
    • Approach: TS-Bench performs step-level annotation from logs of AgentAlign, AgentHarm, ASB, and AgentDojo, with labels safe, controversial, unsafe, and splits into training and evaluation. TS-Guard judges in a single inference whether the request is harmful, whether the action is related to third-party attacks, whether the current call is safe, and generates a brief analysis; the three errors enter the reward with weights of 1/3 each, trained with GRPO. TS-Flow returns feedback to the ReAct agent before execution, allowing it to switch to safer tool calls.
    • Detection: In strict mode, TS-Guard's ACC/F1/Recall on AgentHarm-Traj is 84.81/90.16/96.95, on ASB-Traj 94.97/94.76/93.85, on AgentDojo-Traj 91.72/86.18/89.49 (Table 3). The authors state that baselines perform well on malicious requests, decline on prompt injection, and tend to over-defend when benign tools are paired with risky parameters. On AgentDojo-Traj, several baselines have higher Recall than TS-Guard but lower F1.
    • Protected agents: In Table 4, on GPT-4o, TS-Flow (TS-Guard) achieves AgentDojo ASR/Utility of 1.16/42.78, compared to ReAct's 56.16/26.87; on Qwen2.5-14B-Instruct, ASB-IPI is 7.00/58.12, compared to 86.50/52.25, and AgentHarm refusal rate/score changes from 42.04/34.14 to 95.45/6.83. LlamaFirewall with TS-Guard often has lower ASR or higher refusal rate, but Utility is often lower. The authors state an average reduction of 65% in harmful tool calls and approximately 10% improvement in benign task completion under prompt injection. In Table 5, with safety rating only, ASB-OPI ASR is 26.04; with full output, it is 7.00.
    • Authors' conclusions: Multi-task interpretable signals can correct benign task deviations caused by prompt injection and reduce harmful behavior; feedback increases agent output entropy, encouraging exploration of safe and helpful trajectories. The authors also note that feedback appended directly to context may not be fully adopted, and independently trained agents and guardrails may have inconsistent judgments, and they plan joint training or tighter coupling.

Related papers

Show 3 more papers
Read originalFindings of ACL 2026