TL;DR
LLM agents that use tools can be manipulated through multi-step trajectories where individual actions appear benign but cumulatively reach a harmful state. This paper introduces SEAD, a framework that treats agentic safety as a state-control problem, featuring a feedback-driven attack (DART) that adapts to environment changes and a state-investigating defense (SAGE) that proactively queries the environment to intercept harm before it happens.
What Problem Does This Paper Address?
As Large Language Models (LLMs) transition from chatbots to "agents" capable of interacting with the real world (filesystems, databases, web browsers), the safety landscape shifts. Traditional safety filters focus on the content of a prompt, but in an agentic setting, harm is often a property of the environment state.
For example, an agent might be asked to "upload a file for debugging." This looks harmless. However, if an earlier, seemingly routine action changed the "debug file" to point to a sensitive cookie database, the upload becomes a major security breach. The core challenge is state ambiguity: a defender watching the agent's actions often lacks the full context of the environment state needed to judge if a pending action is actually dangerous.
Methods
The authors formalize this interaction as SEAD (State-grounded Execution for Attack and Defense), a partially observed state-control loop involving an attacker, a target agent, and a defender.
DART: The Adaptive Attacker
DART (Decomposed Attacks with Runtime Feedback and Tree Search) treats attacking an agent like a search problem. Instead of one big "jailbreak" prompt, it:
- Decomposes a harmful goal into locally plausible, "innocent-looking" steps.
- Uses Tree Search to explore different instruction paths.
- Adapts to Feedback: If the target agent fails a step or a defender blocks an action, DART uses the environment's response to pivot and try a different branch in its search tree.
SAGE: The Proactive Defender
SAGE (State-Aware Gating through Exploration) is a "pre-execution" guardrail. When an agent proposes a tool call, SAGE doesn't just look at the command; it assesses the potential effect on the state. If the visible history is ambiguous, SAGE can:
- Issue Read-Only Queries: It can privately inspect the environment (e.g.,
ls -lorSELECT * FROM table LIMIT 1) to gather evidence. - Decide to PASS or BLOCK: Based on this extra evidence, it determines if the action crosses a "harm-enabling boundary."
- Learn via SFT: SAGE is fine-tuned on "teacher traces" where an expert model demonstrates how to investigate and identify the exact moment a trajectory turns harmful.
Datasets
The authors constructed an environment-verifiable dataset by adapting MT-AgentRisk tasks.
- 187 Malicious Tasks: Spanning Filesystem, Terminal, PostgreSQL, and Web domains.
- Environment Grounding: Unlike text-only benchmarks, these tasks include replayable tool environments and executable checks to verify if a harmful state was actually reached.
- Benign Controls: 95 trajectories derived from OpenAgentSafety (OAS) were used to ensure the defender doesn't accidentally break legitimate agent functionality.
Key Insights and Ideas
- Harm is a Boundary, Not a Point: Malicious trajectories often share a "safe prefix" with benign ones. The defender's job is to find the specific transition that realizes the harm.
- Investigation Generalizes: Remarkably, SAGE was trained only on Filesystem and Terminal data but successfully generalized to PostgreSQL and Web tasks. This suggests that the logic of how to investigate a pending action is a transferable skill for LLMs.
- Feedback Loops Matter: The paper shows that attackers who ignore execution feedback (like fixed-decomposition baselines) are significantly less effective than those that adapt to the environment's state changes.
Key Results
The researchers evaluated their methods against four major target models (including GPT-4 variants and Gemini).
- Attack Effectiveness: DART outperformed the best competing baselines by 18.8–35.9 percentage points in semantic attack success.
- Defense Precision: SAGE achieved a high benign all-pass rate of 95.79% (utility) while intercepting 92.73% of harmful paths (safety).
- Online Robustness: In live "attack vs. defense" scenarios, SAGE reduced DART’s executable attack success rate from 48.0% down to a mere 4.0%.
Limitations and Future Work
- Read-Only Constraint: SAGE is currently limited to read-only queries. Future work could explore how defenders might handle more complex investigations that might temporarily alter state.
- Efficiency: Proactive investigation adds latency. Optimizing when to investigate and when to stop is a key area for improvement.
- Scope: The current framework focuses on tool-mediated execution. Extending this to handle concurrent processes or direct assistant-output disclosures remains an open challenge.
Summary updated