# Repository Briefing: AI45Lab/AgentDoG
> Source: https://repoforai.com/repo/AI45Lab/AgentDoG (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/AI45Lab/AgentDoG
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Python
- **License**: See repository
- **Engineering Health**: B+ (64/100 · Maintenance 35/35 · Adoption 12/25 · Releases 11/20 · License 6/20)
- **Review Snapshot**: 2026-12-02
- **Momentum**: 851 ★ total (+40 24h / +145 7d) · 42 forks
- **When to Use**: Best for: Teams that operate long-running, tool-using agents with changing permissions and need trace audits, pre-execution checks, or a benchmark-backed evaluation workflow. Skip if: You need a turnkey authorization gateway, guaranteed enforcement, or a commercially cleared package without integrating and validating a model.

## Overview
```text
### Architecture & Core Mechanics
AgentDoG separates post-run auditing from pre-execution review. AgentDoG2 takes a completed trajectory and emits a verdict or diagnostic labels without generating a chain of thought. Jev scores allowed labels at designated JSON schema positions in one forward pass. Step evaluates a pending tool call or reply against the history and returns a short analysis and verdict. For long-running tasks, the distinction matters: Step needs the original request and the authorization still in force, not just the latest tool arguments.

The Python project includes a Transformers trajectory-auditing example and versioned templates under `prompts/v2.0/`, with separate directories for AgentDoG2, Jev, and Step. AgentDoG2 and Step use supervised fine-tuning followed by GDPO; Step also learns from risk-source feedback on safe steps. SafeRSI adds a separate feedback loop: failure traces inform harness rules or runtime checks, and reviewed safer continuations train the policy model. The integration surfaces shown are checkpoints, prompts, examples, and harness code, not a documented plugin protocol.

### Key Capabilities & Differentiators
AgentDoG2 and Step offer Qwen3.5 checkpoints at 0.8B, 2B, 4B, and 9B, plus Llama-3.1 8B. Jev offers Qwen3.5 variants at 0.8B, 2B, and 4B and a Llama-3.1 8B variant. The v2 taxonomy has 18 risk-source labels, 21 failure modes, and 11 harm labels. An unsafe diagnosis includes all three dimensions; a safe diagnosis can name the risk source or return `None`, so exposure to a risky instruction is distinguishable from acting on it.

The reported results favor different checkpoints for different jobs. AgentDoG2 2B reached 81.7% unsafe-class F1 on ATBench; on ATBench-Pro, AgentDoG2 8B reached 81.0% accuracy and 71.8% unsafe-class F1. Step 4B reached 87.5% overall unsafe-class F1 and 94.0% worst-class recall, the lower of safe and unsafe recall, aggregated across three pre-execution benchmarks. ATBench-Pro covers long, stateful traces, while ManipulationArena examines whether running agents preserve user intent in 888 validated cases.

### Trade-offs & Limitations
Jev is the lower-generation-overhead option for offline classification, but speed and quality do not move together. Jev 4B-U reached 77.9% unsafe-class F1 at 59.8 ms mean latency on ATBench; on ATBench-Pro, Jev 4B reached 68.9% at 1.465 s. These measurements used one H200, serial requests, and no prefix caching. The checkpoints differ, so the figures illustrate deployment conditions and workload differences rather than a controlled latency comparison. Fine-grained labels are weaker than binary verdicts: the highest listed failure-mode accuracy on ATBench is 28.8%.

Compared with a deterministic policy engine, AgentDoG can consider intent and prior tool results, but its verdicts are probabilistic. Keep permission expiry, scope checks, and stop requests enforceable in the runtime. Compared with an API-hosted judge, local scoring gives the team control over where traces are processed but adds model-serving work. Validate safety and utility together: SafeRSI V1 with Step reduced ManipulationArena attack success from 65.84% to 21.40% versus baseline, yet BFCL-v3 function-calling accuracy fell from 75.34% to 67.39%.

### Hardware & Deployment Guide
For a local pilot, start with the Python/Transformers walkthrough in `examples/getting_started_v2.md` and the supplied `examples/trajectory_sample.json`. Fetch the matching checkpoint from Hugging Face and pair it with the corresponding v2 prompt. Start with post-run scoring to measure errors and resource use, then trial Step in shadow mode before routing any execution decisions through it. Full trajectories may contain sensitive tool results; apply access and retention controls to audit inputs as well as verdicts.

No container deployment, managed inference path, pinned dependency versions, or minimum VRAM is specified. Size the serving environment for checkpoint size, precision, trace length, and concurrency, and test how the application handles histories beyond its context budget without losing permission changes. Model checkpoints and quickstarts are available for 1.0, 1.5, and v2, but no GitHub release is listed. Pin model, prompt, and code revisions together for reproducible evaluation, and resolve the unspecified repository license before commercial use.
```

## Key Capabilities
```text
- Trajectory audit: AgentDoG2 returns a direct verdict or a diagnosis covering risk source, failure mode, and harm.
- Single-pass scoring: Jev scores allowed labels at JSON schema positions and returns confidence scores without autoregressive label generation.
- Pre-execution checks: AgentDoG-Step evaluates a pending tool call or reply in context; its 4B checkpoint reached 94.0% overall worst-class recall across three benchmarks.
- Long-context evaluation: ATBench-Pro contains 1,000 trajectories averaging 48.98 tool calls and 57.51k tokens.
- Model selection: AgentDoG2 2B reached 81.7% unsafe-class F1 on ATBench, while the 8B variant led the listed AgentDoG2 checkpoints on ATBench-Pro at 71.8%.
- Headroom and cost of improvement: SafeRSI V1 with Step reduced ManipulationArena attack success from 65.84% to 21.40% versus baseline, while BFCL-v3 accuracy fell from 75.34% to 67.39%.
```

## Quick Start / Clone
```bash
git clone --depth 1 https://github.com/AI45Lab/AgentDoG.git
cd AgentDoG
```
