Abstract
As Large Language Model (LLM) agents evolve from conversational assistants into autonomous entities capable of tool use, the security landscape shifts from linguistic safety to action-oriented security. This paper introduces a unified safety-alignment framework designed to protect agents against malicious user prompts and compromised tool outputs. By training agents in a sandboxed reinforcement learning (RL) environment using a tri-modal taxonomy—categorizing inputs as benign, malicious, or sensitive—the researchers develop models that can execute, refuse, or verify actions effectively. Evaluation on multiple benchmarks shows that this approach significantly bolsters safety while maintaining high utility.
Introduction
Traditional LLM safety research focuses on conversational guardrails to prevent offensive or dangerous speech. However, autonomous agents—models that can search the web, send emails, or execute code—introduce new threat vectors. The authors identify two primary risks:
- User-Initiated Threats: Adversarial prompts intended to trick an agent into unauthorized actions (e.g., "Delete all system files").
- Tool-Initiated Threats: Indirect prompt injection where a tool returns a malicious payload that hijacks the agent's reasoning to perform secondary harmful tasks.
Methodology: The Tri-Modal Alignment Framework
The proposed framework integrates safety directly into the agent’s reasoning process via Reinforcement Learning. Central to this is a Tri-Modal Taxonomy that classifies inputs and outputs into three categories:
- Benign: Safe for immediate execution.
- Malicious: Requires categorical refusal.
- Sensitive: High-stakes actions (e.g., financial transfers) that trigger a "double-check" protocol with the user.
Agents are trained in a Sandboxed RL Environment that simulates tool execution. The training process rewards "Execute-Refuse-Verify" compliance and encourages structured reasoning through Chain-of-Thought (CoT) using <think> tags. This ensures the agent's safety logic is both transparent and robust, treating tool outputs with the same level of suspicion as user prompts.
Experimental Setup
The framework was evaluated using a mix of synthetic and established benchmarks:
- Synthetic Corpus: 25,000 prompts and utterances generated via DeepSeek-671B to cover the tri-modal categories.
- Safety Benchmarks: Agent SafetyBench (ASB) for user-side threats and InjecAgent for tool-side indirect prompt injections.
- Utility Benchmarks: Berkeley Function-Calling Leaderboard (BFCL) to ensure tool-calling proficiency remains intact.
Results and Evaluation
The researchers applied their framework to Qwen-2.5-7B and 14B models. The results indicate that safety alignment does not necessarily come at the cost of performance; in fact, structured reasoning for safety can sometimes improve task planning.
Key findings include:
- Enhanced Defense: On internal malicious tests, the 7B model's resistance score improved from 0.9 (unprotected) to 99.9 (aligned).
- Utility Preservation: On the BFCL benchmark, the aligned 7B model scored 91.3, closely trailing the 95.3 baseline, demonstrating that the agent remains highly capable of complex tool use.
- The "Sensitive" Advantage: By allowing a "Sensitive" category for verification rather than outright refusal, the models avoid the "over-alignment" trap, remaining useful for high-stakes tasks while maintaining a human-in-the-loop safety net.
Conclusion
This work demonstrates that a unified ingress/egress defense is critical for agentic safety. By embedding safety into the RL loop within a sandbox, agents can become both more secure and more reliable partners in complex workflows. Future research will explore safety in multi-agent environments and open-world tool registration where agents must learn to interact with new tools on the fly.
Summary updated