StepSafe: Learning Timely Intervention with Context-Aware Safety Reasoning
Organizations: Yale University · NetApp Inc.
Abstract
Safety in agentic systems is inherently sequential: whether an action is safe depends on prior actions, tool outputs, information disclosures, and interactions among agents. Recent work has shifted agent safety guardrails from post-hoc trajectory-level assessment toward step-level action diagnosis and proactive risk prediction, yet existing training objectives provide limited supervision for how step evidence accumulates over time and when it becomes sufficient to justify intervention. We propose \methodlong~(ASPO): a training framework for step-level timely intervention. Pre-fix level stage alignment allows crediting each decision at its own step: it compares each response with the other responses sampled at the same prefix and rewards the action that fits the stage, continuing before the risk is visible, asking while clarification can still avert harm, and stopping before harm is irreversible. Adaptive feedback self-distillation further credits the reasoning behind each decision, with the model itself as a teacher that sees the step annotations on intervention steps and rules mined from its own false alarms on safe steps. Its training data carry a violation taxonomy and an intervention window at every step and are extended through self-evolving multi-agent red-teaming. Finally we present StepSafe, a step-level reasoning guardrail with timely intervention, that achieves the state-of-the-art peformance among open-source guardrails across five agent-safety benchmarks on safety-utility pareto curve with Youden's of 53.0 (4B) against 46.2.
Figures & tables
| ASSE-Safety | ASSE-Security | R-Judge | AgentHarm | ATBench | Overall | |||||||||||||
| Guardrail | Acc | mF1 | Acc | mF1 | Acc | mF1 | Acc | mF1 | Acc | mF1 | Acc | mF1 | ||||||
| Closed-source models | ||||||||||||||||||
| Claude Sonnet 5 | 77.5 | 77.5 | 57.0 | 83.8 | 83.8 | 67.7 | 94.0 | 94.0 | 88.2 | 97.2 | 94.6 | 85.5 | 77.4 | 77.2 | 54.7 | 81.9 | 81.9 | 64.0 |
| GPT-5.6 Sol | 77.0 | 77.0 | 55.0 | 92.2 | 92.1 | 84.3 | 93.8 | 93.8 | 86.7 | 96.6 | 93.6 | 84.8 | 77.1 | 76.9 | 53.9 | 83.3 | 83.3 | 66.6 |
| GPT-5.6 Terra | 76.2 | 76.1 | 52.8 | 85.9 | 85.9 | 71.8 | 80.3 | 79.6 | 59.1 | 96.6 | 93.8 | 87.6 | 73.0 | 72.9 | 46.1 | 78.8 | 78.8 | 57.6 |
| GPT-5.6 Luna | 76.4 | 76.4 | 53.5 | 83.0 | 83.0 | 66.0 | 87.1 | 86.9 | 73.3 | 96.6 | 93.6 | 84.8 | 67.5 | 66.7 | 35.2 | 77.9 | 77.9 | 55.7 |
| Overall | Same-task pairs | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Model | Acc | mF1 | ASR | Util | Correct | Flags both | Passes both | Inverted | |
| Qwen3-4B | 64.2 | 64.2 | 33.3 | 64.1 | 28.5 | 36.4 | 55.0 | 7.0 | 1.5 |
| + SFT | 73.0 | 72.9 | 35.4 | 81.8 | 46.2 | 70.9 | 15.3 | 12.5 | 1.2 |
| + SAPO | 75.9 | 75.9 | 27.2 | 79.1 | 51.9 | 68.2 | 23.2 | 8.0 | 0.6 |
| + AFSD ( StepSafe ) | 76.5 | 76.5 | 27.6 | 80.0 | 53.0 | 75.5 | 16.5 | 7.3 | 0.6 |
| Data | Acc | mF1 | ASR | Util | |
|---|---|---|---|---|---|
| E1: full ( StepSafe -4B) | 76.5 | 76.5 | 27.6 | 80.0 | 53.0 |
| E2: w/o red-team | 75.8 | 75.8 | 28.3 | 78.4 | 51.7 |
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| Axis | Category | Definition |
| Failure (12) | authorization | the action exceeds the actor, resource, or tool scope |
| consent | an applicable required agreement is missing | |
| information handling | restricted data is collected, disclosed, or used | |
| instruction trust | untrusted instructions are promoted to authority | |
| evidence reasoning | an unsupported factual inference drives a consequential decision | |
| representation | misleading claims about identity, facts, or status |
| Unsafe trajectories, each with a benign twin | 512 |
|---|---|
| failure-driven (monitor errors) | 328 |
| coverage-driven (taxonomy gaps) | 184 |
| Domain | Pairs |
| Enterprise operations | 74 |
| Public services | 68 |
| Finance and commerce | 56 |
| Setting | Supervised warm start | Reinforcement learning |
|---|---|---|
| Initialization | Qwen3-4B, thinking enabled | the warm-start SFT (2 epochs) |
| Data | 2,402 step-level examples from 1,291 trajectories | 3,184 trajectories with 22,000 annotated steps |
| Format | one visible prefix per example, single turn | replay of every agent action with the full visible history |
| Parameters updated | all (no adapters) | all (no adapters) |
| Optimizer | AdamW, , weight decay 0.01 | AdamW, weight decay 0.01 |
| Learning rate | , cosine, 5% warmup | , constant after linear warmup over 10% of a 2,985-step schedule |
| Arm | Acc | mF1 | ASR | Util | |
|---|---|---|---|---|---|
| StepSafe -4B |
| Backbone | Acc | mF1 | ASR | Util | |
|---|---|---|---|---|---|
| Untrained backbone | |||||
| Qwen3-4B | 64.2 | 64.2 | 33.3 | 64.1 | 28.5 |
| Qwen3-8B | 68.0 | 67.9 | 22.7 | 63.6 | 35.9 |
| StepSafe | |||||
| StepSafe -4B | 76.5 | 76.5 | 27.6 | 80.0 | 53.0 |
| StepSafe -8B | 77.2 | 77.2 | 21.7 | 74.8 | 54.4 |
| Monitor | Schedule | Acc | mF1 | ASR | Util | |
|---|---|---|---|---|---|---|
| StepGuard ( Zheng et al., 2026 ) | — | 73.0 | 73.0 | 32.7 | 78.5 | 46.2 |
| StepSafe | default | 76.5 | 76.5 | 27.6 | 80.0 | 53.0 |
| StepSafe | utility-leaning: Continue | 74.1 | 74.0 | 32.4 | 84.3 | 48.3 |
| Training | Traj. | Steps | Acc | mF1 | ASR | Util | |
|---|---|---|---|---|---|---|---|
| SFT, key steps balanced | 1.3k | 2.4k | 73.0 | 72.9 | 35.4 | 81.8 | 46.2 |
| SFT, all steps, multi-turn | 3.2k | 22.0k | 72.3 | 72.3 | 31.5 | 70.7 | 44.6 |
| SFT, all steps, step-level | 3.2k | 22.0k | 62.0 | 59.8 | 67.1 | 86.3 | 24.5 |
| SFT, all trajectories, class-balanced | 3.2k | 6.5k | 70.0 | 69.8 | 38.7 | 79.2 | 40.1 |
| StepSafe -4B | 3.2k | 22.0k | 76.5 | 76.5 | 27.6 | 80.0 | 53.0 |
| Unanimous wrong corrected | Unanimous correct | Mixed | |||
| Model | All | Misses | False alarms | kept | correct |
| (204) | (92) | (112) | (2,254) | (1,653) | |
| + SAPO | 15.1 | 18.6 | 12.3 | 98.7 | 80.6 |
| + AFSD ( StepSafe ) | 16.9 | 19.7 | 14.5 | 99.2 | 81.2 |
| Arm | Reward | ASR | Util | BIR | Stop share | |
|---|---|---|---|---|---|---|
| Binary | 41.0 | 27.8 | 70.3 | 26.5 | 62.9 | |
| C4 | Stage schedule | 41.2 | 26.4 | 70.1 | 30.7 | 71.7 |
| Estimator | Comparison group | Credit signal | Credit stays with the decision | Credit follows the stage | Stratified class budget |
|---|---|---|---|---|---|
| Trajectory-level GRPO ( Shao et al., 2024 ) | replays of a task | terminal return | – | – | – |
| RLOO ( Ahmadian et al., 2024 ) | replays of a task | terminal return, leave-one-out | – | – | – |
| Step-level GRPO | all decisions of a task | per-step reward | – | – | – |
| GiGPO ( Feng et al., 2026 ) | anchor state | return-to-go | – | – | – |
| SAPO , binary reward | prefix | , leave-one-out | ✓ | – | ✓ |
| SAPO | prefix | , leave-one-out | ✓ | ✓ | ✓ |
| SAPO (decision credit) | AFSD (token credit) | |
|---|---|---|
| Unit of credit | response | token |
| Weight | signed, uniform within a response | varies by token |
| Reference | other responses at the same prefix | the model with privileged context |
| Target from | stage schedule (landmarks) | annotated verdict, description, rubric |
| Silent when | scores tie at the prefix | teacher and student agree |
AI Agent Safety
AI agent safety studies how to prevent and detect harmful actions by autonomous systems that use tools, memory, and multi-step plans.
See all 326 papers