Instructions to use AI45Research/AgentDoG-Step-Qwen3.5-0.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AI45Research/AgentDoG-Step-Qwen3.5-0.8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AI45Research/AgentDoG-Step-Qwen3.5-0.8B") 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-0.8B") model = AutoModelForMultimodalLM.from_pretrained("AI45Research/AgentDoG-Step-Qwen3.5-0.8B", 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-0.8B 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-0.8B" # 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-0.8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AI45Research/AgentDoG-Step-Qwen3.5-0.8B
- SGLang
How to use AI45Research/AgentDoG-Step-Qwen3.5-0.8B 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-0.8B" \ --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-0.8B", "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-0.8B" \ --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-0.8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AI45Research/AgentDoG-Step-Qwen3.5-0.8B with Docker Model Runner:
docker model run hf.co/AI45Research/AgentDoG-Step-Qwen3.5-0.8B
- AgentDoG2: An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks
๐ GitHub | ๐ค Models and Datasets | ๐ Technical report [Coming soon] | ๐ Project Page | ๐ฌ Demos | ๐ Getting Started
AgentDoG2: An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks
Model Zoo ยท Benchmarks ยท Results ยท SafeRSI
This repository: AI45Research/AgentDoG-Step-Qwen3.5-0.8B
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.
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 first learns the expanded taxonomy and structured output format through supervised fine-tuning (SFT), then uses Group Reward-Decoupled Normalization Policy Optimization (GDPO) to refine verdicts and diagnostic fields.
- AgentDoG-Jev scores allowed labels at mapped decision positions in one forward pass. Binary and fine-grained exports use their own decision schemas.
- AgentDoG-Step trains on the interaction history and pending action using SFT and GDPO. Its judgment is made before the action's outcome becomes visible.
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-0.8B --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-0.8B 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))
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 expanded 2.0 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.
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.
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 attributes discovered failures and routes improvements to the execution harness, the policy, or both. Harness evolution produces natural-language guidance or deterministic runtime constraints; policy evolution learns corrective continuations synthesized from observed failures. AgentDoG-Step adds periodic runtime assessment.
| 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 denote the harness and policy after the first/second evolution round. โ 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 the mechanism figures and 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
- -
Model tree for AI45Research/AgentDoG-Step-Qwen3.5-0.8B
Base model
Qwen/Qwen3.5-0.8B-Base