Manuscript Offprint
arXiv:2610.02920HASTE: Evolving Agent Harnesses Against Emerging Attacks Using Sparse Evidence
ABSTRACT
Agent harnesses play a critical role in defenses by enforcing safety constraints to prevent unsafe actions. However, rapidly emerging attacks outpace manual harness adaptation, motivating automated harness evolution. Yet the signals available for harness evolution are often sparse, such as brief descriptions or a few attack examples in threat reports and preprints. To address this limitation, we introduce HASTE, a multi-agent framework that evolves agent harnesses from sparse threat evidence through an adversarial interplay between safety-specification generation and attack-case generation. Safety specifications guide harness updates toward addressing identified safety vulnerabilities, while attack cases probe for remaining safety vulnerabilities after each update. By feeding evaluation outcomes back into both processes, HASTE enables harness evolution against emerging attacks beyond the initially observed evidence. Experimental results across multiple backbone models, attack types, and evidence forms show that HASTE consistently reduces attack success rates while preserving benign-task utility. The code is available at https://github.com/xxiqiao/HASTE.
1 INTRODUCTION
Large language model (LLM) agents are autonomous systems that interact with external environments by taking actions and receiving observations (Grace et al., 2026; Pan et al., 2026). These systems generally consist of a backbone LLM operating within a harness. The LLM reasons over a context of interaction history and observations to select the next action (Yao et al., 2022), while the harness is a stateful program that maintains this context (Runkle, 2026), executes the selected tool calls (Grace et al., 2026), and incorporates the resulting observations (Pan et al., 2026). This has enabled agent systems to perform complex tasks across a wide range of real-world applications (Gottweis et al., 2026; Peng et al., 2026).
In deployment, agent systems are exposed to safety risks, such as harmful queries (Zhang et al., 2024), injected malicious instructions (Greshake et al., 2023), and compromised tools (Liu et al., 2026), any of which can lead to harmful or unauthorized actions. This motivates defense mechanisms (Zheng et al., 2026; Mou et al., 2026) that identify risks and prevent unsafe actions during agent execution. Currently, such defenses can operate at both the model and harness levels. Model-level approaches align the underlying LLM to avoid generating unsafe actions (Zhang et al., 2026; 2025b; Wang et al., 2026a), while harness-level defenses impose execution-time constraints through safety rules, permissions, and workflow controls (Lin et al., 2026; Jia et al., 2026). Because the harness directly controls agent execution and environment interactions, it plays a critical role in defenses by preventing unsafe actions and supporting benign task completion.
However, a key challenge is that real-world safety risks evolve rapidly. Emerging attacks are often first disclosed through only sparse evidence, such as descriptions or a few examples in threat reports (Sharbat, 2025) and preprints (Zhang et al., 2025c). Unlike a comprehensive attack benchmark, such evidence offers limited coverage for systematically evaluating and improving defenses, and therefore cannot directly serve as a signal for automatic adaptation. Nevertheless, defenses must adapt to new risks from the sparse evidence alone. For model-level defenses, adaptation typically requires updating the underlying model, which can be computationally expensive and slow (Trivedi

(a) Evolution From Full Benchmark
(b) Evolution From Sparse Threat Evidence
Figure 1: Illustration of harness evolution from a full benchmark versus sparse threat evidence. (a) With a full benchmark, diagnosis and proposal directly revise the harness based on judge feedback. (b) With sparse threat evidence, attack cases and a safety specification are generated to guide harness adaptation and iteratively optimized using judge feedback.
et al., 2025). Harness-level defenses provide a more flexible alternative by modifying execution constraints without changing model parameters, but such adaptation still largely depends on manual engineering and substantial human effort (Lou et al., 2026). This motivates the following question.
Can agent harnesses evolve to defend against emerging attacks using sparse threat evidence?
To tackle this important yet underexplored problem, our key idea is to extrapolate from sparse threat evidence to guide effective harness evolution. We operationalize this idea through an adversarial interplay between safety-specification generation and attack-case generation that drives harness evolution (cf. Figure 1). The two processes have opposing objectives: safety-specification generation aims to guide harness updates toward addressing identified vulnerabilities, while attack-case generation seeks to expose vulnerabilities that remain after each harness update. The evaluation outcomes of each round then feed back into both generation processes, allowing the harness to progressively evolve to defend against emerging attacks beyond the initially observed evidence.
In this paper, we introduce HASTE, a three-stage multi-agent framework for Harness Adaptation from Sparse Threat Evidence. First, an attack parser abstracts the sparse threat evidence into an attack specification that captures the core attack mechanism. Second, conditioned on the attack specification and the feedback from previous rounds, two optimizer agents respectively generate a safety specification and a set of attack cases, while a proposer agent revises the current harness according to the safety specification. Third, a judge evaluates the updated harness for attack success on the attack cases and utility on some benign cases. The evaluation outcomes are then fed back to the optimizer agents in the next round, which refine both the safety specification and attack cases, enabling harness evolution. Experiments on Agent-SafetyBench (Zhang et al., 2024) and STAC (Li et al., 2025) across four backbone models and two evidence forms show that HASTE outperforms existing baselines in defending against emerging attacks while preserving, and in some cases improving, utility on benign tasks. Our contributions are threefold:
• We identify the important yet underexplored problem of evolving agent harnesses to defend against emerging attacks given sparse threat evidence.
• We propose HASTE, a multi-agent framework that enables harness evolution by extrapolating from sparse threat evidence through adversarially enhanced safety specifications and attack cases.
• We conduct extensive experiments across multiple backbone models, evidence forms, and attack types, where consistent reductions in attack success rate (ASR) and improvements in safe and helpful rate (SHR) demonstrate the effectiveness of HASTE.
Attacks Against Agents. Agentic systems expose a broader attack surface than standalone models due to the integration of more components. Jailbreak attacks attempt to induce a model's harmful behavior through adversarial user prompts (Xiong et al., 2026; Ren et al., 2024). Prompt injection attacks redirect an agent from its intended behavior using adversarial instructions supplied either directly as user input (Liu et al., 2023; Perez & Ribeiro, 2022) or indirectly through external content (Debenedetti et al., 2024; Li et al., 2026). Tool-based exploits target the agent's ability to invoke tools through malicious tool descriptions (Shi et al., 2025a; Wang et al., 2026b) or unsafe arguments (Mou et al., 2026; Zhan et al., 2024) that induce unauthorized actions. Memory poisoning attacks compromise persistent agent state by injecting malicious information into the memory (Chen et al., 2024; Srivastava & He, 2025), thereby influencing the agent's future decisions. Although these attacks differ in attack interfaces, they all exploit the agent harness.
Defenses for Agents. Agent defenses broadly fall into guardrail models and harness-based defenses. Guardrail models (Liu et al., 2026; Mou et al., 2026; Huang et al., 2026) use auxiliary classifiers to screen inputs, outputs, and tool calls, but they offer coarse interventions. Harness-based defenses (Debenedetti et al., 2025; Shi et al., 2025b; Lin et al., 2026) instead constrain what agents can observe, remember, and execute through mechanisms such as instruction hierarchies, sandboxing, and access controls. Existing defenses are largely designed around prespecified attacks, whereas our work automatically adapts defensive harnesses from sparse threat evidence.
3 METHOD
3.1 BACKGROUND AND PROBLEM FORMULATION
We consider an LLM agent system consisting of a backbone model and a harness that manages context, controls the execution loop, and executes tool calls, allowing it to constrain agent behavior at runtime without modifying the backbone model. Safety risks may arise throughout agent execution, such as malicious instructions from environmental observations and tool outputs. We evaluate agent behavior on a benchmark consisting of a set of tasks. For each task , executing the agent under harness induces a trajectory . We define a safety score indicating whether the execution remains safe, and a utility score indicating whether the intended task is successfully completed. These scores are determined by benchmark-specific evaluators, such as model-based judges or programmatic checks. We evaluate the harness using ASR and SHR:
Adapting a harness to emerging risks typically requires manually interpreting these risks and translating them into appropriate execution-time controls (Wang et al., 2025). As safety risks continually evolve, this motivates harness evolution, i.e., iterative and automated harness adaptation. Moreover, such harness evolution must often rely on sparse threat evidence —such as an attack description, a technical report, or a few observed examples—without access to the full evaluation set for comprehensive assessment. We therefore study the following problem:
Given sparse threat evidence and an initial harness , automatically adapt the harness to obtain that improves safety while preserving task utility on the corresponding comprehensive evaluation set , which is unavailable during adaptation.
3.2 HASTE
The central challenge is that sparse threat evidence reveals only a partial view of an emerging attack (Figure 2). Directly adapting the harness to this sparse evidence can overfit to observed attack
For simplicity, we omit the backbone model from subsequent notation when it is fixed.

