Hugging Face researchers have introduced StepGuard, a novel step-level guard model designed to enhance the security of LLM-based agents. Unlike traditional guardrails that evaluate completed trajectories, StepGuard audits each tool action before it is executed, addressing a critical gap in pre-execution monitoring.
The model is trained using StepGen, an automatic data engine that generates safe and unsafe trajectories with identical contexts but divergent actions at risky steps. To balance safety and utility, the team developed Balance-GRPO, a reinforcement learning algorithm that dynamically adjusts learning between safe and unsafe actions based on observed accuracy.
In experiments, StepGuard achieved the highest average accuracy among open-weight guard models, with performance comparable to GPT-5.4. When deployed to guard agents on AgentDojo and AgentDyn benchmarks, it reduced the mean attack success rate by 77.3% relative to the no-guard setting, while mean utility dropped by only 2.8 percentage points.
The code and model weights are publicly available on GitHub and Hugging Face, enabling further research and adoption.