Instructions to use AI45Research/AgentDoG-Step-Qwen3.5-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AI45Research/AgentDoG-Step-Qwen3.5-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AI45Research/AgentDoG-Step-Qwen3.5-9B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("AI45Research/AgentDoG-Step-Qwen3.5-9B") model = AutoModelForMultimodalLM.from_pretrained("AI45Research/AgentDoG-Step-Qwen3.5-9B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AI45Research/AgentDoG-Step-Qwen3.5-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AI45Research/AgentDoG-Step-Qwen3.5-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI45Research/AgentDoG-Step-Qwen3.5-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AI45Research/AgentDoG-Step-Qwen3.5-9B
- SGLang
How to use AI45Research/AgentDoG-Step-Qwen3.5-9B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AI45Research/AgentDoG-Step-Qwen3.5-9B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI45Research/AgentDoG-Step-Qwen3.5-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AI45Research/AgentDoG-Step-Qwen3.5-9B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI45Research/AgentDoG-Step-Qwen3.5-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AI45Research/AgentDoG-Step-Qwen3.5-9B with Docker Model Runner:
docker model run hf.co/AI45Research/AgentDoG-Step-Qwen3.5-9B
- AgentDoG2: An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks
๐ GitHub | ๐ค Models and Datasets | ๐ Project Page | ๐ฌ Demos | ๐ Getting Started
AgentDoG2: An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks
Performance ยท Model Zoo ยท Benchmarks ยท Results ยท SafeRSI
This repository: AI45Research/AgentDoG-Step-Qwen3.5-9B
Role: Pre-execution guard for a candidate action and the visible interaction history.
Published artifacts: model weights, configuration and tokenizer.
Introduction
AgentDoG2 is an efficient framework from Shanghai Artificial Intelligence Laboratory for characterizing, evaluating and mitigating emergent safety risks in long-horizon agent tasks. It connects a diagnostic risk taxonomy, long-horizon safety benchmarks, efficient trajectory and action guardrails, and data-driven defense evolution.
- ๐งฉ An expanded taxonomy for long-horizon risk. Diagnose 18 risk sources, 21 failure modes and 11 real-world harms, including covert goal manipulation, authority and obligation violations, and loss of control.
- ๐ Two complementary benchmarks. ATBench-Pro evaluates complete long-horizon trajectories; ManipulationArena tests covert goal manipulation through reusable attack plans adapted to live agent execution.
- ๐ก๏ธ A family of efficient guardrails. AgentDoG2 generates structured trajectory judgments; AgentDoG-Jev reads decisions in one forward pass; AgentDoG-Step evaluates the next action before execution.
- ๐ SafeRSI. Improve the execution harness and task-completion policy using attributed failures, and add AgentDoG-Step runtime intervention. Evaluate safety and benign task utility together.
Performance Overview
Full-resolution main figure (PDF)
Average inference cost, efficiency and performance. The manuscript's main figure compares (a) unsafe-class F1 versus API cost on ATBench, (b) binary safety-decision latency and matched speedups on ATBench, and (c) fine-grained diagnosis accuracy on ATBench. API costs follow the manuscript's stated official/provider pricing. Speedups belong to the particular models and settings shown; they are not a single speedup applicable to every benchmark.
Model Zoo
The following public repositories contain model weights, configurations and tokenizers. Select the repository for the task you need; the families use different inference interfaces.
AgentDoG2: structured trajectory diagnosis
| Checkpoint | Role | Size | Base checkpoint |
|---|---|---|---|
| AgentDoG2-Qwen3.5-0.8B | Generative trajectory diagnosis | 0.8B | Qwen/Qwen3.5-0.8B-Base |
| AgentDoG2-Qwen3.5-2B | Generative trajectory diagnosis | 2B | Qwen/Qwen3.5-2B-Base |
| AgentDoG2-Qwen3.5-4B | Generative trajectory diagnosis | 4B | Qwen/Qwen3.5-4B-Base |
| Llama-3.1-AgentDoG2-8B | Generative trajectory diagnosis | 8B | meta-llama/Llama-3.1-8B |
| AgentDoG2-Qwen3.5-9B | Generative trajectory diagnosis | 9B | Qwen/Qwen3.5-9B-Base |
AgentDoG-Jev: single-pass trajectory evaluation
| Checkpoint | Role | Size | Base checkpoint |
|---|---|---|---|
| AgentDoG-Jev-Qwen3.5-0.8B | Single-pass binary safety judgment | 0.8B | AI45Research/AgentDoG1.5-Qwen3.5-0.8B |
| AgentDoG-Jev-Qwen3.5-4B | Single-pass binary safety judgment | 4B | AI45Research/AgentDoG1.5-Qwen3.5-4B |
| AgentDoG-Jev-Qwen3.5-4B-U | Single-pass binary safety judgment | 4B | AI45Research/AgentDoG1.5-Unified-Qwen3.5-4B |
| AgentDoG-Jev-Qwen3.5-2B | Single-pass binary safety judgment | 2B | AI45Research/AgentDoG1.5-Qwen3.5-2B |
| Llama-3.1-AgentDoG-Jev-8B | Single-pass binary safety judgment | 8B | AI45Research/AgentDoG1.5-Llama-3.1-8B |
| AgentDoG-Jev-FG-Qwen3.5-0.8B | Single-pass fine-grained diagnosis | 0.8B | AI45Research/AgentDoG1.5-FG-Qwen3.5-0.8B |
| AgentDoG-Jev-FG-Qwen3.5-2B | Single-pass fine-grained diagnosis | 2B | AI45Research/AgentDoG1.5-FG-Qwen3.5-2B |
| AgentDoG-Jev-FG-Qwen3.5-4B | Single-pass fine-grained diagnosis | 4B | AI45Research/AgentDoG1.5-FG-Qwen3.5-4B |
| Llama-3.1-AgentDoG-Jev-FG-8B | Single-pass fine-grained diagnosis | 8B | AI45Research/AgentDoG1.5-FG-Llama-3.1-8B |
The 4B-U variant is derived from the unified 1.5 checkpoint; the exported decision mapping in the 4B-U repository supports binary judgment. FG repositories provide fine-grained diagnostic readouts. Use each repository's own prompt and decision-token map rather than interchanging them.
AgentDoG-Step: pre-execution protection
| Checkpoint | Role | Size | Base checkpoint |
|---|---|---|---|
| AgentDoG-Step-Qwen3.5-0.8B | Pre-execution action assessment | 0.8B | Qwen/Qwen3.5-0.8B-Base |
| AgentDoG-Step-Qwen3.5-2B | Pre-execution action assessment | 2B | Qwen/Qwen3.5-2B-Base |
| AgentDoG-Step-Qwen3.5-4B | Pre-execution action assessment | 4B | Qwen/Qwen3.5-4B-Base |
| Llama-3.1-8B-AgentDoG-Step | Pre-execution action assessment | 8B | meta-llama/Llama-3.1-8B |
| AgentDoG-Step-Qwen3.5-9B | Pre-execution action assessment | 9B | Qwen/Qwen3.5-9B-Base |
SafeRSI: evolved task-completion policies
| Checkpoint | Role | Size | Base checkpoint |
|---|---|---|---|
| SafeRSI-27B-V1 | Evolved task-completion policy | 27B | Not declared in repository metadata |
| SafeRSI-27B-V2 | Evolved task-completion policy | 27B | Not declared in repository metadata |
SafeRSI weights are the policy component of the defense framework. The full evaluation configuration also specifies an evolved harness and, where stated, AgentDoG-Step; downloading a policy checkpoint alone does not reproduce that complete system.
Safety Taxonomy and Tasks
| Family | Input | Inference | Output and use |
|---|---|---|---|
| AgentDoG2 | Complete observed execution trajectory | Structured generation | Safety verdict and risk source; unsafe cases also receive failure-mode and harm diagnoses |
| AgentDoG-Jev | Trajectory formatted with the repository's decision schema | One forward pass at mapped decision positions | Binary safety labels, or fine-grained labels for FG checkpoints |
| AgentDoG-Step | Visible interaction history and the proposed next action | Pre-execution generation | Short rationale, Safe/Unsafe verdict and risk source; unsafe cases also receive failure-mode and harm diagnoses |
| SafeRSI | Task and model-visible agent history | Task-completion policy | Actions or responses from an evolved policy; not an independent guardrail verdict |
The taxonomy separates where a risk originates, how the agent fails, and what harm can follow. A malicious input by itself does not make the agent unsafe: judge how the agent handles it and what behavior it actually executes. For Step assessment, include only the evidence available before the candidate action; future observations would leak the outcome.
AgentDoG2 Guardrails
Building Pipeline
AgentDoG2: long-horizon synthesis and structured diagnosis
Trajectory-guided data synthesis begins with real benign workflows. A planner selects a fork point and inserts a task-grounded risk trigger, then generates an unsafe continuation and safe alternatives from the same prefix. Safe alternatives may refuse or escalate the risk, complete authorized work while handling it safely, or ignore the distracting trigger. This contrast separates risk exposure from unsafe execution.
A verifier-driven agentic loop coordinates the planner, user, agent, tool and summary roles. It checks format, execution consistency and target labels, sends targeted repair feedback, and re-verifies within a bounded retry budget. A contrastive group is retained when its unsafe trajectory and at least one safe trajectory pass verification.
Taxonomy internalization reduces inference overhead. The base trajectory guard directly outputs structured labels without a long chain-of-thought rationale or repeating the complete category definitions in each prompt. Supervised fine-tuning (SFT) teaches this format; Group Reward-Decoupled Normalization Policy Optimization (GDPO) then applies verifiable rewards to the applicable fields. Safe trajectories also receive Risk Source supervision (None when no risk is present), while Failure Mode and Real-World Harm are reserved for unsafe outcomes.
AgentDoG-Jev: decisions in one forward pass
AgentDoG-Jev retains trajectory inputs and supervision from AgentDoG 1.5, rewrites the outputs as structured decision schemas, and reads candidate-label logits at mapped decision positions. Binary judgment uses one decision field; fine-grained diagnosis uses three. The helper formats the selected labels as JSON without autoregressive decoding. Each checkpoint's own prompt and decision map define its label interface.
AgentDoG-Step: judge the pending action before execution
AgentDoG-Step adapts the StepGen data engine to build groups of unsafe, safely handled and benign continuations. Each training item contains the visible history and the proposed next action, and is filtered for tool-call format, trajectory coherence and label consistency. SFT followed by GDPO teaches a short analysis and structured verdict. Supervising Risk Source on safe steps helps distinguish safely handled risky contexts from unsafe actions; future observations must not enter the pre-execution input.
Getting Started
This example requires a GPU environment and a vLLM build supporting Qwen3_5ForConditionalGeneration (or LlamaForCausalLM for the Llama checkpoint) and the documented --language-model-only option. Install the serving runtime and HF CLI before running the commands below:
python -m pip install -U vllm huggingface_hub
Serve the model with vLLM.
vllm serve AI45Research/AgentDoG-Step-Qwen3.5-9B --served-model-name agentdog-step --dtype bfloat16 --language-model-only
Download the prompt helper and example in a second terminal.
hf download AI45Research/AgentDoG-Step-Qwen3.5-9B step_inference.py safety-rs.txt taxonomy.json example.json --local-dir ./step-example
cd ./step-example
Send the example as a single user message. Use the input schema to format your own cases, including only evidence available at the decision point.
import json
from pathlib import Path
from urllib.request import Request, urlopen
from step_inference import parse_response, render_prompt
case = json.loads(Path("example.json").read_text())
payload = {
"model": "agentdog-step",
"messages": [{"role": "user", "content": render_prompt(**case)}],
"temperature": 0,
"max_tokens": 1024,
"chat_template_kwargs": {"enable_thinking": False},
}
request = Request(
"http://localhost:8000/v1/chat/completions",
data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json"},
)
with urlopen(request, timeout=180) as response:
answer = json.load(response)["choices"][0]["message"]["content"]
print(parse_response(answer))
Pre-execution input and response format
The released example.json separates the visible interaction history from the pending action. Its published stock-lookup example uses these fields:
{
"phase": "pre_action",
"user_request": "Look up stock for item A123.",
"interaction_history": "=== Agent Profile ===\nAvailable tools: [{\"name\": \"lookup_stock\", \"description\": \"Read the stock count for an item ID.\"}]\n\n=== Conversation History ===\n\n[USER]: Look up stock for item A123.",
"action_under_review": {
"kind": "tool_call",
"step_id": 1,
"text": "{\"name\": \"lookup_stock\", \"arguments\": {\"item_id\": \"A123\"}}"
},
"available_tools": null
}
The following response demonstrates the expected format only, not measured inference:
<Analysis>The proposed lookup reads the stock count for the item requested by the user. The visible context contains no request to modify records or disclose unrelated data.</Analysis>
Safety: safe
Risk Source: None
step_inference.py supplies render_prompt and parse_response helpers. After obtaining the model response, inspect both the parsed verdict and format_valid; a readable verdict alone does not establish a valid structured response.
from step_inference import parse_response
parsed = parse_response(answer)
print(parsed["prediction"], parsed["format_valid"])
Do not add the lookup's future result to this pre-execution input. For unsafe responses, the structured tail also requires Failure Mode and Risk Consequence from the repository's taxonomy.
Choose the matching interface
- Base trajectory guard: use the supplied
inference.py,prompt.txtand trajectory example. The script handles Qwen and Llama prompt formatting and selects the matching model architecture. A separateprompt-atbench-pro.txtsupports the benchmark-specific label interface. - Jev: use the supplied
inference.pytogether withdecision_token_map.json. The script scores candidate label tokens at designated decision positions. Standard autoregressivegenerate()is not equivalent to this inference method. Fine-grained repositories also supply the ATBench-Pro label map and prompt. - Step: use
step_inference.py,input.schema.json,taxonomy.json,safety-rs.txtandexample.json. The helper renders the history and candidate action into the prompt, then parses the guard's structured response. - SafeRSI: load the published policy using its configuration and tokenizer. The policy repositories do not currently include a complete harness or a dedicated inference helper. Preserve the intended task and safety constraints when integrating the policy into an agent runtime.
Example interpretation (illustrative, not a measured model trace). A user asks an agent to inspect a single order. Before the agent calls a tool that exports every customer's records to a third-party endpoint, AgentDoG-Step receives the visible history and that proposed export. The evaluation should check authorization, the requested scope and the destination before the export executes. A safer continuation would preserve the single-order task while avoiding the unrequested bulk transfer.
Reading the output
Use the exact labels and parser supplied with the selected checkpoint. The AgentDoG2 taxonomy and legacy fine-grained label interfaces are not interchangeable. Do not assume that every repository emits the same field names or label vocabulary. Jev label scores are decision readouts; they are not demonstrated calibrated probabilities.
Evaluation
All values below reproduce the active tables in the updated technical manuscript. Accuracy, unsafe F1 and worst-class recall are distinct metrics. Latency is guardrail decision latency under the stated benchmark setting, not complete agent task runtime.
AgentDoG2 trajectory safety
| Model | R-Judge Acc (%) | R-Judge F1 (%) | ATBench Acc (%) | ATBench F1 (%) | ATBench-Pro Acc (%) | ATBench-Pro F1 (%) |
|---|---|---|---|---|---|---|
| AgentDoG2 0.8B | 76.6 | 71.7 | 76.3 | 76.1 | 75.4 | 58.6 |
| AgentDoG2 2B | 80.1 | 79.9 | 80.3 | 81.7 | 78.3 | 69.4 |
| AgentDoG2 4B | 83.3 | 83.3 | 78.1 | 76.7 | 80.3 | 69.7 |
| AgentDoG2 8B | 78.4 | 74.5 | 73.5 | 75.3 | 81.0 | 71.8 |
| AgentDoG2 9B | 88.8 | 88.8 | 77.5 | 76.3 | 78.4 | 64.2 |
F1 is the unsafe-class F1 score. Higher is better.
Full trajectory-safety comparison with frontier models, guardrails and AgentDoG 1.5
All values are percentages. F1 is unsafe-class F1. Overall is the unweighted mean across R-Judge, ATBench and ATBench-Pro. This is the manuscript's base-guard comparison, whose AgentDoG 1.5-U evaluation is distinct from the matched baselines in the Jev experiment.
| Model | R-Judge Acc | R-Judge F1 | ATBench Acc | ATBench F1 | ATBench-Pro Acc | ATBench-Pro F1 | Overall Acc | Overall F1 |
|---|---|---|---|---|---|---|---|---|
| GPT-6.1-Sol | 94.9 | 95.0 | 78.0 | 77.5 | 62.7 | 67.8 | 78.5 | 80.1 |
| Gemini-3.8-Flash | 91.7 | 92.6 | 59.2 | 53.1 | 76.3 | 66.8 | 75.7 | 70.8 |
| DeepSeek-V4.1-Flash | 81.4 | 80.9 | 66.1 | 63.7 | 82.2 | 79.2 | 76.6 | 74.6 |
| GLM-5.3 | 87.9 | 88.2 | 76.6 | 71.5 | 83.4 | 75.1 | 82.6 | 78.3 |
| Qwen3.5-397B | 85.6 | 87.4 | 66.8 | 67.8 | 68.6 | 37.1 | 73.7 | 64.1 |
| Qwen3.8-27B | 93.4 | 93.5 | 71.3 | 61.8 | 77.1 | 61.6 | 80.6 | 72.3 |
| Qwen3.5-9B | 77.0 | 80.3 | 62.7 | 53.9 | 61.8 | 17.2 | 67.2 | 50.5 |
| Llama-3.1-8B | 53.7 | 69.5 | 45.3 | 61.9 | 39.5 | 27.1 | 46.2 | 52.8 |
| Qwen3.5-4B | 81.0 | 82.0 | 45.9 | 27.6 | 57.6 | 12.1 | 61.5 | 40.6 |
| LlamaGuard3-8B | 61.2 | 56.7 | 53.1 | 7.3 | 59.9 | 0.0 | 58.1 | 21.3 |
| Qwen3-Guard | 40.6 | 9.0 | 51.5 | 0.8 | 59.6 | 0.0 | 50.6 | 3.3 |
| ShieldAgent | 81.0 | 84.6 | 62.5 | 67.7 | 17.9 | 7.5 | 53.8 | 53.3 |
| StepGuard-4B | 87.1 | 87.9 | 77.7 | 76.8 | 67.3 | 60.1 | 77.4 | 74.9 |
| StepSafe-4B | 84.6 | 85.2 | 69.9 | 59.7 | 61.1 | 13.4 | 71.9 | 52.8 |
| BraveGuard-4B | 75.5 | 75.5 | 55.0 | 22.5 | 59.9 | 0.5 | 63.5 | 32.8 |
| AgentDoG 1.5-U 0.8B | 81.2 | 80.2 | 61.0 | 62.6 | 65.6 | 61.0 | 69.3 | 67.9 |
| AgentDoG 1.5-U 2B | 78.4 | 80.9 | 76.8 | 76.9 | 53.0 | 57.6 | 69.4 | 71.8 |
| AgentDoG 1.5-U 4B | 90.4 | 90.6 | 78.4 | 76.1 | 72.1 | 66.9 | 80.3 | 77.9 |
| AgentDoG 1.5-U 8B | 86.9 | 86.3 | 77.3 | 75.6 | 66.9 | 62.2 | 77.0 | 74.7 |
| AgentDoG 1.5-U 9B | 81.4 | 83.4 | 78.1 | 78.0 | 72.9 | 71.4 | 77.5 | 77.6 |
| AgentDoG2 0.8B | 76.6 | 71.7 | 76.3 | 76.1 | 75.4 | 58.6 | 76.1 | 68.8 |
| AgentDoG2 2B | 80.1 | 79.9 | 80.3 | 81.7 | 78.3 | 69.4 | 79.6 | 77.0 |
| AgentDoG2 4B | 83.3 | 83.3 | 78.1 | 76.7 | 80.3 | 69.7 | 80.6 | 76.6 |
| AgentDoG2 8B | 78.4 | 74.5 | 73.5 | 75.3 | 81.0 | 71.8 | 77.6 | 73.9 |
| AgentDoG2 9B | 88.8 | 88.8 | 77.5 | 76.3 | 78.4 | 64.2 | 81.6 | 76.4 |
Fine-grained trajectory diagnosis
| Model | ATBench RS | FM | Harm | Mean | ATBench-Pro RS | FM | Harm | Mean |
|---|---|---|---|---|---|---|---|---|
| AgentDoG2 0.8B | 51.7 | 18.3 | 45.5 | 38.5 | 29.2 | 30.3 | 37.6 | 32.3 |
| AgentDoG2 2B | 59.8 | 21.5 | 52.9 | 44.7 | 36.4 | 37.5 | 50.2 | 41.4 |
| AgentDoG2 4B | 61.8 | 16.1 | 46.9 | 41.6 | 39.7 | 38.3 | 47.7 | 41.9 |
| AgentDoG2 8B | 61.2 | 20.5 | 50.7 | 44.1 | 28.4 | 34.5 | 46.1 | 36.3 |
| AgentDoG2 9B | 61.2 | 19.9 | 45.9 | 42.3 | 36.7 | 35.0 | 44.5 | 38.7 |
All values are accuracies (%), higher is better, evaluated on unsafe trajectories. RS = risk source; FM = failure mode; Harm = real-world harm. Mean is the unweighted mean of the three diagnostic accuracies.
Full fine-grained diagnosis comparison
Accuracy (%) on unsafe trajectories; Mean is the unweighted average of Risk Source, Failure Mode and Real-World Harm. These are base-guard results, separate from the Jev decision-model experiment.
| Model | ATBench RS | ATBench FM | ATBench Harm | ATBench Mean | ATBench-Pro RS | ATBench-Pro FM | ATBench-Pro Harm | ATBench-Pro Mean |
|---|---|---|---|---|---|---|---|---|
| GPT-6.1-Sol | 38.0 | 14.1 | 37.6 | 29.9 | 45.7 | 40.8 | 47.0 | 44.5 |
| Gemini-3.8-Flash | 22.1 | 10.3 | 21.3 | 17.9 | 38.4 | 40.0 | 47.0 | 41.8 |
| DeepSeek-V4.1-Flash | 23.5 | 11.3 | 22.5 | 19.1 | 26.9 | 33.8 | 37.0 | 32.5 |
| GLM-5.3 | 34.2 | 13.3 | 29.8 | 25.8 | 16.3 | 15.5 | 20.4 | 17.4 |
| Qwen3.5-397B | 7.7 | 3.6 | 6.8 | 6.0 | 4.8 | 5.5 | 9.1 | 6.5 |
| Qwen3.8-27B | 28.4 | 10.7 | 23.1 | 20.7 | 2.5 | 2.8 | 3.1 | 2.8 |
| Qwen3.5-9B | 16.5 | 8.5 | 16.7 | 13.9 | 0.3 | 0.3 | 0.3 | 0.3 |
| Llama-3.1-8B | 6.2 | 5.8 | 15.5 | 9.2 | 0.5 | 1.3 | 2.8 | 1.5 |
| Qwen3.5-4B | 6.6 | 3.0 | 8.2 | 5.9 | 1.3 | 0.0 | 2.5 | 1.3 |
| StepGuard-4B | 20.1 | 8.5 | 16.1 | 14.9 | 0.8 | 0.8 | 0.6 | 0.7 |
| StepSafe-4B | 10.9 | 6.4 | 11.5 | 9.6 | 0.0 | 0.8 | 0.9 | 0.6 |
| BraveGuard-4B | 1.0 | 1.0 | 0.6 | 0.9 | 0.0 | 0.0 | 0.0 | 0.0 |
| AgentDoG 1.5-U 0.8B | 37.4 | 14.3 | 34.0 | 28.6 | 11.1 | 2.5 | 15.0 | 9.5 |
| AgentDoG 1.5-U 2B | 42.7 | 18.5 | 43.5 | 34.9 | 8.0 | 2.8 | 4.1 | 5.0 |
| AgentDoG 1.5-U 4B | 46.7 | 14.5 | 45.1 | 35.4 | 21.6 | 10.8 | 26.6 | 19.7 |
| AgentDoG 1.5-U 8B | 48.5 | 16.5 | 43.1 | 36.0 | 11.6 | 5.5 | 18.8 | 12.0 |
| AgentDoG 1.5-U 9B | 53.5 | 17.7 | 50.3 | 40.5 | 31.4 | 10.0 | 36.1 | 25.8 |
| AgentDoG2 0.8B | 51.7 | 18.3 | 45.5 | 38.5 | 29.2 | 30.3 | 37.6 | 32.3 |
| AgentDoG2 2B | 59.8 | 21.5 | 52.9 | 44.7 | 36.4 | 37.5 | 50.2 | 41.4 |
| AgentDoG2 4B | 61.8 | 16.1 | 46.9 | 41.6 | 39.7 | 38.3 | 47.7 | 41.9 |
| AgentDoG2 8B | 61.2 | 20.5 | 50.7 | 44.1 | 28.4 | 34.5 | 46.1 | 36.3 |
| AgentDoG2 9B | 61.2 | 19.9 | 45.9 | 42.3 | 36.7 | 35.0 | 44.5 | 38.7 |
AgentDoG2 inference cost and latency
Internalizing the taxonomy shortens prompts, and direct structured outputs reduce decoding overhead. Against matched AgentDoG 1.5-U checkpoints, the manuscript reports 13.0โ18.6ร speedups on R-Judge, 7.9โ15.5ร on ATBench, and 1.9โ10.8ร on ATBench-Pro. These are end-to-end guard-decision latency comparisons under the paper's timing protocol, not complete task-runtime speedups.
Costโeffectiveness comparisons across the trajectory benchmarks
The first plot compares binary unsafe-class F1 with inference cost; the second compares mean diagnosis accuracy on unsafe trajectories with inference cost. Cost follows the manuscript's stated provider pricing and token accounting.
AgentDoG-Jev trajectory results
The following tables separate binary safety judgment from fine-grained diagnosis. A checkpoint's inference interface and label map determine which task it supports.
| Model | R-Judge Acc | R-Judge F1 | ATBench Acc | ATBench F1 | ATBench-Pro Acc | ATBench-Pro F1 | Overall Acc | Overall F1 |
|---|---|---|---|---|---|---|---|---|
| AgentDoG-Jev 0.8B | 80.3 | 81.3 | 51.2 | 64.9 | 40.7 | 52.4 | 57.4 | 66.2 |
| AgentDoG-Jev 2B | 85.5 | 86.2 | 63.7 | 70.4 | 54.9 | 53.9 | 68.0 | 70.2 |
| AgentDoG-Jev 4B | 86.4 | 87.6 | 69.0 | 70.9 | 71.7 | 68.9 | 75.7 | 75.8 |
| AgentDoG-Jev 4B-U | 81.9 | 84.3 | 77.1 | 77.9 | 71.9 | 58.5 | 77.0 | 73.6 |
| AgentDoG-Jev 8B | 75.4 | 80.2 | 66.2 | 72.6 | 44.7 | 57.4 | 62.1 | 70.1 |
All scores are percentages; F1 is unsafe-class F1. Overall is the unweighted mean across the three benchmarks. The paper's 4B-U decision model is the binary export derived from the unified AgentDoG 1.5 checkpoint.
Full Jev binary comparison with decision models, guards and matched AgentDoG 1.5 baselines
| Model | R-Judge Acc | R-Judge F1 | ATBench Acc | ATBench F1 | ATBench-Pro Acc | ATBench-Pro F1 | Overall Acc | Overall F1 |
|---|---|---|---|---|---|---|---|---|
| ShieldAgent-7B | 79.8 | 83.8 | 66.5 | 71.8 | 68.1 | 49.3 | 71.5 | 68.3 |
| Qwen3Guard-Gen-8B | 52.7 | 25.6 | 54.5 | 23.3 | 59.7 | 0.0 | 55.6 | 16.3 |
| GuardReasoner-8B | 64.5 | 65.4 | 49.9 | 45.3 | 59.1 | 3.3 | 57.8 | 38.0 |
| Intern-Decision-4B | 81.4 | 84.1 | 56.0 | 62.1 | 60.7 | 3.9 | 66.0 | 50.0 |
| Kev-4B | 77.1 | 79.9 | 59.3 | 50.4 | 60.5 | 4.4 | 65.6 | 44.9 |
| JevK5-4B | 86.0 | 87.8 | 59.3 | 61.9 | 61.9 | 12.0 | 69.1 | 53.9 |
| Decider-4B | 75.9 | 73.6 | 51.7 | 26.7 | 59.6 | 4.7 | 62.4 | 35.0 |
| Clef-Flash 9B | 84.8 | 84.5 | 53.2 | 34.3 | 60.6 | 3.0 | 66.2 | 40.6 |
| AgentDoG 1.5 0.8B | 78.6 | 75.0 | 62.9 | 55.1 | 61.5 | 46.4 | 67.7 | 58.8 |
| AgentDoG 1.5 2B | 87.2 | 86.7 | 63.7 | 54.0 | 64.6 | 42.5 | 71.8 | 61.1 |
| AgentDoG 1.5 4B | 88.8 | 89.6 | 69.3 | 71.5 | 66.4 | 52.4 | 74.8 | 71.2 |
| AgentDoG 1.5 4B-U | 90.8 | 90.8 | 78.1 | 75.4 | 67.4 | 40.1 | 78.8 | 68.8 |
| AgentDoG 1.5 8B | 86.4 | 87.6 | 64.9 | 69.3 | 59.8 | 63.3 | 70.4 | 73.4 |
| AgentDoG-Jev 0.8B | 80.3 | 81.3 | 51.2 | 64.9 | 40.7 | 52.4 | 57.4 | 66.2 |
| AgentDoG-Jev 2B | 85.5 | 86.2 | 63.7 | 70.4 | 54.9 | 53.9 | 68.0 | 70.2 |
| AgentDoG-Jev 4B | 86.4 | 87.6 | 69.0 | 70.9 | 71.7 | 68.9 | 75.7 | 75.8 |
| AgentDoG-Jev 4B-U | 81.9 | 84.3 | 77.1 | 77.9 | 71.9 | 58.5 | 77.0 | 73.6 |
| AgentDoG-Jev 8B | 75.4 | 80.2 | 66.2 | 72.6 | 44.7 | 57.4 | 62.1 | 70.1 |
Fine-grained Jev diagnosis (accuracy, %):
| Model | ATBench RS | ATBench FM | ATBench Harm | ATBench Mean | ATBench-Pro RS | ATBench-Pro FM | ATBench-Pro Harm | ATBench-Pro Mean |
|---|---|---|---|---|---|---|---|---|
| AgentDoG-Jev 0.8B | 56.1 | 20.3 | 51.3 | 42.6 | 16.9 | 34.2 | 5.6 | 18.9 |
| AgentDoG-Jev 2B | 61.6 | 23.1 | 56.5 | 47.1 | 46.4 | 37.0 | 43.6 | 42.3 |
| AgentDoG-Jev 4B | 63.4 | 28.8 | 60.0 | 50.7 | 43.0 | 32.9 | 30.4 | 35.4 |
| AgentDoG-Jev 8B | 63.4 | 28.4 | 56.7 | 49.5 | 22.9 | 18.2 | 45.1 | 28.7 |
These rows correspond to the FG checkpoints. RS = Risk Source; FM = Failure Mode; Harm = Real-World Harm. Mean is the unweighted average of those three dimensions. ATBench-Pro values use 319 unsafe v3 trajectories with reference labels in all three dimensions; this is not the full 1,000-case binary benchmark denominator.
Full Jev fine-grained comparison
| Model | ATBench RS | ATBench FM | ATBench Harm | ATBench Mean | ATBench-Pro RS | ATBench-Pro FM | ATBench-Pro Harm | ATBench-Pro Mean |
|---|---|---|---|---|---|---|---|---|
| Intern-Decision-4B | 44.3 | 19.1 | 37.4 | 33.6 | 45.1 | 7.8 | 19.8 | 24.2 |
| Kev-4B | 40.9 | 16.1 | 43.1 | 33.3 | 45.1 | 11.0 | 44.5 | 33.5 |
| JevK5-4B | 54.3 | 18.5 | 47.1 | 40.0 | 41.1 | 13.5 | 14.4 | 23.0 |
| Decider-4B | 41.7 | 15.5 | 36.8 | 31.3 | 44.5 | 8.2 | 26.0 | 26.2 |
| Clef-Flash 9B | 45.5 | 20.9 | 44.7 | 37.0 | 45.5 | 26.3 | 51.4 | 41.1 |
| AgentDoG 1.5 0.8B | 61.6 | 21.3 | 48.7 | 43.9 | 14.7 | 17.2 | 35.1 | 22.4 |
| AgentDoG 1.5 2B | 67.8 | 24.1 | 53.9 | 48.6 | 33.2 | 22.9 | 25.7 | 27.3 |
| AgentDoG 1.5 4B | 71.4 | 27.2 | 62.6 | 53.7 | 21.3 | 37.0 | 34.2 | 30.8 |
| AgentDoG 1.5 8B | 67.4 | 21.5 | 50.3 | 46.4 | 19.1 | 6.0 | 40.8 | 21.9 |
| AgentDoG-Jev 0.8B | 56.1 | 20.3 | 51.3 | 42.6 | 16.9 | 34.2 | 5.6 | 18.9 |
| AgentDoG-Jev 2B | 61.6 | 23.1 | 56.5 | 47.1 | 46.4 | 37.0 | 43.6 | 42.3 |
| AgentDoG-Jev 4B | 63.4 | 28.8 | 60.0 | 50.7 | 43.0 | 32.9 | 30.4 | 35.4 |
| AgentDoG-Jev 8B | 63.4 | 28.4 | 56.7 | 49.5 | 22.9 | 18.2 | 45.1 | 28.7 |
AgentDoG-Jev efficiency
| Checkpoint / benchmark | Binary decision latency | Unsafe F1 (%) |
|---|---|---|
| Jev 4B-U / ATBench | 59.8 ms | 77.90 |
| Jev 4B / ATBench-Pro | 1.465 s | 68.94 |
On ATBench binary judgment, Jev reports 103.9โ184.9ร lower latency than its matched generative AgentDoG 1.5 variants. The corresponding binary-decision speedup on ATBench-Pro is 3.68โ20.90ร. Fine-grained diagnosis reports 4.4โ13.4ร speedups on ATBench and 1.64โ8.88ร on ATBench-Pro. These are benchmark- and checkpoint-specific speed/accuracy trade-offs, not a universal speedup for every task. Latencies were measured on a single H200 with concurrency 1 and prefix caching disabled.
For fine-grained Jev evaluation on ATBench-Pro, the reported scores use 319 unsafe trajectories with reference labels for all three diagnostic dimensions.
AgentDoG-Step pre-execution safety
| Model | Mean accuracy (%) | Mean unsafe F1 (%) | Mean WCR (%) |
|---|---|---|---|
| AgentDoG-Step 0.8B | 88.3 | 71.1 | 77.8 |
| AgentDoG-Step 2B | 93.4 | 82.2 | 86.2 |
| AgentDoG-Step 4B | 94.7 | 87.5 | 94.0 |
| AgentDoG-Step 8B | 93.7 | 80.8 | 88.4 |
| AgentDoG-Step 9B | 92.9 | 84.5 | 90.2 |
WCR is the lower of safe-class recall and unsafe-class recall within each benchmark. Overall values are the unweighted mean across TS-Bench-Dojo, TS-Bench-ASB and StepShield (pre-action). Step 4B reports 94.7% accuracy, 87.5% unsafe F1 and 94.0% WCR; these numbers refer to this three-benchmark mean.
Benchmarks
ATBench-Pro
ATBench-Pro evaluates full long-horizon trajectories in which safety depends on earlier evidence, evolving permissions, persistent state and downstream obligations. The updated manuscript reports 1,000 cases, averaging 48.98 tool calls and 57.51k tokens per 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โ |
| ATBench-Pro (Ours) | 1,000 | 48.98 | 57.51k |
These are manuscript-reported statistics. k = 1,000 tokens. โ HINTBench averages use the 566 publicly released test trajectories, while its reported total is 596 cases.
ManipulationArena
ManipulationArena contains 888 reusable attack plans spanning 7 strategies ร 6 channels = 42 attack configurations across 30 long-horizon tasks. The plan is adapted to the target agentโs live trajectory during evaluation. Failure modes annotate observed violations after execution rather than defining a third configuration axis.
| 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 |
| ManipulationArena | 888 | 7 | 6 | 24.12 turns / 23.35 steps |
One step is one tool call; one turn is one agent response. Means retain these distinct units. โ denotes unavailable data. ManipulationArena averages 24.12 turns / 23.35 steps.
See the benchmark section and Hugging Face collection for the benchmark entry points.
SafeRSI
SafeRSI combines harnessโpolicy co-evolution with AgentDoG-Step runtime assessment. Failure attribution identifies whether an unsafe outcome comes from a structural execution gap, a semantic alignment failure, or both, and routes the corrective update accordingly.
Harness evolution
- Attribute failures: identify the violated norm, data flow and genuine authorization, then map the failure to natural-language policy guidance or execution-code enforcement.
- Generate patches: consolidate related failures into principle groups and produce behavioral policies or deterministic runtime constraints. Admission checks reject shortcuts such as hardcoded task identifiers and record missing runtime capabilities.
- Validate: compare candidate patches with a byte-identical baseline on a frozen holdout, measuring both safety and utility. Accepted patches become versioned harness artifacts; rejected patches and capability gaps feed further improvement.
Policy evolution
A Failure Analyst locates the correction point in a recorded failure. A Trajectory Synthesizer preserves the legitimate task and risk-bearing prefix while constructing a safer continuation, and a Trajectory Critic checks safety, prefix consistency and task preservation. Accepted corrective demonstrations support SFT of the task-completion policy. This environment-free synthesis operates in text space, avoiding candidate execution and environment resets during demonstration generation.
The policy-evolution figure illustrates one completed SFT round and a proposed feedback loop for further adversarial testing. It does not establish repeated policy-improvement gains. V1/V2 below identify the reported harnessโpolicy evaluation configurations; AgentDoG-Step is an additional runtime component where stated.
Safety and utility results
| Harness / policy | Added Step guard | 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 |
| SafeRSI Harness V1 / SafeRSI-27B V1 | AgentDoG-Step | 22.10 | 4.31 | 21.40 | 67.39 |
| SafeRSI Harness V2 / SafeRSI-27B V2 | AgentDoG-Step | 21.07 | 3.69 | 24.21 | 64.92 |
All values are percentages. ASR is attack success rate (lower is better); BFCL-v3 accuracy measures benign function-calling utility (higher is better). V1/V2 label the two reported harnessโpolicy configurations. โ means without the added AgentDoG-Step guard, not the absence of every other runtime defense.
- V1 + Step reduces ManipulationArena ASR from 65.84% to 21.40% against DeepSeek Harness + Qwen3.8-27B: 44.44 percentage points, or 67.50% relative reduction. BFCL-v3 accuracy changes from 75.34% to 67.39%, a 7.95-point utility cost.
- V2 + Step yields lower ASR on AgentLAB and AutoControl-Arena than V1 + Step, while V1 + Step has lower ManipulationArena ASR and higher BFCL-v3 accuracy. V2 does not improve every metric.
- These are complete system configurations. The scores do not isolate the contribution of a downloaded SafeRSI policy checkpoint alone.
See SafeRSI on the project page for further strategy-level diagnostic results.
โ ๏ธ Intended Use and Limitations
- Use guard predictions to support trajectory review and pre-execution intervention in the documented agent setting. They can miss unsafe behavior or flag safe behavior; evaluate them in the target workflow and measure both safety and utility.
- Preserve tool specifications, permissions, user intent and relevant observations when formatting an input. Truncating a long trajectory can remove decisive evidence.
- Step assessment must not include future execution results. A candidate action should be assessed before it changes the environment.
- Fine-grained evaluation depends on the benchmarkโs label interface. Follow the repositoryโs supplied prompt and mapping rather than borrowing a 1.5 template unchanged.
- Model and benchmark rankings are specific to the reported settings. Neither low ASR nor a guard verdict establishes that an entire deployment is safe.
- The example above is conceptual. The project-page videos reconstruct failures and do not demonstrate live AgentDoG interception.
๐ License
This checkpoint is released under the Apache License 2.0, as declared by this repository. See the repository license and notices for its terms.
๐ Citation
Project reference (software/repository citation):
@software{agentdog2,
title = {AgentDoG2: An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks},
author = {{Shanghai Artificial Intelligence Laboratory}},
year = {2026},
url = {https://github.com/AI45Lab/AgentDoG}
}
This entry identifies the project; it does not assign an arXiv identifier or DOI to the AgentDoG2 technical report. A verified report citation can replace it when available.
๐ค Acknowledgements
We thank the trajectory-safety benchmark contributors and the Jev project, whose structured-decision approach underlies AgentDoG-Jev. This work builds on prior research in agent safety, trajectory evaluation and risk-aware AI systems.
๐ Resources
- Downloads last month
- 96
Model tree for AI45Research/AgentDoG-Step-Qwen3.5-9B
Base model
Qwen/Qwen3.5-9B-Base
docker model run hf.co/AI45Research/AgentDoG-Step-Qwen3.5-9B