LONG-HORIZON AGENT SAFETY & SECURITY
AgentDoG logo

AgentDoG2

An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks

A unified framework for characterizing, evaluating, and mitigating
the risks of agents that plan, use tools, and retain state.

Shanghai Artificial Intelligence Laboratory
JEV · ATBENCH
59.8ms

Single-pass binary judgment

Unified-4B · mean decision latency

JEV · ATBENCH BINARY JUDGMENT
up to184.9×

Lower decision latency

vs. corresponding AgentDoG 1.5 variants

STEP 4B · THREE BENCHMARKS
94.0%

Mean worst-class recall

Pre-execution safety · unweighted mean

FEATURED DEMOS

Watch the risks unfold

Two 22-second reconstructions show how legitimate tasks
cross authorization and scope boundaries.

TRACE-BASED RECONSTRUCTIONS
Video language

From product lookup to unauthorized database access

A routine product lookup expands into autonomous probing, an authentication bypass, and access to internal business records.

22 sEnglish

Reconstructed from real agent traces. Selected sensitive details are redacted; displayed records are illustrative.

Open video
Read the scenario walkthrough

    These reconstructions illustrate the safety challenge; the videos do not show a live guardrail intervention.

    Media credits & license

    THE AGENTDOG2 FRAMEWORK

    Safety across the entire trajectory

    Risks unfold across tools, memory, permissions, and time.
    AgentDoG2 connects the pieces into a shared diagnostic and defense framework.

    Characterize

    Expanded taxonomy

    18 / 21 / 11

    Evaluate

    ATBench-Pro
    ManipulationArena

    Guard

    2 / Jev / Step

    Diagnose & intercept

    Evolve

    Harness + Policy

    Failure-driven adaptation

    Faster trajectory checks

    Earlier action-level intervention

    Stronger execution and model defenses

    AGENTDOG FAMILY

    Three complementary guardrails

    Structured diagnosis, single-pass decisions, and checks before execution.

    TRAINING & INFERENCE ARCHITECTURE
    Three guardrail variants built for different inference and intervention requirements. Source: AgentDoG2 technical manuscript.
    { }

    STRUCTURED DIAGNOSIS

    AgentDoG2

    Directly generates a structured trajectory-level judgment using the expanded risk taxonomy, without generating a Chain of Thought.

    CoT-freeFine-grained diagnosis

    SINGLE-PASS DECISIONS

    AgentDoG-Jev

    Reads the trajectory and decision schema in one forward pass to predict structured safety fields and normalized confidence scores.

    No autoregressive decodingLow decision latency

    PRE-EXECUTION PROTECTION

    AgentDoG-Step

    Assesses the proposed action against visible interaction history. A short rationale and structured diagnosis support preventive risk interception.

    Action-level checksBefore execution

    Which guard fits which decision?

    CAPABILITY COMPARISON
    Variant Input Decision mechanism Use case
    AgentDoG2 Agent trajectory Direct structured generation Taxonomy-aware safety diagnosis
    AgentDoG-Jev Trajectory + decision schema Single-pass field readout Frequent trajectory checks
    AgentDoG-Step History + candidate action Pre-execution judgment Preventive intervention

    PERFORMANCE

    Efficiency you can measure.
    Protection before execution.

    Reported results from the active technical manuscript.
    Binary judgment, fine-grained diagnosis, and pre-execution safety are evaluated separately.

    AgentDoG2

    Structured diagnosis across longer trajectories

    The base generative guard reports both binary safety and fine-grained risk diagnosis.

    81.7% ATBench unsafe F1 · 2B
    41.9% ATBench-Pro fine-grained mean · 4B
    18.6× maximum latency speedup vs. matched 1.5-U
    Model ATBench
    Unsafe F1 ↑ (%)
    ATBench-Pro
    Unsafe F1 ↑ (%)
    ATBench
    Fine-grained mean ↑ (%)
    ATBench-Pro
    Fine-grained mean ↑ (%)
    AgentDoG2 0.8B 76.1 58.6 38.5 32.3
    AgentDoG2 2B 81.7 69.4 44.7 41.4
    AgentDoG2 4B 76.7 69.7 41.6 41.9
    AgentDoG2 8B 75.3 71.8 44.1 36.3
    AgentDoG2 9B 76.3 64.2 42.3 38.7

    Fine-grained diagnosis is evaluated on unsafe trajectories. Its mean is the unweighted accuracy average for risk source, failure mode, and real-world harm. Latency speedups depend on benchmark and model size; the 18.6× maximum is measured on R-Judge.

    AgentDoG-Jev

    A decision in one forward pass

    Read structured decisions directly, instead of decoding a full answer token by token.

    103.9–184.9×ATBench binary latency speedup vs. corresponding 1.5 variants
    ATBENCH · UNIFIED-4BLower latency is better
    AgentDoG 1.5~6.52 s
    AgentDoG-Jev59.8 ms
    109.0×lower latency
    for this model pair

    ATBench · 4B-U binary judgment. The baseline is approximate, inferred from the reported 109.0× ratio. This measures guard decision latency.

    Binary safety judgment

    Model / Benchmark Latency Unsafe F1
    Jev Unified-4BATBench 59.8 ms 77.90%
    Jev 4BATBench-Pro 1.465 s 68.94%

    Fine-grained speedup: 4.4–13.4× on ATBench; 1.64–8.88× on ATBench-Pro. Accuracy is evaluated separately.

    JEV · MEASURED LATENCY
    Binary judgment and fine-grained diagnosis on ATBench and ATBench-Pro. Each arrow compares matched AgentDoG 1.5 and Jev checkpoints.
    How single-pass structured inference works
    The confidence values in this architectural example illustrate the output format; they are not benchmark measurements.
    AgentDoG-Step

    Catch the risk before the tool call

    Evaluate the candidate action using the interaction history, before it changes the environment.

    94.0%mean worst-class recall · Step 4B
    94.7%Mean accuracy
    87.5%Mean unsafe F1

    Worst-class recall takes the lower of safe recall and unsafe recall, so both safe behavior and risk interception matter.

    Pre-execution safety comparison

    Model Accuracy (%) Unsafe F1 (%) Worst-class recall (%)
    AgentDoG-Step 4B HIGHLIGHT 94.7 87.5 94.0
    Gemini-3.8-Flash 94.9 85.4 93.3
    GLM-5.3 91.8 76.3 90.9
    AgentDoG-Step 9B 92.9 84.5 90.2
    DeepSeek-V4.1-Flash 90.3 71.8 89.8
    AgentDoG-Step 8B 93.7 80.8 88.4
    AgentDoG-Step 2B 93.4 82.2 86.2
    StepGuard-4B 93.4 83.3 81.8
    AgentDoG-Step 0.8B 88.3 71.1 77.8

    Unweighted means across TS-Bench-Dojo, TS-Bench-ASB, and StepShield. Model names and values follow the manuscript. Worst-class recall is calculated per benchmark before averaging.

    STEP · BENCHMARK RESULTS
    Original pre-execution safety evaluation. These results use a different task and protocol from Jev's full-trajectory evaluation.

    SAFETY TAXONOMY

    Trace the source. Explain the failure.
    Understand the harm.

    Three diagnostic dimensions connect what enters a workflow to what the agent does and what may follow.

    18

    Risk sources

    Where the risk comes from

    21

    Failure modes

    How the agent fails

    11

    Real-world harms

    What consequences may follow

    EXPANDED THREE-DIMENSIONAL TAXONOMY
    A shared diagnostic scaffold for long-horizon, stateful agent workflows. Click the figure to inspect individual categories.

    RISK IN CONTEXT

    See how a workflow becomes unsafe

    Explore three illustrative scenarios, from the user's original goal to the guard's intervention point.

    ILLUSTRATIVE WALKTHROUGH

    USER GOAL

    SELECTED STAGE

    candidate_actionBEFORE EXECUTION

    GUARD DECISION

    Structured risk diagnosis

    Source
    Failure
    Harm
    SAFE CONTINUATION

    BENCHMARKS & ADVERSARIAL DISCOVERY

    Test the risks that emerge over time

    From broad trajectory diagnosis to covert goal manipulation in live agent interaction.

    LONG-HORIZON SAFETY DIAGNOSIS

    ATBench-Pro: Safety beyond isolated turns

    Evaluate complete long-horizon trajectories, where safe decisions depend on earlier evidence, evolving permissions, persistent memory, and downstream obligations. The updated benchmark contains 1,000 trajectories averaging 48.98 tool calls and 57.51k tokens.

    1,000 trajectories
    48.98 mean tool calls / trajectory
    57.51k mean tokens / trajectory
    Benchmark Cases Mean tool calls Mean tokens
    R-Judge 564 1.79 0.47k
    ASSE-Safety 1,476 1.49 0.47k
    ASSE-Security 817 1.62 0.78k
    ATBench500 500 3.49 1.52k
    ATBench 1,000 2.97 3.95k
    HINTBench (v2) 596 6.92† 4.78k†

    Manuscript-reported statistics. k = 1,000 tokens. †HINTBench averages use 566 publicly released test trajectories; its reported case count is 596.

    EXECUTION-GROUNDED ADVERSARIAL EVALUATION

    ManipulationArena: Expose covert goal manipulation

    888 reusable attack plans span seven strategies and six channels across 30 long-horizon tasks. Each plan adapts to the target agent's live execution, with trajectories averaging 24.12 response turns and 23.35 tool-call steps.

    888 reusable attack plans
    30 long-horizon tasks
    42 strategy–channel configurations

    A compositional attack space

    Failure modes annotate observed violations after execution.

    7 strategies × 6 channels = 42 configurations
    Benchmark Cases Strategies Channels Mean interaction length
    AgentDojo 629 4 1 3.49 steps
    AutoControl Arena 280 2 — —
    AgentLAB 644 5 3 —
    SHADE-Arena 17 1 1 ≈25 turns
    AgentDyn 560 4 1 7.10 steps

    Step = one tool call; turn = one agent response. Lengths are means in their stated units. — = unavailable. Each stored attack plan adapts to the target agent’s live execution.

    MANIPULATIONARENA · COVERAGE
    Strategy and channel distributions over 888 cases. These are separate marginal distributions.
    OFFLINE PLANNING

    Build an attack blueprint

    Analyze the legitimate task and locate candidate intervention points in task-native information carriers.

    LIVE GROUNDING

    Adapt to the actual trajectory

    Adjust the carrier, timing, and payload form as the agent's real interaction unfolds.

    TWO-PHASE ATTACK GENERATION
    Offline blueprints are grounded against the live trajectory; unsuccessful attempts inform blueprint revision.

    SAFE RECURSIVE SELF-IMPROVEMENT

    SafeRSI: Evolving safer agents

    Combine external AgentDoG protection with improvements to the execution harness and policy model.

    MEASURED SAFETY & UTILITY

    Stronger defenses, measured across two rounds

    Evaluate harness–policy co-evolution with and without AgentDoG-Step, alongside general-agent baselines.

    21.40% ManipulationArena ASR · V1 + Step
    21.07% AgentLAB ASR · V2 + Step
    3.69% AutoControl-Arena ASR · V2 + Step
    67.39% BFCL-v3 accuracy · V1 + Step

    ManipulationArena · ASR ↓

    DSH + Qwen3.8-27B 65.84%
    SafeRSI V1 + Step 21.40%
    SafeRSI V2 + Step 24.21%
    BASELINE → V1 + STEP −44.44 pp

    ManipulationArena ASR falls from 65.84% to 21.40%: a 67.50% relative reduction against DSH + Qwen3.8-27B.

    Harness / policy AgentDoG-Step AgentLAB
    ASR ↓ (%)
    AutoControl-Arena
    ASR ↓ (%)
    ManipulationArena
    ASR ↓ (%)
    BFCL-v3
    Acc ↑ (%)
    Claude Code Opus 5.5 — 25.99 2.26 56.24 72.60
    Codex GPT-6.1-sol — 35.76 3.59 64.59 66.70
    DeepSeek Harness Qwen3.8-27B — 35.11 13.69 65.84 75.34
    SafeRSI Harness V1 SafeRSI-27B V1 — 28.66 7.62 28.04 66.72
    SafeRSI Harness V2 SafeRSI-27B V2 — 26.54 7.38 25.68 65.17

    ASR = attack success rate (lower is better); BFCL-v3 Acc = function-calling accuracy (higher is better). V1/V2 denote the harness and policy after the first/second evolution round. — means without AgentDoG-Step. Percentages follow the manuscript’s blue-team evaluation table.

    Safety and utility, side by side

    V1 + Step reaches 67.39% BFCL-v3 accuracy versus 75.34% for the base agent (−7.95 percentage points). Lower ASR comes with a measurable utility trade-off.

    Round V2 has mixed outcomes

    With Step, V2 lowers ASR on AgentLAB and AutoControl-Arena, while V1 retains lower ManipulationArena ASR and higher BFCL-v3 accuracy.

    Where attacks succeed: per-strategy ASR

    Attack success rate (%, lower is better). The reported average is the unweighted mean across seven strategies.

    Harness / policy Role-play Decomposition Sleeper Criteria Self-preservation Oversight evasion Obstruction Macro avg.
    Claude Code Opus 5.5 51.80 51.45 36.64 52.55 44.19 24.47 66.67 46.82
    Codex GPT-6.1-sol 44.60 59.42 48.85 62.04 84.50 41.49 38.33 54.18
    DeepSeek Harness DeepSeek-V4.1-flash 82.01 83.33 78.63 82.48 74.42 56.38 63.33 74.37
    KimiCode Kimi-3.1 pro 67.63 71.01 64.12 69.34 94.57 73.40 47.50 69.65
    ZCode GLM-5.3 58.27 63.04 50.38 68.61 72.87 51.06 50.00 59.18
    DeepSeek Harness Qwen3.8-27B 64.03 67.39 65.65 72.26 75.19 63.83 52.50 65.84

    This reproduces the manuscript’s strategy-level diagnostic evaluation. Claude Code and Codex aggregates differ from the blue-team table; these reported aggregates are kept separate and are not used for cross-table comparisons.

    Discover

    Adaptive adversarial testing

    Attribute

    Structural or semantic gaps

    Improve

    Harness and policy updates

    Validate

    Safety and task utility

    HARNESS EVOLUTION

    Make execution boundaries enforceable

    Attribute observed failures, group shared principles, and produce natural-language policies or deterministic guards. Validate candidates on paired safety and utility tasks before adoption.

    ATTRIBUTION · PATCHES · VALIDATION
    Numerical thresholds shown in this diagram are validation gates, not measured performance improvements.
    POLICY EVOLUTION

    Learn a safer way to complete the task

    Convert recorded failures into corrective continuations, review them in text space, and fine-tune the policy to preserve the legitimate goal while respecting safety constraints.

    FAILURE-DERIVED CORRECTIVE TRAINING
    Failures become corrective demonstrations through environment-free synthesis and textual review, then support supervised policy updates. This manuscript diagram illustrates a single policy update; V1/V2 above denote reported harness–policy co-evolution rounds.

    PROJECT RESOURCES

    Explore the AgentDoG ecosystem

    Project code, published resources, and earlier releases.

    Model weights are available in the AgentDoG2 collection. ATBench-Pro and ManipulationArena now have dedicated documentation pages; downloadable benchmark data and the public technical report remain in preparation.

    Scroll to inspect the figure · Press Esc to close