Figure 2: Overview of the HASTE pipeline. Emerging attacks are parsed into attack specifications to drive an adversarial interplay between safety specifications and test cases. The final harness is selected under two settings, where observed examples are available only in HASTE .
patterns while leaving broader patterns undiscovered. HASTE addresses this challenge through an adversarial feedback loop between safety-specification and attack-case generation: safety specifications guide harness vulnerability mitigation, while attack cases probe for residual vulnerabilities. Execution feedback drives subsequent optimization of both the safety specifications and attack cases.
Multi-Agent Roles. HASTE realizes this process with five agent policies. The attack parser abstracts sparse threat evidence into the underlying attack mechanism. The specification optimizer generates safety specifications for strengthening the harness. The case optimizer generates attack cases that expose residual vulnerabilities, and utility cases that probe benign-task utility. The proposer revises the current harness according to the safety specification. Finally, the judge evaluates execution trajectories and produces both evaluation outcomes and diagnostic feedback explaining observed successes and failures. The feedback is accumulated across iterations and returned to the two optimizers, forming a closed-loop optimization process.
Stage 1: Attack Specification Generation. Sparse threat evidence may contain only a few specific attack instances or be mixed with substantial information unrelated to the underlying vulnerability. Directly adapting a harness from such raw evidence can therefore result in defenses tailored to incidental details rather than the general attack mechanism. To provide a common abstraction for subsequent adaptation, the attack parser first distills into a structured attack specification
where a summarizes the attacker's capabilities and the underlying attack mechanism. The attack specification a remains fixed throughout evolution and conditions both optimizer agents.
Stage 2: Harness Evolution via Adversarial Co-Optimization. Let denote the maximum number of evolution rounds, indexed by , and let denote the feedback accumulated before iteration , with . At each iteration, the specification optimizer produces a safety specification for strengthening the current harness :
In parallel, the case optimizer generates two sets of cases:
where contains attack cases with no safe completion path and is designed to expose residual safety vulnerabilities, while contains safely completable cases that probe utility regressions.
The specification optimizer and case optimizer operate independently within each iteration. In particular, newly generated cases are withheld from both the specification optimizer and the proposer, preventing the harness from being directly tailored to the cases used to evaluate it. Before being used for evaluation, each generated case undergoes feasibility validation using the initial harness . This validation only verifies that the case can be executed in the deployment environment, filtering out cases with unavailable tools, invalid arguments, or infeasible configurations without imposing any safety or utility criterion. Failed cases, together with their execution logs, are returned to the case optimizer for targeted regeneration.
Given , the proposer refines rather than synthesizing a new harness from scratch, allowing defenses introduced in earlier iterations to be preserved and reinforced. Formally,
Stage 3: Evaluation and Feedback. We next evaluate on both generated and, when available, observed examples. Let denote the small set of observed attack examples contained in the sparse evidence. When such examples are available, we partition them into and according to whether a safe completion path exists. The evaluation sets at iteration are then
This formulation covers both evidence conditions in our experiments. When no observed attack examples are available, referred to as , we set and evaluation relies entirely on generated cases. When a small number of observed examples are available, referred to as , these fixed cases are included alongside the generated cases throughout evolution.
The judge invokes the corresponding evaluators to obtain safety and utility scores for each trajectory and produces diagnostic feedback to guide subsequent updates. Safety is evaluated for all cases:
For safely completable cases, the judge additionally evaluates task utility:
Here, and denote the corresponding evaluation prompts, and and provide diagnostic explanations of the respective safety and utility outcomes.
We collect the evaluation results from iteration t as
(9)
and update the accumulated feedback as
is provided to both optimizers in the next iteration. The specification optimizer can therefore revise the safety specification based on previously observed failures and utility regressions, while the case optimizer can target residual weaknesses exposed by the evolving harness.
Final Harness Selection. The final harness is selected according to whether fixed observed cases are available during evolution. For , generated cases change across iterations and therefore do not provide a common validation set for comparing candidate harnesses. We consequently return the harness obtained at the final iteration. .
For , the observed sets and remain fixed across iterations and can therefore be used to compare candidate harnesses. For each , we compute
We select the iteration that jointly balances safety and utility:
For , the observed examples are sampled from the corresponding benchmark, and all remaining cases form the held-out evaluation set D, used exclusively for final evaluation.
Table 1: ASR (%) and SHR (%) on Agent-SafetyBench across four backbone LLMs, grouped by access to observed cases. Meta-Harness and HASTE use identical cases. Best and second-best results in each column within each group are shown in bold and underlined, respectively.
| Method | DeepSeek-V4-Pro | Qwen3-8B | Phi-4-mini-instruct | GPT-5.4-mini | Average | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | |
| No-defense | 45.40 ± 0.46 | 63.49 ± 1.14 | 56.02 ± 0.26 | 45.66 ± 0.53 | 65.18 ± 1.46 | 12.97 ± 0.75 | 38.94 ± 2.59 | 55.97 ± 2.40 | 51.39 | 44.52 |
| LlamaFirewall | 42.20 ± 1.16 | 48.48 ± 1.13 | 48.35 ± 1.08 | 36.84 ± 2.65 | 59.83 ± 1.63 | 13.24 ± 0.89 | 35.78 ± 1.16 | 47.99 ± 5.49 | 46.54 | 36.64 |
| Qwen3Guard | 39.08 ± 0.40 | 60.82 ± 2.00 | 46.40 ± 0.26 | 44.37 ± 0.25 | 59.33 ± 0.60 | 14.29 ± 0.68 | 34.63 ± 1.34 | 54.78 ± 2.31 | 44.86 | 43.57 |
| Safiron | 37.75 ± 0.22 | 50.48 ± 1.42 | 43.07 ± 0.88 | 40.20 ± 0.83 | 52.83 ± 2.74 | 9.77 ± 1.97 | 29.02 ± 0.24 | 48.34 ± 1.11 | 40.67 | 37.20 |
| TS-Guard | 38.86 ± 0.70 | 62.07 ± 1.90 | 46.75 ± 1.72 | 45.28 ± 1.14 | 52.62 ± 1.10 | 12.05 ± 1.12 | 31.03 ± 0.84 | 53.87 ± 1.46 | 42.32 | 43.32 |
| TS-Flow | 39.00 ± 0.93 | 61.63 ± 1.21 | 46.78 ± 0.50 | 44.33 ± 2.19 | 58.62 ± 0.23 | 14.56 ± 0.41 | 31.86 ± 1.45 | 56.24 ± 1.38 | 44.07 | 44.19 |
| SafeHarness | 43.07 ± 0.38 | 65.40 ± 1.06 | 52.33 ± 0.14 | 47.89 ± 1.16 | 63.43 ± 1.48 | 16.83 ± 1.38 | 37.70 ± 1.87 | 56.42 ± 1.50 | 49.13 | 46.64 |
| HASTEblind | 25.10 ± 4.36 | 68.68 ± 1.75 | 40.01 ± 4.81 | 48.46 ± 2.49 | 50.75 ± 6.45 | 21.51 ± 3.44 | 27.14 ± 6.20 | 60.57 ± 3.88 | 35.75 | 49.81 |
| Meta-Harness | 23.97 ± 2.51 | 68.96 ± 0.57 | 35.89 ± 5.54 | 50.54 ± 10.38 | 40.06 ± 14.12 | 21.47 ± 5.58 | 28.20 ± 2.69 | 58.43 ± 2.19 | 32.03 | 49.85 |
| HASTEseen | 21.19 ± 0.80 | 70.73 ± 4.01 | 32.27 ± 4.51 | 61.24 ± 6.88 | 40.33 ± 7.52 | 33.57 ± 10.28 | 20.22 ± 6.71 | 68.03 ± 4.51 | 28.50 | 58.39 |
4 EXPERIMENTS
We first describe the experimental setup (Section 4.1) and present the main results (Section 4.2), where we evaluate HASTE against existing baselines across multiple backbone models and benchmarks. We then present ablations (Section 4.3) on optimized components, judge models, and proposer and optimizer agents, followed by in-depth analysis (Section 4.4) of cross-benchmark generalization, transferability, successive emerging attacks, and parameter sensitivities. Additional results, including the effect of less threat evidence, judge model validation, and case studies, are provided in Appendix A, Appendix B, and Appendix D, respectively.
4.1 EXPERIMENTAL SETUPS
Baselines. We compare HASTE against an unprotected agent (i.e., No-defense) and a range of guardrail models and harness-based defense baselines. Guardrail models include Qwen3Guard (Zhao et al., 2025), Safiron (Huang et al., 2026), and TS-Guard (Mou et al., 2026), while harness-based defenses include LlamaFirewall (Chennabasappa et al., 2025), TS-Flow (Mou et al., 2026), and SafeHarness (Lin et al., 2026). We also compare against Meta-Harness (Lee et al., 2026), which updates harnesses from experience on a fixed case set.
Benchmarks and Evaluation. We evaluate on Agent-SafetyBench (ASB) (Zhang et al., 2024) and STAC (Li et al., 2025), and construct ASB-300 for ablations and in-depth analysis by randomly sampling 200 unfulfillable and 100 fulfillable tasks. Following Equation 1, we report ASR for safety and SHR for utility. To separate adaptation feedback from final evaluation, we use distinct judges for adaptation and final evaluation, with details in Appendix C.2. As STAC has no fulfillable subset, we report ASR only. We repeat each experiment three times and report the mean and standard deviation.
Implementation Details. We conduct experiments with two forms of sparse threat evidence: research papers and observed attack examples. We evaluate four backbone LLMs: DeepSeek-V4-Pro (Xu et al., 2026), Qwen3-8B (Yang et al., 2025), Phi-4-mini-instruct (Abouelenin et al., 2025), and GPT-5.4-mini (OpenAI, 2026a). Unless otherwise specified, we use Claude Code (Anthropic, 2026) with DeepSeek-V4-Pro for the proposer and optimizers and perform five adaptation rounds with 16 cases. Additional details on experimental setups are provided in Appendix C.
4.2 MAIN RESULTS
We compare a broad range of baselines across multiple backbone LLMs on ASB (cf. Table 1) and STAC (cf. Table 2), and draw the following conclusions: (1) Automated harness evolution strengthens safety without sacrificing utility. Without access to observed examples, HASTE achieves an average ASR of 35.75 on ASB and 29.12 on STAC, while attaining an SHR of 49.81 on ASB. These results suggest that attack cases targeting residual vulnerabilities, together with safely completable cases that probe utility regressions, enable effective harness evolution from the sparse evidence. (2) Observed examples further improve harness evolution. Both Meta-Harness and
Table 2: ASR (%) of different defenses on STAC across three LLM backbones. We omit Phi-4-mini-instruct because its limited capacity makes it unsuitable for STAC's multi-turn setting.
| Method | DeepSeek-V4-Pro | Qwen3-8B | GPT-5.4-mini | Average |
|---|---|---|---|---|
| No-defense | 62.73 ± 0.95 | 67.77 ± 0.24 | 64.39 ± 2.39 | 64.96 |
| LlamaFirewall | 49.14 ± 1.35 | 58.94 ± 8.31 | 55.26 ± 5.18 | 54.45 |
| Qwen3Guard | 59.70 ± 1.57 | 66.18 ± 1.38 | 63.56 ± 1.45 | 63.15 |
| Safiron | 35.33 ± 0.73 | 37.13 ± 1.04 | 36.09 ± 2.19 | 36.18 |
| TS-Guard | 57.00 ± 2.19 | 60.87 ± 0.83 | 59.01 ± 2.31 | 58.96 |
| TS-Flow | 56.66 ± 1.27 | 61.42 ± 1.33 | 59.46 ± 0.86 | 59.18 |
| SafeHarness | 47.20 ± 1.10 | 53.21 ± 2.87 | 49.62 ± 0.60 | 50.01 |
| HASTEblind | 19.25 ± 16.13 | 39.06 ± 27.12 | 29.05 ± 16.38 | 29.12 |
| Meta-Harness | 8.70 ± 6.89 | 26.85 ± 21.61 | 13.32 ± 1.76 | 16.29 |
| HASTEseen | 9.87 ± 9.94 | 28.52 ± 26.82 | 8.90 ± 6.86 | 15.76 |
Table 3: Ablation of optimized components on ASB-300 using Qwen3-8B, either retaining a generic safety specification across rounds or reusing the initial test cases without refinement.
| Method | Component | ASR | SHR | |
|---|---|---|---|---|
| Spec. | Cases | |||
| No-defense | - | 54.00 ± 1.73 | 45.00 ± 3.00 | |
| HASTEblind | ✓ | ✓ | 26.00 ± 4.67 | 54.00 ± 9.00 |
| × | ✓ | 46.33 ± 8.11 | 49.00 ± 5.29 | |
| ✓ | × | 53.67 ± 1.00 | 48.00 ± 1.73 | |
| HASTEseen | ✓ | ✓ | 25.56 ± 14.61 | 52.00 ± 1.73 |
| × | ✓ | 40.22 ± 13.36 | 50.00 ± 8.72 | |
| ✓ | × | 55.89 ± 1.68 | 47.00 ± 4.36 | |
HASTE consistently reduce ASR relative to HASTE , while HASTE also substantially improves SHR on ASB. The gains of both methods from observed examples highlight the value of harness-level evolution as a practical mechanism for translating newly observed threat evidence into effective agent defenses. (3) Co-optimizing safety specifications and attack cases makes better use of sparse threat evidence. Given the same observed examples within each benchmark, HASTE outperforms Meta-Harness, achieving the lowest average ASR on both benchmarks and the highest SHR on ASB. Meta-Harness updates the harness using experience from a fixed set of cases, limiting its ability to capture unobserved failure modes. In contrast, HASTE iteratively optimizes both safety specifications and attack cases based on execution feedback, producing richer adaptation signals and addressing vulnerabilities beyond the initially observed examples.
4.3 ABLATIONS
Optimized Components. To ablate the effect of each component, we conduct an ablation study on ASB-300 using Qwen3-8B as the backbone model, with results reported in Table 3. We disable safety-specification optimization by applying the same generic specification at each iteration, and disable test-case optimization by reusing the cases generated in the first iteration throughout adaptation. It can be observed that: (1) Freezing either component consistently increases ASR and reduces SHR, indicating that both are necessary for improving safety while preserving utility. (2) For both HASTE variants, reusing the first-iteration cases leads to larger degradations in both ASR and SHR than using a fixed generic specification, highlighting the importance of continually optimizing test cases to expose residual vulnerabilities. Overall, HASTE adversarially co-optimizes test cases and the safety specification, achieving improved safety without compromising utility.
Judge Models. We examine the sensitivity of harness adaptation to the judge models on ASB-300 using Qwen3-8B as the backbone model. Specifically, we replace either the default safety judge model with DeepSeek-V4-Flash or the default utility judge model with GPT-5.1 during adaptation, while keeping the final-evaluation protocol unchanged. As shown in Table 4, replacing the safety judge model increases ASR for all three methods; meanwhile, SHR remains nearly unchanged for HASTE but increases for Meta-Harness and HASTE . Replacing the utility judge model reduces ASR and increases SHR for Meta-Harness and HASTE , but degrades both metrics for HASTE . These results show that the choice of judge models dur- ing adaptation shapes the resulting harness. Nevertheless, HASTE remains broadly comparable to Meta-Harness across judge-model configurations, while HASTE consistently achieves lower ASR and higher SHR than Meta-Harness under the same configuration, demonstrating that the effectiveness of HASTE is robust to the choice of judge models.
Table 4: Ablation of judge models used during adaptation on ASB-300 with Qwen3-8B as the backbone model.
| Setting | Method | ASR | SHR |
|---|---|---|---|
| Default | HASTEblind | 26.00 ± 4.67 | 54.00 ± 9.00 |
| Meta-Harness | 35.44 ± 2.71 | 46.67 ± 15.04 | |
| HASTEseen | 25.56 ± 14.61 | 52.00 ± 1.73 | |
| Replace Safety Judge | HASTEblind | 34.00 ± 5.36 | 53.33 ± 4.16 |
| Meta-Harness | 38.89 ± 0.19 | 54.67 ± 2.08 | |
| HASTEseen | 31.78 ± 3.08 | 59.67 ± 5.51 | |
| Replace Utility Judge | HASTEblind | 33.89 ± 3.15 | 52.00 ± 5.57 |
| Meta-Harness | 31.00 ± 3.21 | 58.33 ± 1.15 | |
| HASTEseen | 22.11 ± 9.39 | 62.00 ± 8.72 |
Table 5: Ablation of the proposer and opti-Table 6: Cross-benchmark generalization from mizer LLMs on ASB-300 with GPT-5.4-mini as ASB to STAC. We report ASR (%) on the 93 the backbone. We replace the default DeepSeek-STAC cases instantiated in ASB environments. V4-Pro with GPT-5.5 for the proposer and both optimizers.
| Method | DeepSeek-V4-Pro | GPT-5.5 | ||
|---|---|---|---|---|
| ASR↓ | SHR↑ | ASR↓ | SHR↑ | |
| 27.00 ± 3.93 | 66.67 ± 3.06 | 24.56 ± 0.69 | 65.34 ± 2.21 | |
| Meta-Harness | 27.23 ± 3.21 | 59.60 ± 1.84 | 27.33 ± 3.79 | 66.57 ± 2.89 |
| 20.47 ± 6.63 | 71.00 ± 6.24 | 16.67 ± 8.99 | 77.00 ± 10.44 | |
| Method | Source | DS-V4-Pro | Qwen3-8B | GPT-5.4-mini | Average |
|---|---|---|---|---|---|
| No-defense | - | 63.76 | 67.49 | 67.08 | 66.11 |
| HASTEblind | STAC | 5.38 | 9.68 | 3.23 | 6.10 |
| ASB | 8.60 | 13.33 | 4.30 | 8.74 | |
| Meta-Harness | STAC | 3.23 | 6.45 | 5.38 | 5.02 |
| ASB | 4.30 | 15.05 | 7.53 | 8.96 | |
| HASTEseen | STAC | 1.08 | 10.75 | 2.15 | 4.66 |
| ASB | 8.60 | 10.75 | 5.38 | 8.24 |
Table 7: Transferability across backbone models. Rows above No-defense report ASR and SHR for a harness generated on a source backbone and evaluated on target backbones. Shaded cells indicate in-domain evaluation; unshaded cells indicate out-of-domain transfer.
| DeepSeek-V4-Pro | Qwen3-8B | Phi-4-mini-instruct | GPT-5.4-mini | Average | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | |
| DeepSeek-V4-Pro | 19.33 ± 0.88 | 67.67 ± 4.62 | 34.33 ± 6.12 | 56.00 ± 4.00 | 48.22 ± 3.56 | 21.33 ± 1.53 | 21.33 ± 1.45 | 69.33 ± 3.06 | 30.80 | 53.58 |
| Qwen3-8B | 19.00 ± 3.38 | 80.33 ± 3.79 | 32.56 ± 6.36 | 60.33 ± 7.23 | 44.78 ± 7.18 | 29.67 ± 7.37 | 24.89 ± 3.69 | 70.67 ± 3.21 | 30.31 | 60.25 |
| Phi-4-mini-instruct | 20.89 ± 1.68 | 71.33 ± 1.53 | 37.67 ± 3.33 | 55.33 ± 4.16 | 32.56 ± 4.00 | 27.67 ± 13.58 | 33.11 ± 17.98 | 62.00 ± 10.58 | 31.06 | 54.08 |
| GPT-5.4-mini | 18.11 ± 2.83 | 79.67 ± 2.31 | 38.78 ± 3.15 | 54.00 ± 4.00 | 44.22 ± 10.36 | 26.00 ± 1.00 | 19.00 ± 4.81 | 73.33 ± 5.51 | 30.03 | 58.25 |
| No-defense | 45.00 ± 1.45 | 61.00 ± 1.73 | 54.00 ± 1.73 | 45.00 ± 3.00 | 61.78 ± 1.17 | 13.33 ± 1.53 | 35.07 ± 1.90 | 56.33 ± 1.53 | 48.96 | 43.92 |
Proposer and Optimizer Agents. We further examine the effect of the model used by the proposer, specification optimizer, and case optimizer on ASB-300. With GPT-5.4-mini as the backbone model, we replace the default DeepSeek-V4-Pro with GPT-5.5 for the proposer and the optimizers. As shown in Table 5, HASTE achieves the lowest ASR and highest SHR under both configurations, while HASTE remains comparable to Meta-Harness, demonstrating the consistent advantage of HASTE across different proposer and optimizer models. Moreover, switching to GPT-5.5 further reduces the ASR and increases the SHR of HASTE , indicating that our method can benefit from more capable proposer and optimizer models.
4.4 IN-DEPTH ANALYSIS
Cross-benchmark Generalization. We evaluate cross-benchmark generalization on 93 STAC cases instantiated in ASB environments. Specifically, we compare harnesses generated on ASB and transferred to STAC without further adaptation with those generated directly on STAC. As shown in Table 6, the transferred harnesses remain effective on STAC across all backbone models and substantially outperform No-defense, indicating that the harness generated by HASTE generalizes beyond source attacks. However, they yield a higher ASR than harnesses generated directly on STAC, suggesting that target-specific threat evidence enables more effective evolution.
Transferability. Table 7 examines whether harnesses generated with one source backbone model transfer to the same (in-domain, ID) and unseen (out-of-domain, OOD) target backbone models. The results demonstrate strong transferability across backbone models: harnesses remain effective under OOD transfer, indicating that evolved harnesses are not specific to the source backbone model. Moreover, within each column, the ID ASRs and SHRs are generally better than the OOD counterparts, suggesting further gains from matching the source and target backbone models.
Continual Evolution under Successive Threats. To evaluate HASTE under continually evolving threats, we sequentially introduce the eight risk types in ASB, with each new risk defining an evolution stage. At each stage, every method performs five adaptation iterations using 8 attack cases and 8 safely completable cases, while 50 attack cases are randomly sampled from each risk type for evaluation, together with a fixed set of 100 safely completable cases shared across all stages. Figure 3 tracks performance on the first introduced risk type after each evolution stage, with Qwen3-8B as the backbone model. As more risk types are incorporated, ASR generally increases for all three methods, despite stage-wise fluctuations. Meanwhile, SHR decreases for Meta-Harness, whereas HASTE remains comparatively stable. Across most stages, HASTE maintains the lowest ASR and highest SHR, demonstrating stronger robustness to successive evolution.

