Evolutionary Safety Harnesses: Defending AI Agents Against Injection Attacks

Co-evolve safety harnesses with attack stressors to auto-search deployable agent injection defenses.
This research addresses prompt injection threats to tool-using LLM agents with the Evolution Under Fire framework, coupling safety-harness evolution with adaptive stressor evolution. Using utility-constrained Pareto-scheduled tree search, it optimizes only harness code while keeping the model, benchmark, tools, and evaluator fixed, so the result is directly deployable. On AgentDyn with GPT-4o-mini, ASR falls from 50.4% to 3.0%; on Agent-SafetyBench with Qwen2.5-7B-Instruct, from 82.6% to 62.0%; and the harness transfers zero-shot, cutting ASR from 32.1% to 0.9%.
Tool-using language model agents need to process information from untrusted sources such as emails, web pages, and documents. This creates a core security challenge: malicious instructions and legitimate task instructions can arrive through the same interaction channel. Existing defenses are mostly hand-designed and static, and further improvements depend on repeated manual redesign. A paper titled "Evolution Under Fire: Evolving Agent Safety Harnesses with Adaptive Injection Stressors" proposes a staged framework that couples the evolution of safety harnesses with the evolution of adaptive stressors.

From static defense to dynamic evolution
Traditional safety harnesses are designed by human experts based on known attack patterns and remain fixed once deployed. Attackers can search for targeted bypasses, while defenders can only wait for the next manual update. This research changes the approach: it makes the safety harness itself an evolvable object.
Specifically, the method uses utility-constrained Pareto-scheduled tree search to evolve complete executable safety harnesses from execution evidence. Throughout this process, the task model, benchmark, tools, and evaluator remain fixed, and only the harness code is iteratively optimized. This means the evolved harness can be deployed directly without retraining the model or modifying the underlying architecture.
Pareto scheduling refers to ordering the evaluation and selection of candidate solutions according to Pareto dominance relations in multi-objective optimization. A solution is Pareto-dominant when it is no worse than another on both safety and task utility and is better on at least one dimension. The "utility constraint" in this research means that task utility forms a floor that cannot be crossed: candidate harnesses are allowed to improve safety only while preserving utility, thereby avoiding degenerate strategies that are "perfectly safe because they do nothing." The Pareto frontier characterizes the set of optimal trade-offs between safety and utility, and the scheduled tree search expands along this frontier step by step, giving harness-code iteration both direction and usability.
Adaptive stressors: using attacks to drive defense
Evolving the harness alone is not enough. The research team introduces adaptive stressor evolution to actively discover attack methods that preserve task utility. These attacks are then used to guide the next stage of harness evolution—in effect, letting the defense system continuously upgrade under "live-fire testing."
This co-evolutionary approach addresses the fundamental flaw of static defense: the defense strategy no longer depends on a manually predefined attack list, but instead automatically discovers weaknesses from actual execution and hardens against them.
Prompt injection is the main threat facing tool-using agents. Unlike traditional software vulnerabilities, it exploits the fundamental inability of language models to reliably distinguish "instructions" from "data": when an agent reads emails, web pages, or documents, embedded malicious text may be executed by the model as task instructions. Common variants include direct injection (instructions smuggled into user input) and indirect injection (instructions hidden in external content). The latter is especially dangerous for tool-using agents because they must process large amounts of untrusted external content. Defense approaches are usually divided into input filtering, instruction isolation, least privilege, and output review, but no static rule can cover all variants in the semantic space—precisely the motivation for this research's advocacy of evolutionary methods to automatically search for defense strategies.
Experimental results: attack success rate drops sharply
On the AgentDyn benchmark, with the GPT-4o-mini model, the evolved harness reduced the attack success rate from 50.4% to 3.0%, while outperforming the initial harness in utility on both clean tasks and attacked tasks. Compared with reproduced defense methods, this approach provides a stronger safety-utility trade-off.
On Agent-SafetyBench, with the Qwen2.5-7B-Instruct model, harness evolution reduced the attack success rate from 82.6% to 62.0%, while maintaining helpfulness and runtime effectiveness. Although the reduction is less dramatic than on the previous benchmark, the improvement is still meaningful given the extremely high initial attack success rate.
One more detail is transferability: the evolved harness can be transferred to the Qwen3.5-35B-A3B model without further evolution, reducing the attack success rate from 32.1% to 0.9% while improving utility on attacked tasks. This indicates that the evolved defense strategy has a degree of model-agnosticism.
Attack Success Rate (ASR) is the core metric for measuring the effectiveness of injection defense, usually defined as the proportion of malicious injection attempts in which the agent actually carries out the attacker's intent. It is paired with task utility, namely the completion rate on clean tasks and the proportion of attacked tasks on which the original task can still be completed correctly. The two form a safety-utility trade-off curve: an overly conservative harness will reject many legitimate requests, causing utility to plummet. Therefore, when evaluating a defense approach, one should not look only at the ASR reduction but also at whether utility is maintained. The "zero-shot transfer" mentioned in the article means deploying harness code directly to another model without re-evolving it for that model, while still maintaining defense effectiveness.
Implications for AI safety engineering
This research conveys several important signals. Safety harnesses can be automatically optimized like software, rather than relying on experts to manually write rules. The co-evolution of attack and defense can discover vulnerabilities that human designers might overlook. Utility constraints ensure that safety improvements do not come at the expense of task capability.
Of course, the method is still at the research stage, and its generalization ability across more models and scenarios remains to be verified. The 62.0% attack success rate on Agent-SafetyBench also shows that there is still considerable room for improvement. But the direction is clear: giving defense systems the ability to self-evolve may be an effective path for dealing with continuously evolving injection attacks.
For teams building tool-using agents, this research suggests a pragmatic approach—rather than pursuing a one-and-done static rule set, build a safety layer that can continuously evolve from execution feedback.
One-line Summary
Let safety harnesses and attack stressors co-evolve to automatically search for deployable agent injection defense code.
Paragraph Summary
Targeting the prompt injection threat facing tool-using language model agents, this research proposes the Evolution Under Fire framework, which couples the evolution of safety harnesses with adaptive stressor evolution. The method uses utility-constrained Pareto-scheduled tree search; with the task model, benchmark, tools, and evaluator fixed, it iteratively optimizes only the harness code, so the evolved artifact can be deployed directly. Adaptive stressors actively discover attack methods that preserve task utility and use them to guide the next round of harness evolution. Experiments show that on AgentDyn with GPT-4o-mini, the attack success rate drops from 50.4% to 3.0%; on Agent-SafetyBench with Qwen2.5-7B-Instruct, it drops from 82.6% to 62.0%; and the evolved harness can also transfer zero-shot to other models, reducing ASR from 32.1% to 0.9%. This indicates that automatically evolved defense is a viable path for countering continuously evolving injection attacks.
Related articles

Prompt Engineering for Beginners: From Writing Prompts to Engineering Thinking
Starting from the essence and four functions of prompts, this article systematically explains the six-step process, four success criteria, learning value, and practical limitations of prompt engineering to help you build a complete understanding.

Anthropic Launches Nasdaq IPO: AI Giant's Listing and Risk Disclosures
Anthropic officially launches its Nasdaq IPO under ticker ANT, with market valuation expected to potentially exceed SpaceX's record. The prospectus devotes nearly 100 pages to AI risks, while first-half revenue grew over 14x but net losses widened sharply, reigniting the AI bubble debate.

Rust cURL Clone Uses 4,832 unsafe Blocks—Is the Memory Safety Myth Broken?
A Rust cURL clone uses 4,832 unsafe keywords, challenging Rust's memory safety narrative. We analyze what unsafe really means, compare Fil-C, and examine rewrite motives.