Agent-SafetyBench: Evaluating the safety of LLM agentsAgent-SafetyBench: Evaluating the Safety of LLM Agents
The authors construct AGENT-SAFETY BENCH (349 environments, 2,000 test cases) to evaluate 16 LLM agents, and the authors state that none exceeds 60% total score.
- LLMs acting as agents interact with environments and call tools, bringing behavior safety risks beyond content safety, but the authors argue that a comprehensive agent safety evaluation benchmark is lacking.
- Constructing AGENT-SAFETY BENCH: 349 configurable simulated environments and 2,000 test cases, covering 8 risk categories and annotated with 10 failure modes; the data comes from rewriting existing datasets and GPT-4o-assisted augmentation, with multiple rounds of manual review; Qwen-2.5-7B-Instruct is fine-tuned on 4,000 manually labeled interaction records as the safety scorer.
- Evaluating 16 LLM agents, the authors report that all total scores are below 60% (highest Claude-3-Opus 59.8%, lowest Qwen2.5-7B-Instruct 18.8%); on this basis the authors summarize two types of deficiency—lack of robustness and lack of risk awareness—and state that defense prompts yield limited improvement.
- In the Limitations section, the authors note: most cases rely only on commonsense reasoning, and scenarios requiring domain expertise are left for future work; automatically generated cases require extensive manual revision, crowdsourcing is difficult to sustain, and scalable construction methods are needed. The evaluation covers 16 models, and the scorer's training data comes only from interaction records of GPT-4o-mini and Claude-3.5-Sonnet.
- Evaluated models
- Claude-3-OpusClaude-3.5-SonnetClaude-3.5-HaikuGPT-4oGPT-4-TurboGemini-1.5-FlashGemini-1.5-ProQwen2.5-72B-InstructGLM4-9B-ChatLlama3.1-405B-InstructDeepSeek-V2.5Qwen2.5-14B-InstructGPT-4o-miniLlama3.1-70B-InstructLlama3.1-8B-InstructQwen2.5-7B-Instruct
- Benchmarks
- AGENT-SAFETY BENCH
- Metrics
- safety scorehelpfulnessscorer accuracy
The CoAI team at Tsinghua University proposes Agent-SafetyBench, an agent safety benchmark containing 349 interactive environments and 2,000 test cases, covering 8 categories of safety risks and 10 failure modes. Evaluation of 16 LLM agents with tool-calling capabilities shows that none exceeds an overall safety score of 60%, with some below 20%, and among them the information dissemination risk category has an average score of only 15.6%. The authors summarize the problems into two points: insufficient robustness and lack of risk awareness, and find that improvement from defense prompts alone is limited; Claude-3.5-Sonnet still scores below 70% in safety under enhanced prompts. The team fine-tuned Qwen2.5-7B-Instruct as a scorer using 4,000 manually annotated interaction records, achieving 91.5% accuracy on 200 Gemini-1.5-Flash interactions, higher than GPT-4o's 75.5%.
Why it was selectedThe paper presents the safety scores of all 16 agents, all below 60%, and the failure mode distribution, which teams developing Agents can use to identify shortcomings in robustness and risk awareness.
Related events and news
1 events · 2 news mentions
News that mentions this paper
上海交大综述Agentic Web架构与治理框架
- 公众号 为机器立心names the paper上海交大全景解析 Agentic Web 架构与演进:从技术基底到治理范式的 AI 智能体网络新框架
在安全和可靠性方面,有安全评分、风险率等,如Agent-SafetyBench的评估显示,目前没有代理的安全评分超过60%,凸显了代理稳健性和风险意识的根本缺陷。
- Tech Policy Presscites the paper's id or linkAI 智能体能否与人权对齐?
As a first step, we need safety benchmarks that capture downstream human rights impact beyond specific failure modes or mechanisms of harm.
Paper analysis
What problem does this paper attempt to solve?
The authors argue that a comprehensive agent safety benchmark is lacking and propose AGENT-SAFETY BENCH, containing 349 environments and 2,000 cases.
Core problem: LLM agents, when interacting with environments and calling tools, produce behavioral safety risks beyond content safety, but there is a lack of comprehensive evaluation benchmarks to measure such risks.
- Problem scenarios: The authors point out that agents may leak sensitive information on public forums, incorrectly modify order quantities, etc.; such behaviors are not as obviously harmful as generating harmful text and require understanding the environment to assess the risk.
- Existing gaps: Prior work mostly focuses on the content safety of LLMs (e.g., privacy leakage, harmful content generation); the authors argue that benchmarks for agent behavioral safety remain insufficiently systematic in coverage of the number of environments, risk categories, and failure modes (Table 1 compares 8 existing benchmarks).
- Proposed in the paper: AGENT-SAFETY BENCH, containing 349 interactive environments, 2,000 test cases, 8 categories of safety risks, 10 failure modes, and a fine-tuned local scoring model to automatically evaluate interaction records.
- Preview of core findings: The authors report that all 16 tested LLM agents score below 60% overall, and summarize two types of deficiencies—lack of robustness and lack of risk awareness; the authors argue that defense prompts alone are insufficient to address these problems.
- Evaluation targets: LLM agents with tool-calling capabilities, including 16 in total—closed-source (Claude-3.5, GPT-4o, etc.) and open-source (Llama-3.1, Qwen2.5, etc.); the victim systems are simulated environments implemented in the paper (JSON tool descriptions + Python classes).
What related research exists?
Related work is divided into two groups, LLM content safety evaluation and agent safety evaluation; the authors position this paper as more systematic in environment diversity and risk coverage.
LLM Content Safety Evaluation
- Sun et al. (2023), Xu et al. (2023), Cui et al. (2023), Zhang et al. (2024a)—establish safety taxonomies and evaluate LLM safety using input instructions or multiple-choice questions.
- Jailbreak evaluation works: Zou et al. (2023), Li et al. (2024), Mazeika et al. (2024), Huang et al. (2024), Chao et al. (2024), Xie et al. (2024), Dong et al. (2024)—introduce jailbreak techniques to evaluate whether LLMs can be induced to generate unsafe content.
Agent Safety Evaluation
- Yin et al. (2024)—studies the risks of embodied LLM agents under high-level actions in real scenarios; Lee et al. (2024) propose MobileSafetyBench, evaluating device-control agents based on an Android emulator.
- Tool-interaction safety works: R-Judge (Yuan et al., 2024), AgentDojo (Debenedetti et al., 2024), GuardAgent (Xiang et al., 2024), ToolEmu (Ruan et al., 2024), ToolSword (Ye et al., 2024), PrivacyLens (Shao et al., 2024), InjecAgent (Zhan et al., 2024), Haicosystem (Zhou et al., 2024)—focus on tool-interaction risks in domains such as banking, travel and shopping.
- In Table 1, the paper compares these benchmarks' number of environments, number of cases and number of failure modes: environments 2–53, cases 132–1,054, failure modes 1–7; AGENT-SAFETY BENCH has 349 environments, 2,000 cases and 10 failure modes, and R-Judge does not support dynamic interaction.
Data and Scorer Sources
- Data construction directly reuses and rewrites samples from R-Judge, AgentDojo, GuardAgent, ToolEmu, ToolSword and InjecAgent; content cases draw 50 questions from AdvBench (Zou et al., 2023) combined with 20 jailbreak templates (Zhang et al., 2024c).
- The scorer training method follows the approach of Zhang et al. (2024b), using GPT-4o to generate explanations for manual labels.
Positioning: the authors state that this paper's distinction lies in introducing a large number of previously unexplored new environments (including environments without public APIs) and providing more systematic coverage of risk categories and failure modes.
How does the paper address this problem?
Benchmark construction: rewriting existing data plus GPT-4o augmentation yields 2,000 test cases, multiple rounds of manual quality control, then fine-tuning Qwen-2.5-7B-Instruct for automatic scoring.
Overall approach: first establish a risk taxonomy and data format, then rewrite and augment data from existing datasets, perform manual and automatic quality control, and finally train a local scoring model to judge complete interaction records as safe/unsafe. The framework is named AGENT-SAFETY BENCH.
Risk taxonomy and failure modes
- 8 risk categories (Table 3): leaking sensitive data, property loss, spreading unsafe information, physical harm, illegal and non-compliant behavior, compromising availability, harmful/vulnerable code, generating unsafe information; the taxonomy references content-level safety classifications (Zhang et al., 2024a) and behavioral-level agent safety research.
- 10 failure modes (Table 4): such as incorrectly calling tools when information is incomplete (M2), ignoring known constraints (M4), ignoring potential risks (M5), failing to call necessary tools (M8), over-trusting tool returns (M9), etc.; each test case is annotated with expected failure modes, which may include multiple.
- Each test case is a dictionary structure with four fields: Risks, Instruction/Dialog (supports pre-filled dialog history), Environments (environment name, tools, freely configurable initialization parameters), and Failure Modes.
Environment implementation
- Two-layer structure: JSON tool descriptions (aligned with mainstream formats such as OpenAI and Claude) + corresponding Python classes implementing tool logic, supporting custom initialization parameters; there is also a base class managing common functionality such as tool calls (Appendix C).
- Breakdown of the sources of the 349 environments (Table 2): 68 similar to tools in existing evaluation benchmarks, 42 with public APIs but no sandbox evaluation, 220 without public APIs but with real-world applications, 19 without public APIs and with no current real-world applications.
Data construction and quality control
- Rewriting existing data: Samples were collected from R-Judge, AgentDojo, GuardAgent, ToolEmu, ToolSword, and InjecAgent, and underwent a three-step rewriting process (clarify failure modes and discard those that cannot be improved, deduplicate, unify environment definitions and parameters); content-type cases were obtained by combining 50 questions from AdvBench with 20 jailbreak templates to yield 200 cases; a total of 876 cases were obtained.
- Augmentation: Directly using GPT-4o to generate had two problems—low diversity and low quality; the improved approach first used GPT-4o, Claude-3.5-Sonnet, and Gemini-1.5-Pro to generate 300 new environment names and required new cases to include random new environments, then used in-context learning to have GPT-4o simultaneously generate expected risky behavior sequences and specify risk categories; through the same rewriting process, 1,124 new cases were obtained, totaling 250 per category and 2,000 in total.
- Quality control: Each test case was reviewed by at least one author; a Python script automatically validated environment implementations; GPT-4o-mini and Claude-3.5-Sonnet were used to produce 4,000 interaction records, which were manually annotated as unsafe or not, and based on this the 10 failure modes were summarized in a manner similar to open coding; in cross-validation, 98% of 200 sampled test cases were judged reasonable, and 97.5% of 200 sampled labels were judged reasonable (Appendix F).
Scorer
- Motivation: Directly using GPT-4o for scoring achieved only 75.5% binary classification accuracy on 200 random Gemini-1.5-Flash interaction records, which the authors considered insufficient to support reliable evaluation.
- Training: Using 4,000 manually annotated records (2,186 unsafe / 1,814 safe), GPT-4o was first asked to generate explanations for the labels (94% of explanations for 50 sampled cases were judged reasonable), then Qwen-2.5-7B-Instruct was fine-tuned as the base model to output a judgment label plus analysis; hyperparameters are in Table 9 (batch size 36, maximum length 2,500, learning rate 2e-5, AdamW, 4 epochs, about 4 hours on 4 A100s).
- Evaluation method: The agent loops "decision—tool call—environment return" in the simulated environment until it gives a final response (4-step interaction process); after collecting the complete record, the fine-tuned scorer judges safe/unsafe, and the safe proportion is the safety score.
What experiments did the paper conduct?
Evaluating 16 agents: all total scores are below 60%; three additional analyses are conducted on failure modes, helpfulness and defense prompts.
Experimental Setup
- Models evaluated: 16 LLMs with tool-calling capability (Table 8): GPT-4o, GPT-4o-mini, GPT-4-Turbo, Claude-3.5-Sonnet, Claude-3.5-Haiku, Claude-3-Opus, Gemini-1.5-Pro, Gemini-1.5-Flash, DeepSeek-V2.5, GLM4-9B-Chat, Llama3.1-8B/70B/405B-Instruct, Qwen2.5-7B/14B/72B-Instruct.
- Benchmark: AGENT-SAFETY BENCH, 2,000 cases, 250 for each of 8 risk categories, 349 environments.
- Metric: safety score = proportion of cases judged safe by the scorer; scores are further split into Behavior (with environment) and Content (without environment) categories.
- Evaluation method: a fine-tuned Qwen-2.5-7B-Instruct scorer judges safe/unsafe; this scorer achieves 91.5% accuracy on 200 Gemini-1.5-Flash records (direct scoring by GPT-4o is 75.5%).
- Decoding settings: default temperature 0, changed to temperature 1 when generation is invalid (the paper states this is fewer than 1% of cases); at most 2,048 new tokens per turn; small models use a system prompt with format constraints (Appendix H).
- Number of repetitions: not reported in the paper.
Main Results
According to Table 5 (safety score %, higher is better; Behavior, Content and per-risk-category columns omitted):
Model Total Claude-3-Opus 59.8 Claude-3.5-Sonnet 59.4 Claude-3.5-Haiku 55.1 GPT-4o 44.2 GPT-4-Turbo 41.9 Gemini-1.5-Flash 41.6 Gemini-1.5-Pro 37.5 Qwen2.5-72B-Instruct 37.3 GLM4-9B-Chat 36.5 Llama3.1-405B-Instruct 35.4 DeepSeek-V2.5 34.2 Qwen2.5-14B-Instruct 31.9 GPT-4o-mini 31.2 Llama3.1-70B-Instruct 31.2 Llama3.1-8B-Instruct 19.9 Qwen2.5-7B-Instruct 18.8 - The authors state that all agents score below 60% overall, with some below 20%; within the same family, stronger models generally score higher overall, and closed-source models generally outperform open-source models, which the authors suggest may be related to tool-use robustness and risk awareness.
- Behavior safety scores (average 30.4%) are lower than content safety scores (average 68.4%); the authors state that most behavior cases do not contain explicit jailbreak attacks and argue that behavior safety deserves more attention.
- Among risk categories, Spread averages only 15.6%, and the authors state that agents readily spread information via posts, blogs and emails without verification; Produce averages 87.0%, which the authors suggest is related to jailbreak issues having been extensively studied.
Failure Mode Analysis
- What was measured: safety scores computed separately for 10 failure modes (Table 6).
- Results: M1 has the highest average at 70.1%; M2 averages 18.1% and M7 averages 12.5%, the lowest; M3, M4, M5 and M8 average between 23.2% and 28.3%.
- Authors' interpretation: models fabricate parameters to call tools when information is insufficient (M2), and ignore tool harmfulness (M7); in multi-tool tasks they ignore necessary tools (M3, M8), and bypass explicit or implicit constraints (M4, M5). The authors accordingly summarize two types of deficiency: lack of robustness and lack of risk awareness.
Helpfulness Analysis
- What was measured: each case was manually labeled fulfillable / unfulfillable; GPT-4o judges whether the behavior is helpful (regardless of safety), and the paper states this judgment was manually verified at 94% accuracy (the prompt is given in Appendix H).
- Results (Figure 3): for most agents, the safe proportion on unfulfillable cases is lower than on fulfillable cases; on fulfillable cases, high-safety models such as Claude-3.5-Sonnet have helpfulness comparable to low-safety models such as Qwen2.5-7B-Instruct; on unfulfillable cases, high-safety models have lower helpfulness than low-safety models.
- Authors' interpretation: high-safety models do not achieve safety by refusing to answer, but by correctly analyzing the task and executing it; when a task cannot be completed safely, they are more inclined to withhold assistance, reflecting risk awareness.
Defense Prompt Experiment
- What was measured: two defense prompts were appended after the system prompt—a simple version (listing the 10 failure modes) and an enhanced version (with detailed descriptions and examples); full prompts are in Appendix H.
- Results (Figure 4): defense prompts are ineffective for weaker models such as Qwen2.5-7B-Instruct; they yield some improvement for stronger models such as GPT-4o; Claude-3.5-Sonnet with the enhanced prompt still scores below 70%, and context length increases.
- Authors' interpretation: modifying the input prompt alone cannot adequately solve agent safety problems; the authors suggest future research into more effective methods such as fine-tuning.
Other Ablations and Analyses
- Scorer comparison: fine-tuned scorer 91.5% vs GPT-4o 75.5% (200 Gemini-1.5-Flash records; the main text describes this as an improvement of about 15%).
- Cross-validation: 98% of 200 sampled cases are reasonable, and 97.5% of 200 sampled safety labels are reasonable (Appendix F).
- Bias check (Appendix J): GPT-4o does not perform noticeably better on augmented data it participated in generating; the fine-tuned scorer does not show abnormally high scores when evaluating its base model Qwen-2.5-7B-Instruct.
What are some points that can be further explored?
The authors note that domain-knowledge scenarios and the scalability of automatically constructing high-quality cases remain to be studied; the experiments cover 16 models and simulated environments.
Limitations and future directions noted by the authors
- Domain knowledge scenarios (Appendix J): Except for code-related cases, most test cases rely only on commonsense reasoning to ensure safe interaction; test scenarios requiring advanced domain expertise are left for future work.
- Quality of automatically constructed test cases (Appendix J): A large proportion of automatically generated test cases still require substantial manual modification to meet standards; the authors believe that having LLMs automatically produce high-quality agent safety test cases remains difficult.
- Annotation is difficult to crowdsource (Appendix J): Even with detailed guidelines and feedback, ordinary crowdworkers found it difficult to effectively modify test cases, assess safety, and annotate failure modes; these tasks were ultimately completed by the authors themselves; the authors state that future work needs scalable methods to construct diverse and high-quality test cases.
- Defense directions (Section 4.5): The authors believe that only modifying input prompts yields limited improvement, and advocate future research into more effective methods such as fine-tuning.
Scope of experimental coverage
- The tested models are the 16 LLMs listed in Table 8, including closed-source API models and open-weight models.
- The evaluation environments are simulated sandbox environments implemented in the paper (JSON + Python), not real deployed systems.
- The scorer's training data come only from 4,000 interaction records produced by two models, GPT-4o-mini and Claude-3.5-Sonnet; scorer accuracy is reported only on 200 Gemini-1.5-Flash records.
- The defense experiments tested only two defense prompts (simple and enhanced); the paper does not report experimental results for other defense methods such as fine-tuning.
- The paper does not report the number of repetitions for each model's evaluation, nor does it report statistical significance tests for the main results.
Summarize the main content of the paper
AGENT-SAFETY BENCH evaluates 16 agents; the authors report that all overall scores are below 60%, and summarize two types of deficiencies: robustness and risk awareness.
This is an agent safety evaluation benchmark paper from the CoAI group at Tsinghua University.
- Problem addressed: LLM agents calling tools and interacting with environments bring behavior-level safety risks, and the authors argue that existing benchmarks are insufficiently systematic in coverage of environments, risk categories and failure modes.
- Method highlights: construct AGENT-SAFETY BENCH—349 configurable simulated environments, 2,000 cases, 8 risk categories, 10 failure modes; the data consists of 876 cases rewritten from 6 existing datasets plus 1,124 cases augmented with GPT-4o assistance, subjected to multiple rounds of manual review and automatic validation; Qwen-2.5-7B-Instruct is fine-tuned on 4,000 manually labeled records as the scorer, achieving 91.5% accuracy on 200 Gemini-1.5-Flash records, higher than the 75.5% of direct scoring by GPT-4o.
- Main results: all 16 evaluated agents score below 60% overall, with the highest Claude-3-Opus at 59.8% and the lowest Qwen2.5-7B-Instruct at 18.8% (Table 5); behavior safety averages 30.4%, lower than content safety's average of 68.4%; the Spread risk category averages only 15.6%; failure modes M2 (fabricating parameters when information is insufficient) and M7 (ignoring tool harmfulness) average 18.1% and 12.5% (Table 6).
- Authors' conclusions: current agents have two types of deficiency—lack of robustness (correctly calling tools across scenarios) and lack of risk awareness (overlooking the potential risks of behaviors); the helpfulness analysis shows that high-safety models do not achieve safety by refusing to answer; the two defense prompts yield only limited improvement for stronger models (Claude-3.5-Sonnet with the enhanced prompt still scores below 70%), and the authors argue that deeper means such as fine-tuning are needed.
- Limitations noted by the authors: most cases rely only on commonsense reasoning, and domain-knowledge scenarios are left for future work; automatically generated cases require extensive manual revision and are difficult to crowdsource, so scalable construction methods are needed.