TL;DR
NEXUS is an ultra-fast, hybrid runtime safety monitor designed to prevent tool-using LLM agents from executing harmful actions. By intercepting an agent's structured execution plan before it runs, NEXUS combines deterministic safety rules with a calibrated machine learning risk scorer to route actions into four graded interventions—allow, block, confirm, or revise—all with sub-millisecond latency.
What Problem Does This Paper Address?
As LLM agents transition from passive text generators to autonomous actors that invoke APIs, modify databases, and interact with file systems, the stakes for safety have skyrocketed. A successful prompt injection attack or an ambiguous user request could cause an agent to delete critical files or exfiltrate sensitive data before a human operator can intervene.
Existing safeguards generally fall into two camps: rigid, binary rule-based systems that lack nuance, or heavy "LLM-as-a-judge" architectures that introduce massive latency. Furthermore, most systems evaluate safety on a per-call or raw-text basis rather than analyzing the agent's entire planned sequence of actions. NEXUS addresses this gap by providing a fast, auditable, and multi-layered safety layer that operates directly on a structured intermediate representation of the agent's plan.
Methods
NEXUS introduces a framework that intercepts an agent's Structured Plan Intermediate Representation (IR) before any tools are executed. Each step in this plan contains metadata such as the tool name, arguments, required permissions, side-effect categories, and irreversibility flags.
The core architecture consists of four parallel components that feed into a unified Intervention Policy ($\Pi$):
- Deterministic Rule Set: Evaluates nine plan-level safety rules covering explicit violations like budget overruns, wildcard file deletions, or unauthorized network access.
- Argument Inspection: Scans tool inputs for specific high-risk patterns, such as hardcoded credentials, sensitive file paths, or suspicious URLs.
- Calibrated Learned Risk Score: A lightweight 9-dimensional logistic regression model that estimates overall plan-level risk. Crucially, this model undergoes Platt scaling to ensure its output represents a reliable empirical probability.
- Session Manager: Tracks state across multi-turn interactions, monitoring cumulative costs and repeated unsafe attempts.
Instead of making a simple safe/unsafe decision, the intervention policy maps plans to four graded actions: ALLOW (execute), BLOCK (halt), REQUEST CONFIRMATION (escalate to user), or REQUEST REVISION (send back to the LLM for repair). It uses a novel scorer-gated demotion mechanism: if exactly one critical rule violation occurs, the calibrated machine learning score arbitrates whether to issue a hard block or safely downgrade the intervention to a user confirmation request.
Datasets
The authors evaluated NEXUS using a mix of newly introduced benchmarks and established external datasets:
- NEXUS-Bench (Synthetic Split): 428 instances generated across 9 distinct risk categories (e.g., privilege misuse, destructive actions) to test structural plan detection.
- Indirect Prompt Injection (IPI) Adversarial Split: 200 paired cases testing robustness against malicious instructions embedded in retrieved context across five different linguistic styles.
- NEXUS-Stress: A highly challenging, 200-example "rule-blind" adversarial benchmark designed to expose safety monitor coverage gaps.
- External Benchmarks: Evaluation on R-Judge (564 records evaluating agent safety awareness) and AgentHarm (352 instances of harmful vs. benign agent behaviors).
Key Insights and Ideas
- Graded Interventions are Essential: Binary safety filters force a false dichotomy. Many real-world agent actions are borderline or ambiguous; routing them to "request confirmation" or "request revision" preserves utility without sacrificing safety.
- The Power of Scorer-Gated Demotion: Machine learning shouldn't replace deterministic rules; it should complement them. By using the learned risk score purely to arbitrate borderline cases (when exactly one critical rule fires), NEXUS maintains hard security guarantees while drastically reducing overblocking.
- Plan-Level Invariance to Injection Style: Once an indirect prompt injection successfully steers an agent, the malicious intent manifests structurally in the tool plan. Because NEXUS evaluates the plan rather than the prompt, its detection capability is completely invariant to how cleverly the injection text was phrased.
- The Structural Blind Spot: Plan-level monitoring has a fundamental boundary. If a harmful action and a benign action share the exact same tool sequence and structure, a plan monitor is blind to it. In these cases, safety monitoring must be paired with intent-aware or prompt-aware safeguards.
Key Results
- Intervention Accuracy Boost: On the synthetic benchmark, adding the calibrated risk score on top of rules improved 4-class intervention accuracy by 27.3 percentage points (from 0.367 to 0.641) by correctly distinguishing blocks from confirmations.
- High Generalization: NEXUS achieved strong performance on out-of-distribution benchmarks, reaching an $F_1$ score of 0.861 on R-Judge and 0.881 on NEXUS-Stress.
- Robust Defenses: It achieved a 0% Attack Success Rate (ASR) on the IPI adversarial split, blocking all injected exploits.
- Sub-Millisecond Efficiency: Running entirely on a single CPU core, NEXUS boasts a median latency of just 0.205 ms per plan. This represents less than 0.1% overhead on a typical LLM agent loop, making it highly practical for real-time deployment.
Limitations and Future Work
While NEXUS excels at catching structurally visible risks, it exhibits a "middle-severity coverage gap" on completely rule-blind inputs (such as those in NEXUS-Stress), where it fails to predict the REVISE action and conservatively defaults to CONFIRM. The authors note that future work must expand middle-severity rules to better handle ambiguous but recoverable plans. Additionally, while a session-aware extension was shown to successfully close the multi-turn detection gap on authored benchmarks, validating this session tracking on organic, complex multi-turn agent traces remains an open direction.
Summary updated