Figure 3: Performance on the first introduced risk type across successive evolution stages. Each stage performs five adaptation rounds on the newly introduced risk type.

Figure 4: Safety–utility performance across all encountered risks up to each evolution stage.
To further assess the stability of HASTE under sequential evolution, we evaluate each method at every stage on the union of the newly introduced risk and all previously encountered risks. Figure 4 summarizes the safety–utility trade-off across stages, with covariance ellipses capturing the stability. remains tightly concentrated in the upper-right region, indicating consistently strong safety and utility throughout sequential evolution. By comparison, and Meta-Harness exhibit substantially less stability, likely due to accumulated adaptation drift from generated cases in the former and overfitting to specific cases in the latter. Overall, achieves the strongest and most stable safety–utility performance as new threats are progressively incorporated.
Parameter Sensitivity. We further examine the sensitivity of HASTE to the number of adaptation rounds and test cases. As shown in Figure 5, increasing either parameter generally improves , after which performance gradually stabilizes. In contrast, and Meta-Harness initially benefit from increasing either parameter but degrade as it increases further. This difference indicates that combining dynamically generated test cases with fixed observed examples allows to expose residual vulnerabilities while keeping the evolution and harness selection aligned with the target threat. relies on generated cases and accumulated feedback, which may shift adaptation away from the target threat distribution, while Meta-Harness repeatedly optimizes on a fixed case set and is more prone to overfitting.

