RePolicy: Reinforcement Learning for Safety-Policy Invocation in Agent Safeguards

Houcheng Jiang, Boxuan Zhang, Qiyong Zhong, Junfeng Fang, Xiang Wang, Xiangnan HearXiv 2026

TL;DR

RePolicy is a novel agent safeguard framework that treats safety policies as active, callable capabilities optimized via reinforcement learning. By combining supervised initialization with Group Relative Policy Optimization (GRPO) and policy-context perturbation, RePolicy achieves state-of-the-art safety detection across multiple benchmarks using a compact 4B parameter backbone, outperforming much larger general-purpose models.

What Problem Does This Paper Address?

As Large Language Model (LLM) agents transition from text-generating assistants into autonomous systems capable of planning, tool use, and environmental interaction, their safety risks have evolved. Harm is no longer confined to isolated toxic outputs; instead, dangerous behaviors emerge over complete, multi-step execution trajectories.

Existing safeguards typically rely on static risk taxonomies or passive prompting/supervised fine-tuning (SFT) with external policies. However, real-world deployments feature dynamic environments where safety policies constantly change based on user permissions, organizational requirements, and shifting regulatory jurisdictions. Current models struggle to adapt to these unseen scenarios or scale when forced to process large, complex policy libraries as passive context.

Methods

RePolicy reframes safety-policy invocation as an agentic reinforcement learning task. Instead of stuffing an entire policy library into the prompt, the safeguard follows a sequential pipeline: $$\text{policy invocation} \rightarrow \text{policy content retrieval} \rightarrow \text{safety reasoning} \rightarrow \text{safety prediction}$$

The training workflow consists of two primary phases:

  1. Cold-Start Training: Initial supervised fine-tuning (SFT) to teach the model the structured interaction format and basic policy-matching capabilities.
  2. Reinforcement Learning via GRPO: The model is optimized using Group Relative Policy Optimization (GRPO) with rule-based, verifiable rewards. These rewards explicitly score three components: interaction format validity, correct policy invocation, and final safety prediction accuracy.

To ensure the model doesn't simply memorize fixed trajectory-policy correlations, the authors introduce policy-context perturbation. During RL training, the candidate policy library is dynamically shuffled and augmented with irrelevant "decoy" policies, forcing the model to actively distinguish true policy applicability based on the semantics of the trajectory.

Datasets

To support this framework, the authors constructed PolicyTraj-20K, a dataset containing over 20,000 safety-policy-annotated agent trajectories. Each sample provides fine-grained supervision, including applicable policies, relevant clauses, safety labels, and decision rationales.

For evaluation, RePolicy was tested against a normalized split of 7,369 trajectories across six diverse agent safety benchmarks:

  • ATBench (Long-horizon trajectories)
  • R-Judge (Multi-turn risk awareness)
  • OpenAgentSafety (Realistic agent deployments)
  • ASSEBench (Safety risks and security threats)
  • HINTBench (Intrinsic, non-attack failures)
  • AgentHazard (Harmful computer-use behavior)

Key Insights and Ideas

  • Policies as Capabilities: Shifting the paradigm from treating safety policies as passive context to "callable tools" allows the model to actively explore alternative reasoning paths during training.
  • RL Sharpens Selection: While SFT establishes basic formatting, the RL signal from GRPO is what truly sharpens policy selection. It broadens the model's invocation breadth (from 1.9 to 3.2 policies per trajectory) while keeping the decoy acceptance rate below 1%.
  • Balanced Error Trade-Offs: Explicit policy invocation acts as an auditable bridge. Rather than shortcutting directly to a binary safety label (which often introduces high false-positive rates), the structured retrieval step forces a more balanced and interpretable safety decision.

Key Results

RePolicy-4B (built on a Qwen3-4B-Instruct backbone) achieved an Overall Unsafe F1 score of 88.15, outperforming 19 external baselines, including frontier closed-source models (Claude 4.6, GPT-5.4) and specialized guard architectures (AgentDoG, DynaGuard).

Figure 1: Headline comparison on six agent safety benchmarks. We compare RePolicy-4B with representative agent safeguards using Unsafe F1 (%, ↑). The dashed line denotes the strongest external baseline on each benchmark, and the value on the right reports the performance difference between RePolicy-4B and this baseline.

As shown in the headline results, RePolicy ranked first on four out of the six benchmarks, demonstrating substantial performance margins over the strongest external baselines (+5.5 points on AgentHazard, +5.3 points on ASSEBench, and +2.5 points on OpenAgentSafety).

Limitations and Future Work

  • Single Governing Policy Assumption: The current formulation assumes each trajectory maps to exactly one primary governing policy, whereas real-world deployments may require simultaneously evaluating overlapping operational, organizational, and legal policies.
  • Inference Latency: The multi-step invocation-then-reasoning pipeline introduces additional interaction steps, resulting in higher inference overhead than single-pass guard models.
  • Rationale Faithfulness: While the rewards successfully verify the final safety label and policy choice, they do not completely guarantee that every sentence in the generated natural language rationale is perfectly faithful to the retrieved policy text.

Summary updated

BibTeX
@misc{jiang2026repolicy,
  author = {Houcheng Jiang and Boxuan Zhang and Qiyong Zhong and Junfeng Fang and Xiang Wang and Xiangnan He},
  title = {{RePolicy: Reinforcement Learning for Safety-Policy Invocation in Agent Safeguards}},
  year = {2026},
  eprint = {2608.24275},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.24275},
}
Figure