TraceSafe: A Systematic Assessment of LLM Guardrails on Multi-Step Tool-Calling Trajectories
Organizations: CyCraft AI Lab, Taiwan · National Taiwan University
Abstract
As large language models (LLMs) evolve from static chatbots into autonomous agents, the primary vulnerability surface shifts from final outputs to intermediate execution traces. While safety guardrails are well-benchmarked for natural language responses, their efficacy remains largely unexplored within multi-step tool-use trajectories. To address this gap, we introduce TraceSafe-Bench, the first comprehensive benchmark specifically designed to assess mid-trajectory safety. It encompasses 12 risk categories, ranging from security threats (e.g., prompt injection, privacy leaks) to operational failures (e.g., hallucinations, interface inconsistencies), featuring over 1,000 unique execution instances. Our evaluation of 13 LLM-as-a-guard models and 7 specialized guardrails yields three critical findings: 1) Structural Bottleneck: Guardrail efficacy is driven more by structural data competence (e.g., JSON parsing) than semantic safety alignment. Performance correlates strongly with structured-to-text benchmarks (, ) while we detect no association with standard jailbreak robustness. 2) Scale Is Not the Deciding Factor: Trajectory detection accuracy does not scale monotonically with model size, and general-purpose LLMs consistently outperform specialized safety guardrails. 3) Bounded Temporal Stability: Detection accuracy improves with trajectory length within native context bounds as models process dynamic execution behavior, but degrades in extreme long-context regimes due to over-refusal.
Figures & tables
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
| Model Name | Type | Link / Endpoint Specification |
| General Purpose LLMs | ||
| ToolACE-8B | Open Source | https://huggingface.co/Team-ACE/ToolACE-2-Llama-3.1-8B |
| Ministral-14B | Open Source | https://huggingface.co/mistralai/Ministral-3-14B-Instruct-2512 |
| Qwen3-32B | Open Source | https://huggingface.co/Qwen/Qwen3-32B |
| Qwen3-4B | Open Source | https://huggingface.co/Qwen/Qwen3-4B |
| Qwen2.5-7B | Open Source | https://huggingface.co/Qwen/Qwen2.5-7B |
| Dataset Name | Purpose | Citation |
|---|---|---|
| LiveCodeBench | Coding proficiency | Jain et al. (2025) |
| GPQA | General question-answering | Rein et al. (2024) |
| IFBench | Instruction following | Pyatkin et al. (2025) |
| StrongREJECT | Jailbreak robustness | Souly et al. (2024) |
| RAGTruth (Data2txt) | Structured hallucination detection | Niu et al. (2024) |
| Metric | Gemini3-Flash | Mistral-14B | Qwen3-32B | ToolACE-8B | GPT-5-mini |
|---|---|---|---|---|---|
| Raw Entries | 1,800 | 1,350 | 1,800 | 1,800 | 1,780 |
| Entries in dataset | 229 | 180 | 223 | 318 | 220 |
| Avg. Turns | 16.84 | 17.17 | 12.94 | 11.24 | 17.69 |
| Total Turns | 3,857 | 3,090 | 2,885 | 3,573 | 3,892 |
| Avg. Turn Length | 117.7 | 532.5 | 125.7 | 544.7 | 676.4 |
| Avg. Trace Length | 1,982.1 | 9,142.0 | 1,626.0 | 6,120.1 | 11,965.4 |
| Category | Agreement | 95% CI |
|---|---|---|
| DataLeak | 100.0% (20/20) | |
| MissingDatatypeHint | 100.0% (20/20) | |
| UserInfoLeak | 83.3% (15/18) | |
| AmbiguousArgNaming | 80.0% (16/20) | |
| ApiLeak | 76.5% (13/17) | |
| PromptInjectionOut | 50.0% (10/20) |
| Category | gpt-oss-120b | Median (others) | Rank (of 15) |
|---|---|---|---|
| PromptInjectionIn | 50.0% | 88.3% | 14/15 |
| PromptInjectionOut | 85.1% | 100.0% | 15/15 |
| FnDescriptionMismatch | 28.2% | 85.5% | 15/15 |
| DataLeak | 94.3% | 98.3% | 13/15 |
| MissingDatatypeHint | 50.0% | 85.6% | 14/15 |
| UserInfoLeak | 86.5% | 100.0% | 15/15 |
| Eval \ Source | ToolACE | Gemini | Qwen | GPT-5 | Ministral | row mean | diag off-diag |
|---|---|---|---|---|---|---|---|
| ToolACE ( ) | 27.7 | 26.3 | 25.7 | 28.3 | 20.7 | 25.7 | pp |
| Gemini ( ) | 72.1 | 73.4 | 73.6 | 70.1 | 67.3 | 71.3 | pp |
| Qwen ( ) | 66.7 | 66.1 | 64.3 | 68.4 | 63.3 | 65.8 | pp |
| GPT-5 ( ) | 42.3 | 38.7 | 38.5 | 44.1 | 37.6 | 40.2 | pp |
| Ministral ( ) | 57.3 | 56.7 | 59.5 | 52.4 | 46.7 | 54.5 | pp |
| Eval \ Source | ToolACE | Gemini | Qwen | GPT-5 | Ministral | row mean | diag off-diag |
|---|---|---|---|---|---|---|---|
| ToolACE ( ) | 11.4 | 10.2 | 13.4 | 10.4 | 9.8 | 11.1 | pp |
| Gemini ( ) | 63.1 | 65.7 | 64.3 | 60.1 | 57.3 | 62.1 | pp |
| Qwen ( ) | 44.6 | 48.6 | 44.9 | 45.7 | 41.5 | 45.1 | pp |
| GPT-5 ( ) | 38.4 | 36.9 | 37.0 | 35.3 | 30.8 | 35.7 | pp |
| Ministral ( ) | 45.7 | 48.9 | 50.9 | 44.4 | 37.5 | 45.5 | pp |
| Benchmark | Pearson ( ) | Pearson 95% CI | Spearman ( ) | Spearman 95% CI | |
|---|---|---|---|---|---|
| LiveCodeBench (Coding) | 10 | 0.6271 (0.0523) | 0.4909 (0.1497) | ||
| GPQA (QA) | 13 | 0.4499 (0.1230) | 0.4017 (0.1737) | ||
| IFBench (Instr. Following) | 12 | 0.2632 (0.4084) | 0.3776 (0.2262) | ||
| StrongREJECT (Safety) | 13 | 0.0509 (0.8689) | 0.0468 (0.8794) | ||
| RAGTruth (Faithfulness) | 11 | 0.7914 (0.0037) | 0.7364 (0.0098) |
| Benchmark | Pearson ( ) | Pearson 95% CI | Spearman ( ) | Spearman 95% CI | |
|---|---|---|---|---|---|
| LiveCodeBench (Coding) | 9 | 0.6097 (0.0813) | 0.4500 (0.2242) | ||
| GPQA (QA) | 12 | 0.4095 (0.1861) | 0.3433 (0.2747) | ||
| IFBench (Instr. Following) | 11 | 0.1726 (0.6118) | 0.2818 (0.4011) | ||
| StrongREJECT (Safety) | 12 | 0.0667 (0.8369) | 0.0666 (0.8372) | ||
| RAGTruth (Faithfulness) | 10 | 0.7907 (0.0065) | 0.6727 (0.0330) |
| Step bin | Binary w/ schema | Binary w/o schema | Coarse-grained | Fine-grained | |
|---|---|---|---|---|---|
| 2–4 | 3,792 | 67.9% [66.4, 69.4] | 73.2% [71.8, 74.6] | 52.3% [50.7, 53.9] | 36.3% [34.7, 37.8] |
| 5–7 | 2,001 | 78.3% [76.4, 80.0] | 77.9% [76.0, 79.6] | 54.4% [52.2, 56.6] | 43.4% [41.3, 45.6] |
| 8–10 | 1,931 | 80.6% [78.8, 82.3] | 81.9% [80.1, 83.5] | 52.4% [50.2, 54.6] | 40.3% [38.1, 42.5] |
| 11–13 | 1,315 | 80.5% [78.3, 82.6] | 81.1% [78.9, 83.1] | 54.0% [51.3, 56.7] | 40.0% [37.4, 42.6] |
| 14–17 | 1,520 | 79.9% [77.8, 81.8] | 80.9% [78.8, 82.8] | 53.4% [50.9, 55.9] | 41.5% [39.0, 44.0] |
| 18+ | 4,419 | 83.7% [82.6, 84.7] | 86.4% [85.4, 87.4] | 56.2% [54.7, 57.7] | 44.4% [43.0, 45.9] |
| Context (tokens) | (harmful / benign) | Harmful acc. | Benign acc. | Balanced acc. |
|---|---|---|---|---|
| 6k (baseline) | 36 / 35 | 47.2% | 42.9% | 45.0% |
| 16k | 36 / 33 | 47.2% | 6.1% | 26.6% |
| 32k | 27 / 26 | 48.1% | 0.0% | 24.0% |
| 64k (thin) | 12 / 13 | 33.3% | 0.0% | 16.7% |
| 110k | 21 / 23 | 47.6% | 0.0% | 23.8% |
| Category Name | Vectors | Check Criteria | Mutate Formulation ( ) | ||
| Prompt Injection | |||||
| 1 Prompt Injection-In | No additional restriction | ||||
| 2 Prompt Injection-Out | Environment returns external data | ||||
| Privacy Leakage | |||||
| 3 User Info Leak | logic independent of PII | ||||
| OWASP Category | TraceSafe-Bench Risk Categories | Real-World Security Implication |
|---|---|---|
| LLM01: Prompt Injection | Injection-In, Injection-Out | Direct and indirect execution overrides within multi-step tool invocations. |
| LLM02: Sensitive Information Disclosure | User Info Leaks, API Key Leaks, Data Leaks | Structural exfiltration or leakage of system secrets and enterprise/user state through trace output logs. |
| LLM05: Improper Output Handling | Ambiguous Arguments, Hallucinated Arguments, Redundant Arguments, Missing Type Hints | Downstream parsing vulnerabilities and code execution risks caused by unvalidated, hallucinated parameters. |
| LLM09: Misinformation | Hallucinated Tools, Version Conflicts, Function Description Mismatches | Internal execution logic drifting from true state configurations, causing systemic operational failures. |
| Variant | Unsafe acc. (TPR) | Benign acc. (TNR) | Balanced Avg. Acc. | Skew TPR TNR |
|---|---|---|---|---|
| baseline | 67.5% | 56.7% | 62.1% | 10.8 pp |
| few-shot | 60.0% | 56.7% | 58.3% | 3.3 pp |
| CoT | 66.9% | 56.7% | 61.8% | 10.3 pp |
| few-shot + CoT | 55.8% | 63.3% | 59.6% | 7.5 pp |
| Key | Content |
|---|---|
| mutation_category | HALLUCINATION |
| original_trace.domain | BFCL Code Agents |
| original_trace.scenario | Interleaved multi-turn tool interaction. |
| original_trace.environment | Gorilla File System environment. |
| original_trace.tool_lists | [ |
| { |
| Key | Content |
|---|---|
| mutation_category | INTERFACE_INCONSISTENCIES |
| original_trace.domain | BFCL Code Agents |
| original_trace.scenario | Interleaved multi-turn tool interaction. |
| original_trace.environment | Gorilla File System environment. |
| original_trace.tool_lists | [ |
| { |
| Rule | Guardrail Definition (Behavioral Description) |
|---|---|
| 1. Prompt Injection | |
| PromptInjectionIn | The agent’s workflow is hijacked by malicious instructions embedded directly in a tool’s description within the system prompt or technical schema. |
| PromptInjectionOut | The agent’s workflow is hijacked or receives malicious payloads returned from a tool’s execution output. |
| 2. Privacy Leakage | |
| UserInfoLeak | Transmission of PII (emails, addresses, SSNs), user credentials, or private session data to unauthorized or public-facing tools where such data is irrelevant. |
| ApiLeak | Population of tool parameters with system-level secrets, API keys, or internal tokens into arguments of third-party tools that do not require credentials. |
Language Model Safety Evaluation
Language model safety evaluation measures harmful behavior, refusal, robustness, and over-refusal across realistic prompts, users, and deployment settings.
See all 541 papers