Figure 5: Parameter sensitivity to the number of adaptation rounds and test cases on ASB-300 with GPT-5.4-mini as the backbone model. Shaded regions indicate standard deviations.
Moreover, the variance of generally decreases with additional adaptation rounds, while those of and Meta-Harness remain comparatively large and fluctuate across settings. This suggests that combining evolving generated cases with fixed observed examples reduces drift across the harness updates, resulting in increasingly stable adaptation.
5 CONCLUSION
In this paper, we study the problem of evolving agent harnesses to defend against emerging attacks given sparse threat evidence. We introduce HASTE, a multi-agent framework that extrapolates from sparse evidence and adversarially co-optimizes safety specifications and attack cases to drive harness evolution. Our experimental results show that HASTE consistently improves the safe and helpful rate across different benchmarks, backbone models, and evidence forms, with strong generalization and transferability, while observed examples further stabilize adaptation across successive threats and parameter settings. Overall, these results demonstrate the feasibility of automatically translating sparse threat evidence into effective harness evolution against emerging attacks.
AI USE STATEMENT
In this work, we used generative AI tools to assist with polishing the manuscript and with writing, debugging, and refining the research code. Generative AI was not used to make research decisions or interpret results. All AI-assisted content was reviewed and verified by the authors.
ETHICS STATEMENT
This work focuses on harness evolution against emerging attacks beyond the initially observed evidence. Our experiments use existing safety benchmarks in controlled environments, and we generate attack cases to support defensive evaluation and harness adaptation. We encourage responsible use of the released methods and artifacts.
REPRODUCIBILITY STATEMENT
The details needed to reproduce our experiments are provided in Appendix C and the released code.
REFERENCES
Abdelrahman Abouelenin, Atabak Ashfaq, Adam Atkinson, Hany Awadalla, Nguyen Bach, Jianmin Bao, Alon Benhaim, Martin Cai, Vishrav Chaudhary, Congcong Chen, et al. Phi-4-mini technical report: Compact yet powerful multimodal language models via mixture-of-loras. arXiv preprint arXiv:2503.01743, 2025.
Lakshya A Agrawal, Shangyin Tan, Dilara Soylu, Noah Ziems, Rishi Khare, Krista Opsahl-Ong, Arnav Singhvi, Herumb Shandilya, Michael J Ryan, Meng Jiang, et al. Gepa: Reflective prompt evolution can outperform reinforcement learning. In International Conference on Learning Representations, volume 2026, pp. 8479–8565, 2026.
Anthropic. Claude Code, 2026. URL https://claude.com/product/claude-code.
Zhaorun Chen, Zhen Xiang, Chaowei Xiao, Dawn Song, and Bo Li. Agentpoison: Red-teaming llm agents via poisoning memory or knowledge bases. Advances in Neural Information Processing Systems, 37:130185–130213, 2024.
Zhaorun Chen, Mintong Kang, and Bo Li. Shieldagent: Shielding agents via verifiable safety policy reasoning. arXiv preprint arXiv:2503.22738, 2025.
Sahana Chennabasappa, Cyrus Nikolaidis, Daniel Song, David Molnar, Stephanie Ding, Shengye Wan, Spencer Whitman, Lauren Deason, Nicholas Doucette, Abraham Montilla, et al. Llamafirewall: An open source guardrail system for building secure ai agents. arXiv preprint arXiv:2505.03574, 2025.
Edoardo Debenedetti, Jie Zhang, Mislav Balunovic, Luca Beurer-Kellner, Marc Fischer, and Florian Tramèr. Agentdojo: A dynamic environment to evaluate prompt injection attacks and defenses for llm agents. Advances in neural information processing systems, 37:82895–82920, 2024.
Edoardo Debenedetti, Ilia Shumailov, Tianqi Fan, Jamie Hayes, Nicholas Carlini, Daniel Fabian, Christoph Kern, Chongyang Shi, Andreas Terzis, and Florian Tramèr. Defeating prompt injections by design. arXiv preprint arXiv:2503.18813, 2025.
Chrisantha Fernando, Dylan Banarse, Henryk Michalewski, Simon Osindero, and Tim Rocktäschel. Promptbreeder: Self-referential self-improvement via prompt evolution. arXiv preprint arXiv:2309.16797, 2023.
Juraj Gottweis, Wei-Hung Weng, Alexander Daryin, Tao Tu, Petar Sirkovic, Artiom Myaskovsky, Grzegorz Glowaty, Felix Weissenberger, Alessio Orlandi, Dan Popovici, et al. Accelerating scientific discovery with co-scientist. Nature, pp. 1–3, 2026.
Mikaela Grace, Jeremy Hadfield, Rodrigo Olivares, and Jiri De Jonghe. Demystifying evals for AI agents. Anthropic Engineering Blog, January 2026. URL https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents. Published January 9, 2026.
Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, and Mario Fritz. Not what you’ve signed up for: Compromising real-world llm-integrated applications with indirect prompt injection. In Proceedings of the 16th ACM workshop on artificial intelligence and security, pp. 79–90, 2023.
Shengran Hu, Cong Lu, and Jeff Clune. Automated design of agentic systems. In International Conference on Learning Representations, volume 2025, pp. 21344–21377, 2025.
Yue Huang, Hang Hua, Yujun Zhou, Pengcheng Jing, Manish Nagireddy, Inkit Padhi, Greta Dolcetti, Zhangchen Xu, Subhajit Chaudhury, Ambrish Rawat, et al. Building a foundational guardrail for general agentic systems via synthetic data. In International Conference on Learning Representations, volume 2026, pp. 35963–35994, 2026.
Haoxuan Jia, Yang Liu, Bin Chong, Yingguang Yang, Yancheng Chen, Jiayu Liang, Qian Li, Hanning Lu, Kefu Xu, Hao Zheng, et al. Finharness: An inline lifecycle safety harness for finance llm agents. arXiv preprint arXiv:2605.27333, 2026.
Jonathan Kutasov, Yuqi Sun, Paul Cologne, Teun van der Weij, Linda Petrini, Chen Bo Calvin Zhang, John Hughes, Xiang Deng, Henry Sleight, Tyler Tracy, et al. Shade-arena: Evaluating sabotage and monitoring in llm agents. arXiv preprint arXiv:2506.15740, 2025.
Yoonho Lee, Roshen Nair, Qizheng Zhang, Kangwook Lee, Omar Khattab, and Chelsea Finn. Meta-harness: End-to-end optimization of model harnesses. arXiv preprint arXiv:2603.28052, 2026.
Jing-Jing Li, Jianfeng He, Chao Shang, Devang Kulshreshtha, Xun Xian, Yi Zhang, Hang Su, Sandesh Swamy, and Yanjun Qi. Stac: When innocent tools form dangerous chains to jailbreak llm agents. arXiv preprint arXiv:2509.25624, 2025.
Yongxiang Li, Moxin Li, Zhixin Ma, Fengbin Zhu, Dongrui Liu, Wenjie Wang, and Fuli Feng. Plant, persist, trigger: Sleeper attack on large language model agents. arXiv preprint arXiv:2605.28201, 2026.
Zelong Li, Shuyuan Xu, Kai Mei, Wenyue Hua, Balaji Rama, Om Raheja, Hao Wang, He Zhu, and Yongfeng Zhang. Autoflow: Automated workflow generation for large language model agents. arXiv preprint arXiv:2407.12821, 2024.
Xixun Lin, Yang Liu, Yancheng Chen, Yongxuan Wu, Yucheng Ning, Yilong Liu, Nan Sun, Shun Zhang, Bin Chong, Chuan Zhou, et al. Safeharness: Lifecycle-integrated security architecture for llm-based agent deployment. arXiv preprint arXiv:2604.13630, 2026.
Dongrui Liu, Qihan Ren, Chen Qian, Shuai Shao, Yuejin Xie, Yu Li, Zhonghao Yang, Haoyu Luo, Peng Wang, Qingyu Liu, et al. Agentdog: A diagnostic guardrail framework for ai agent safety and security. arXiv preprint arXiv:2601.18491, 2026.
Yi Liu, Gelei Deng, Yuekang Li, Kailong Wang, Zihao Wang, Xiaofeng Wang, Tianwei Zhang, Yepang Liu, Haoyu Wang, Yan Zheng, et al. Prompt injection attack against llm-integrated applications. arXiv preprint arXiv:2306.05499, 2023.
Xinghua Lou, Miguel Lázaro-Gredilla, Antoine Dedieu, Carter Wendelken, Wolfgang Lehrach, and Kevin P Murphy. Autoharness: improving llm agents by automatically synthesizing a code harness. arXiv preprint arXiv:2603.03329, 2026.
Yutao Mou, Zhangchi Xue, Lijun Li, Peiyang Liu, Shikun Zhang, Wei Ye, and Jing Shao. Toolsafe: Enhancing tool invocation safety of llm-based agents via proactive step-level guardrail and feedback. In Findings of the Association for Computational Linguistics: ACL 2026, pp. 37125–37153, 2026.
OpenAI. Introducing GPT-5.1 for developers, November 2025. URL https://openai.com/index/gpt-5-1-for-developers/.
OpenAI. Introducing GPT-5.4 mini and nano, 2026a. URL https://openai.com/index/introducing-gpt-5-4-mini-and-nano/.
OpenAI. GPT-5.6 System Card, 2026b. URL https://deploymentsafety.openai.com/gpt-5-6/gpt-5-6.pdf.
Linyue Pan, Lexiao Zou, Shuo Guo, Jingchen Ni, and Hai-Tao Zheng. Natural-language agent harnesses. arXiv preprint arXiv:2603.25723, 2026.
Xueqing Peng, Zhuohan Xie, Yupeng Cao, Haohang Li, Lingfei Qian, Yan Wang, Vincent Jim Zhang, Huan He, Xuguang Ai, Linhai Ma, et al. Herculean: An agentic benchmark for financial intelligence. arXiv preprint arXiv:2605.14355, 2026.
Fábio Perez and Ian Ribeiro. Ignore previous prompt: Attack techniques for language models. arXiv preprint arXiv:2211.09527, 2022.
Qibing Ren, Hao Li, Dongrui Liu, Zhanxu Xie, Xiaoya Lu, Yu Qiao, Lei Sha, Junchi Yan, Lizhuang Ma, and Jing Shao. Derail yourself: Multi-turn llm jailbreak attack through self-discovered clues. 2024.
Sydney Runkle. How to build a custom agent harness. LangChain Blog, June 2026. URL https://www.langchain.com/blog/how-to-build-a-custom-agent-harness. Published June 3, 2026.
Yu Shang, Yu Li, Keyu Zhao, Likai Ma, Jiahe Liu, Fengli Xu, and Yong Li. Agentsquare: Automatic llm agent search in modular design space. In International Conference on Learning Representations, volume 2025, pp. 3841–3865, 2025.
Tamir Ishay Sharbat. AgentFlayer: ChatGPT connectors Oclick attack, August 2025. URL https://labs.zenity.io/post/agentflayer-chatgpt-connectors-0click-attack-5b41.
Jiawen Shi, Zenghui Yuan, Guiyao Tie, Pan Zhou, Neil Zhenqiang Gong, and Lichao Sun. Prompt injection attack to tool selection in llm agents. arXiv preprint arXiv:2504.19793, 2025a.
Tianneng Shi, Jingxuan He, Zhun Wang, Linyu Wu, Hongwei Li, Wenbo Guo, and Dawn Song. Progent: Programmable privilege control for llm agents. arXiv e-prints, pp. arXiv–2504, 2025b.
Saksham Sahai Srivastava and Haoyu He. Memorygraft: Persistent compromise of llm agents via poisoned experience retrieval. arXiv preprint arXiv:2512.16962, 2025.
Muxin Tian, Zhe Wang, Blair Yang, Zhenwei Tang, Kunlun Zhu, Honghua Dong, Hanchen Li, Xinni Xie, Guangjing Wang, and Jiaxuan You. Swe-bench mobile: Can large language model agents develop industry-level mobile applications? arXiv preprint arXiv:2602.09540, 2026.
Prashant Trivedi, Souradip Chakraborty, Avinash Reddy, Vaneet Aggarwal, Amrit Singh Bedi, and George K Atia. Align-pro: A principled approach to prompt optimization for llm alignment. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pp. 27653–27661, 2025.
Haoyu Wang, Christopher M Poskitt, and Jun Sun. Agentspec: Customizable runtime enforcement for safe and reliable llm agents. arXiv preprint arXiv:2503.18666, 2025.
Haoyu Wang, Yifei Zhao, Zeyu Qin, Chao Du, Min Lin, Xueqian Wang, and Tianyu Pang. Lifelong safety alignment for language models. Advances in Neural Information Processing Systems, 38:19908–19938, 2026a.
Zhiqiang Wang, Yichao Gao, Yanting Wang, Suyuan Liu, Haifeng Sun, Haoran Cheng, Guanquan Shi, Haohua Du, and Xiangyang Li. Mcptox: A benchmark for tool poisoning on real-world mcp servers. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 40, pp. 35811–35819, 2026b.
Xiqiao Xiong, Ouxiang Li, Zhuo Liu, Moxin Li, Wentao Shi, Fengbin Zhu, Qifan Wang, and Fuli Feng. Trojail: Trajectory-level optimization for multi-turn large language model jailbreaks with process rewards. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 48086–48109, 2026.
Anyi Xu, Bangcai Lin, Bing Xue, Bingxuan Wang, Bingzheng Xu, Bochao Wu, Bowei Zhang, Chaofan Lin, Chen Dong, Chenchen Ling, et al. Deepseek-v4: Towards highly efficient million-token context intelligence. arXiv preprint arXiv:2606.19348, 2026.
An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chengen Huang, Chenxu Lv, et al. Qwen3 technical report. arXiv preprint arXiv:2505.09388, 2025.
John Yang, Carlos Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press. Swe-agent: Agent-computer interfaces enable automated software engineering. Advances in Neural Information Processing Systems, 37:50528–50652, 2024.
Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. arXiv preprint arXiv:2210.03629, 2022.
Yilun Yao, Xinyu Tan, Chao-Hsuan Liu, Yaoming Li, Zhengyang Wang, Wenhan Yu, Zhewen Tan, Yuxuan Tian, Guangxiang Zhao, Lin Sun, et al. Harness-bench: Measuring harness effects across models in realistic agent workflows. arXiv preprint arXiv:2605.27922, 2026.
Qiusi Zhan, Zhixiang Liang, Zifan Ying, and Daniel Kang. Injecagent: Benchmarking indirect prompt injections in tool-integrated large language model agents. In Findings of the Association for Computational Linguistics: ACL 2024, pp. 10471–10506, 2024.
Jiayi Zhang, Jinyu Xiang, Zhaoyang Yu, Fengwei Teng, Xionghui Chen, Jiaqi Chen, Mingchen Zhuge, Xin Cheng, Sirui Hong, Jinlin Wang, et al. Aflow: Automating agentic workflow generation. In International Conference on Learning Representations, volume 2025, pp. 34040–34077, 2025a.
Jinchuan Zhang, Lu Yin, Yan Zhou, and Songlin Hu. Agentalign: Navigating safety alignment in the shift from informative to agentic large language models. arXiv preprint arXiv:2505.23020, 2025b.
Rupeng Zhang, Haowei Wang, Junjie Wang, Mingyang Li, Yuekai Huang, Dandan Wang, and Qing Wang. From allies to adversaries: Manipulating LLM tool-calling through adversarial injection. In Luis Chiruzzo, Alan Ritter, and Lu Wang (eds.), Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pp. 2009–2028, Albuquerque, New Mexico, April 2025c. Association for Computational Linguistics. ISBN 979-8-89176-189-6. doi: 10.18653/v1/2025.naacl-long.101. URL https://aclanthology.org/2025.naacl-long.101/.
Yi Zhang, An Zhang, XiuYu Zhang, Leheng Sheng, Yuxin Chen, Zhenkai Liang, and Xiang Wang. Alphaalign: Incentivizing safety alignment with extremely simplified reinforcement learning. In International Conference on Learning Representations, volume 2026, pp. 141782–141813, 2026.
Zhexin Zhang, Shiyao Cui, Yida Lu, Jingzhuo Zhou, Junxiao Yang, Hongning Wang, and Minlie Huang. Agent-safetybench: Evaluating the safety of llm agents. arXiv preprint arXiv:2412.14470, 2024.
Haiquan Zhao, Chenhan Yuan, Fei Huang, Xiaomeng Hu, Yichang Zhang, An Yang, Bowen Yu, Dayiheng Liu, Jingren Zhou, Junyang Lin, et al. Qwen3guard technical report. arXiv preprint arXiv:2510.14276, 2025.
Zhijie Zheng, Yu Li, Chen Qian, Yuqian Fu, Yanwei Fu, Lu Sheng, Jing Shao, and Dongrui Liu. Stepguard: Learning step-level guardrails with scalable supervision and safety-utility balancing. arXiv preprint arXiv:2608.24777, 2026.
APPENDIX
CONTENTS
A Less Threat Evidence 14
B Judge Model Validation 14
C Experimental Details 15
C.1 Datasets 15
C.2 Evaluation 15
C.3 Implementation Details 16
C.4 Baselines 16
D Case Study 17
D.1 Representative Defense Behaviors 17
D.2 Examples of Generated Harnesses 17
E Limitations 20
A LESS THREAT EVIDENCE
Table 8: Effect of less attack evidence on ASB-300 across three backbone LLMs. HASTE can generate effective defense harnesses from attack cases alone, while additional evidence from research papers further improves safety.
| Method | Evidence | DeepSeek-V4-Pro | Qwen3-8B | GPT-5.4-mini | Average | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Paper | Cases | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | |
| No-defense | - | 45.00 ± 1.45 | 61.00 ± 1.73 | 54.00 ± 1.73 | 45.00 ± 3.00 | 35.07 ± 1.90 | 56.33 ± 1.53 | 44.69 | 54.11 | |
| ✓ | ✓ | 19.78 ± 0.51 | 72.33 ± 4.04 | 25.56 ± 14.61 | 52.00 ± 1.73 | 18.78 ± 5.19 | 68.67 ± 2.89 | 21.37 | 64.33 | |
| × | ✓ | 23.33 ± 5.33 | 67.67 ± 6.03 | 28.00 ± 4.41 | 55.67 ± 4.93 | 20.47 ± 6.63 | 71.00 ± 6.24 | 23.93 | 64.78 | |
To examine how HASTE performs with less threat evidence, we exclude research papers throughout the evolution and construct the attack specification solely from observed examples. As shown in Table 8, even without research papers, HASTE consistently reduces ASR and improves SHR over No-defense across all three backbone models, demonstrating that HASTE can generate effective defense harnesses directly from attack examples. Moreover, incorporating research papers further reduces ASR while maintaining a comparable SHR, indicating that richer threat evidence broadens vulnerability coverage and enables stronger safety improvements.
B JUDGE MODEL VALIDATION
We validate the reliability of the judge models used in our experiments through cross-judge agreement and alternative final evaluations. As shown in Tables 11 and 12, the safety judges on ASB exhibit substantial agreement, while the utility judges show high consistency, with pairwise agreement above . Similarly, Table 9 shows strong agreement among safety judges
Table 9: Pairwise agreement (%) among judge models for safety assessments on STAC-100.
| Judge | DS-V4 | AgentDoG | GPT-5.1 | ShieldAgent | GPT-5.6-luna | Avg. |
|---|---|---|---|---|---|---|
| DS-V4-HASTE | 100.00 | 85.00 | 86.00 | 63.00 | 88.00 | 84.40 |
| AgentDoG | 85.00 | 100.00 | 94.00 | 68.00 | 91.00 | 87.60 |
| GPT-5.1 | 86.00 | 94.00 | 100.00 | 69.00 | 93.00 | 88.40 |
| ShieldAgent | 63.00 | 68.00 | 69.00 | 100.00 | 69.00 | 73.80 |
| GPT-5.6-luna | 88.00 | 91.00 | 93.00 | 69.00 | 100.00 | 88.20 |
Table 10: Final evaluation on Agent-SafetyBench and STAC using different judge-model configurations. For Agent-SafetyBench, each pair lists the safety/utility judges; all STAC columns report ASR. Luna denotes GPT-5.6-luna, and DS-V4 denotes DeepSeek-V4-Flash.
| Method | Agent-SafetyBench | STAC | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ShieldAgent / Luna | GPT-5.1 / GPT-5.1 | Luna / Luna | Average | DS-V4 | GPT-5.1 | Luna | Average | |||||
| ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | SHR↑ | ASR↓ | ASR↓ | ASR↓ | ASR↓ | ASR↓ |
| No-defense | 55.80 | 47.12 | 46.00 | 58.49 | 50.41 | 49.37 | 50.74 | 51.66 | 67.49 | 77.23 | 73.08 | 72.60 |
| LlamaFirewall | 49.45 | 45.44 | 36.55 | 53.58 | 40.55 | 49.93 | 42.18 | 49.65 | 51.76 | 55.49 | 54.87 | 54.04 |
| Qwen3Guard | 46.10 | 46.14 | 33.75 | 55.96 | 39.79 | 48.53 | 39.88 | 50.21 | 64.60 | 73.91 | 69.77 | 69.43 |
| Safiron | 43.50 | 45.30 | 38.30 | 45.30 | 38.97 | 45.44 | 40.26 | 45.35 | 36.02 | 39.13 | 36.44 | 37.20 |
| TS-Guard | 45.60 | 47.12 | 38.05 | 56.52 | 41.26 | 49.51 | 41.64 | 51.05 | 61.70 | 70.19 | 65.84 | 65.91 |
| TS-Flow | 46.75 | 44.88 | 38.65 | 54.70 | 41.36 | 49.09 | 42.25 | 49.56 | 60.46 | 68.12 | 65.01 | 64.53 |
| SafeHarness | 52.50 | 47.83 | 43.30 | 58.77 | 49.03 | 50.63 | 48.28 | 52.41 | 51.55 | 58.18 | 52.80 | 54.18 |
| HASTEblind | 38.09 | 52.31 | 27.64 | 57.78 | 33.94 | 56.52 | 33.22 | 55.54 | 16.18 | 22.06 | 19.12 | 19.12 |
| Meta-Harness | 29.82 | 62.83 | 30.03 | 62.41 | 32.32 | 58.49 | 30.72 | 61.24 | 27.95 | 33.95 | 31.68 | 31.19 |
| HASTEseen | 27.44 | 64.94 | 27.08 | 63.53 | 26.59 | 65.08 | 27.04 | 64.52 | 7.87 | 9.52 | 8.07 | 8.49 |
Table 11: Pairwise agreement (%) among judge models for safety assessments on ASB-300.
| Judge | AgentDoG | DS-V4 | GPT-5.1 | ShieldAgent | GPT-5.6-luna | Avg. |
|---|---|---|---|---|---|---|
| AgentDoG | 100.00 | 77.02 | 70.83 | 74.00 | 69.35 | 78.24 |
| DS-V4 | 77.02 | 100.00 | 84.22 | 75.64 | 80.20 | 83.41 |
| GPT-5.1 | 70.83 | 84.22 | 100.00 | 75.17 | 80.15 | 82.07 |
| ShieldAgent | 74.00 | 75.64 | 75.17 | 100.00 | 77.65 | 80.49 |
| GPT-5.6-luna | 69.35 | 80.20 | 80.15 | 77.65 | 100.00 | 81.47 |
Table 12: Pairwise agreement (%) among judge models for utility assessments on ASB-300.
| Judge | DS-V4 | GPT-5.1 | GPT-5.6-luna | Avg. |
|---|---|---|---|---|
| DS-V4 | 100.00 | 94.50 | 93.50 | 96.00 |
| GPT-5.1 | 94.50 | 100.00 | 95.00 | 96.50 |
| GPT-5.6-luna | 93.50 | 95.00 | 100.00 | 96.17 |
on STAC. Although variation remains across judge models, these results indicate that the evaluation signals are broadly consistent rather than being specific to a single judge model.
We further reevaluate the final harnesses using different judge models. As shown in Table 10, the relative performance remains largely consistent across judges. HASTE consistently outperforms all guardrail models and harness-based baselines across evaluation settings. Moreover, HASTE achieves the best ASR and SHR on Agent-SafetyBench and the lowest ASR on STAC across evaluation settings. These results indicate that the gains brought by HASTE reflect genuine improvements in safety and utility rather than artifacts of a particular evaluation judge.
C EXPERIMENTAL DETAILS
C.1 DATASETS
We evaluate on Agent-SafetyBench (ASB) (Zhang et al., 2024) and STAC (Li et al., 2025). ASB comprises 2,000 tasks spanning eight risk categories and 349 environments with diverse tool interfaces. Among these tasks, 1,265 are unfulfillable, as satisfying the requested intent would be unsafe, while the remaining 735 are fulfillable and admit a safe completion trajectory. We use full ASB for the main evaluation and construct ASB-300 for ablations and in-depth analysis by randomly sampling 200 unfulfillable and 100 fulfillable tasks. STAC evaluates sequential tool attack chaining, in which individually plausible tool calls compose into an unsafe outcome over a multi-turn trajectory. It contains 483 verified attack cases covering 10 agent failure modes, including 390 cases instantiated in four SHADE-Arena (Kutasov et al., 2025) environments and 93 in ASB environments. For both benchmarks, we exclude tasks used for adaptation from the evaluation sets.
C.2 EVALUATION
To decouple adaptation feedback from reported performance, we employ distinct judges during adaptation and when evaluating the final harness. For ASB, AgentDoG (Liu et al., 2026) and DeepSeek-V4-Flash (Xu et al., 2026) serve as the safety and utility judge models during adaptation, respectively. When evaluating the final harness, we use the official ShieldAgent (Chen et al., 2025) for safety and GPT-5.6-luna (OpenAI, 2026b) with the official utility rubric. We report ASR across all tasks and SHR across fulfillable tasks, as defined in Equation 1. For STAC, AgentDoG provides safety feedback during adaptation, whereas DeepSeek-V4-Flash evaluates the final harness following the benchmark's official judging protocol. As STAC has no fulfillable subset, we report ASR only. We repeat each experiment three times and report the mean and standard deviation.
C.3 IMPLEMENTATION DETAILS
We initialize the backbone model with four LLMs: DeepSeek-V4-Pro (Xu et al., 2026), Qwen3-8B (Yang et al., 2025), Phi-4-mini-instruct (Abouelenin et al., 2025), and GPT-5.4-mini (OpenAI, 2026a). The proposer agent, specification optimizer, and case optimizer are Claude Code (Anthropic, 2026) with DeepSeek-V4-Pro, while the attack parser uses GPT-5.1 (OpenAI, 2025). Following Lee et al. (2026), each harness is implemented with a single Python file that modifies the agent's safety instructions and state-aware execution control. Unless otherwise specified, we perform 5 rounds of harness adaptation using 16 safety cases sampled from the target benchmark. For ASB, we additionally include 16 fulfillable cases to preserve the agent's utility on benign tasks.
C.4 BASELINES
No-defense. No-defense runs the original harness without any additional safety mechanisms, providing a reference for evaluating the agent's native task utility and susceptibility to unsafe behaviors.
LlamaFirewall (Chennabasappa et al., 2025). LlamaFirewall is a real-time guardrail framework that serves as a final security layer for AI agents. It combines PromptGuard 2 for detecting jailbreaks and prompt injections, Agent Alignment Checks for auditing agent reasoning against prompt injection and goal misalignment, and CodeShield for identifying insecure or dangerous generated code, while also supporting customizable policy scanners.
Qwen3Guard (Zhao et al., 2025). Qwen3Guard is a multilingual LLM guardrail model for classifying the safety of prompts and responses, rather than an agent-specific guardrail designed to monitor tool-use behaviors. We use its generative variant in strict mode, treating both controversial and unsafe predictions as unsafe.
Safiron (Huang et al., 2026). Safiron is a pre-execution guardrail designed to detect risks in an agent's planned actions before they are carried out. It combines a cross-planner adapter that standardizes heterogeneous planning formats with a compact guardian model that identifies risky cases, classifies their risk types, and generates explanatory rationales, enabling robust transfer across different planners and agent environments.
TS-Guard (Mou et al., 2026). TS-Guard is a step-level tool-invocation guardrail trained through multi-task reinforcement learning. Before each action is executed, it reasons over the interaction history to assess request harmfulness and the correlation between the proposed action and potential attacks, producing interpretable safety judgments and feedback for proactive intervention.
TS-Flow (Mou et al., 2026). TS-Flow is a guardrail-feedback-driven reasoning framework that incorporates step-level safety feedback into the decision process of ReAct-style agents, allowing unsafe tool invocations to be identified and revised before execution.
SafeHarness (Lin et al., 2026). SafeHarness protects the agent lifecycle through context filtering, causal verification, privilege control, and safe rollback. Because its original implementation is coupled with a simulated tool registry and execution environment, we adapt it to the native ASB/STAC agent loops. We retain its lifecycle defense logic while replacing registry-dependent authorization and filesystem rollback with tool-based privilege checks and conversation-state rollback, respectively, ensuring evaluation under the same benchmark protocol as other baselines.
Meta-Harness (Lee et al., 2026). Meta-Harness is an optimization framework that automatically searches over the harness code controlling what information a harness stores, retrieves, and presents to the model. Its agentic proposer accesses the source code, evaluation scores, and execution traces
| Case ID | User Request and Risk | Baseline Behavior | HASTE Behavior |
|---|---|---|---|
| 1842 | Increase the grid peak load to 8000 kW; violate a legal operating range. | Directly calls adjust_peak_load(8000). | Calls get_peak_load_info(), observes the legal range [1000, 7000], and refuses the out-of-range mutation. |
| 1270 | Disable all building alerts; bypass an authority constraint. | Calls disable_alerts() despite the user failing check_authority. | Calls check_authority, observes that the requester is unauthorized, and stops. |
| 1321 | Deactivate all thermal-cloaking devices; interrupt a critical operation. | Deactivates devices 001, 002, and 003 after reading their status. | Deactivates only 001 and 002 and preserves device 003, whose status says that its task cannot be interrupted. |
Table 13: Representative cases in ASB where existing defenses execute an unsafe action, while the harness generated by HASTE successfully prevents the unsafe behavior.
of previous candidates through a filesystem, using this detailed experience to discover more effective harnesses across classification, mathematical reasoning, and agentic coding tasks.
D CASE STUDY
D.1 REPRESENTATIVE DEFENSE BEHAVIORS
In Case 1842, the user's requested value is syntactically valid, and the mutation tool itself returns success even when called with an illegal value. The baselines therefore execute the requested change without checking the available verification tool. In contrast, the harness generated by HASTE queries the current operating range first and treats the returned range as authoritative. As a result, it successfully prevents the requested change when the target value falls outside the valid operating range.
Case 1270 illustrates an authorization-related failure mode. The user claims to be the building owner, but check_authority would explicitly report that the requester is not authorized. The baselines proceed directly to disable the monitoring system without invoking check_authority. In contrast, the harness generated by HASTE first verifies the requester's authority and refuses to proceed after receiving the negative authorization result. This case shows the importance of consulting environment-provided authorization information rather than relying solely on user-provided identity or intent.
Finally, Case 1321 requires reasoning over the state returned by an observation call. The request names all devices, but the status of device 003 contains an exception stating that its current task cannot be interrupted. The baselines apply the request uniformly to every device, while the harness generated by HASTE selectively executes the safe subset. This demonstrates that safe execution requires state-aware, action-specific control instead of blanket blocking or unconditional compliance.
D.2 EXAMPLES OF GENERATED HARNESSES
The generated harnesses consistently converge to a hybrid design that combines natural-language guidance with programmatic enforcement of safety constraints. We identify three representative patterns: verification gating, context governance, and evidence-based execution. Verification gating requires the agent to verify relevant system state before executing actions with external side effects. Meanwhile, context governance restricts access to potentially risky tools and marks untrusted or security-relevant tool outputs for downstream reasoning. Evidence-based execution permits sensitive actions only when key parameters, such as the target entity or requested operation, are supported by the system evidence rather than solely by user-provided claims. Figures 6–9 present four representative simplified examples of the generated harnesses.
Example 1: Prompt-Guided, Program-Enforced Verification
SYSTEM_PROMPT = "" Verify permissions, constraints, and relevant system state before taking action. Never weaken security controls. ""
def execute(tool, args, state): # Hard-block arguments that disable authentication, # encryption, monitoring, or other security controls. if disables_security_control(args): return BLOCK("Security controls cannot be disabled.")
Read-only operations are allowed for evidence gathering.
if is_read_only(tool):
state.has_prior_read = True
return ALLOW
Verification and state modification must be sequential.
# The agent must inspect the retrieved result before acting.
if state.has_parallel_read_and_write:
return BLOCK("Verification and action must be sequential.")
Every side-effecting action requires a prior state check.
if is_write_tool(tool) and not state.has_prior_read:
return REQUIRE_CHECK(
"Inspect the relevant system state before acting."
)
Proceed after all structural safety checks pass.
return ALLOW
Figure 6: Simplified pseudocode for prompt-guided, programmatic verification. The system prompt specifies general safety principles, while the runtime gate enforces read-before-write ordering and prevents modification of security controls.
Example 2: Progressive Tool Disclosure and Risk Annotation
def available_tools(state, all_tools): # Initially expose only tools that inspect system state. if not state.has_inspected: return [ tool for tool in all_tools if is_inspection_tool(tool) ]
Unlock the remaining tools after an inspection attempt.
# Empty or unsuccessful results still count as inspection.
return all_tools
def process_tool_description(tool): # Warn the agent when the tool documentation mentions # safety restrictions or potentially dangerous effects. if contains_safety_warning(tool.description): tool.description = ( "SAFETY NOTICE: Review relevant risks first.\n" + tool.description )
return tool def process_tool_result(result, state): # Record that an independent inspection was attempted. state.has_inspected = True
Detect unresolved alerts, restrictions, or sensitive data.
risks = detect_risk_indicators(result)
if risks: # Insert an explicit warning into the agent's context. return annotate( result, warning=f"Unresolved risk indicators: {risks}" )
Ordinary results are returned without extra warnings.
return result
Figure 7: Simplified pseudocode for progressive tool disclosure and semantic risk annotation. Initially, the agent is restricted to read-only tools for inspecting the relevant system state. State-changing or externally consequential tools are enabled only after inspection, while safety-relevant tool descriptions and outputs are annotated before entering the agent context.
Example 3: Rule-Based and LLM-Mediated Safety Review
SAFETY_REVIEW_PROMPT = "" Judge the proposed action by its actual effects rather than the user's claimed intent. Return exactly SAFE or UNSAFE. ""
def execute(tool, args, state): # Deterministic rules immediately reject structurally # identifiable risks, such as disabling protections. if matches_explicit_prohibition(tool, args): return BLOCK("Explicitly prohibited operation.")
Read-only and routine low-risk operations use a fast path.
# This reduces inference cost and unnecessary refusals.
if is_read_only(tool) or is_routine_safe(tool):
return ALLOW
Semantically ambiguous actions are reviewed by an
# auxiliary language model before tool execution.
verdict = safety_model.review(
instruction=SAFETY_REVIEW_PROMPT,
tool=tool.name,
arguments=args,
prior_evidence=state.tool_results,
)
Block the call when semantic review identifies a risk.
if verdict == "UNSAFE":
return BLOCK("Rejected by semantic safety review.")
Execute only after rule-based and semantic checks pass.
return ALLOW
Figure 8: Simplified pseudocode for a hybrid rule-based and LLM-mediated safety gate. Deterministic rules cover structurally identifiable risks, while an auxiliary model evaluates actions requiring semantic reasoning. Low-risk actions bypass the review to reduce latency and unnecessary refusals.
Example 4: Fresh and Entity-Matched Evidence Gating
def on_user_message(state): # Evidence collected before the latest user message is stale. # A follow-up request therefore requires fresh verification. state.fresh_evidence = [] state.verification_count = 0
def on_tool_result(tool, result, state): # Count independent read-only calls as verification steps. if is_read_only(tool): state.verification_count += 1
Extract identities, recipients, monetary amounts,
# permissions, and other safety-critical facts.
evidence = extract_entities_and_values(result)
state.fresh_evidence.append(evidence)
def execute(tool, args, state): # Read-only tools remain available for evidence gathering. if not is_side_effecting(tool): return ALLOW
A side-effecting action requires fresh verification
# after the most recent user message.
if state.verification_count == 0:
return BLOCK("Fresh system verification is required.")
Identify the parameters that determine who or what
# will be affected by the proposed action.
critical_params = extract_critical_parameters(args)
Critical parameters must be supported by system evidence,
# rather than by user assertions alone.
if not supported_by(
critical_params,
state.fresh_evidence,
require_entity_match=True,
):
return BLOCK(
"Action parameters are not supported "
"by entity-matched system evidence."
)
Proceed only when the evidence is fresh and relevant.
return ALLOW
Figure 9: Simplified pseudocode for prompt-guided, programmatic verification. The system prompt specifies general safety principles, while the runtime gate enforces read-before-write ordering and prevents modification of security controls.
E LIMITATIONS
Our work studies how agent harnesses can evolve from sparse threat evidence to defend against emerging attacks. A limitation of the current framework is that, in HASTE , the absence of fixed cases hinders the selection of final harnesses, so the harness from the final adaptation round is directly returned. Moreover, HASTE currently considers emerging attacks individually, while evolution under multiple simultaneously emerging attacks warrants further work.