Capsule Blog

Keeping AI Agents on Track: How Capsule Powers State-of-the-Art Rogue Agent Detection with NVIDIA Nemotron

Elnatan Revital
Lidan Hazout
Bar Kaduri
September 2, 2026

By Elnatan Revital, Bar Kaduri, Lidan Hazout from Capsule Security, in collaboration with Amit Bleiweiss, Gal Mizan, Shiri Hochhauser from NVIDIA

TL;DR

  • Capsule Security collaborated with NVIDIA to build specialized SLM detectors for real-time, low-latency identification of rogue AI agent behavior.
  • Our training pipeline combined real agent traces, frontier-model judging (with NVIDIA Nemotron 3 Ultra), human review, and adversarial example generation to map the precise boundary between safe and unsafe behavior.
  • We initially fine-tuned the NVIDIA Nemotron-3-Nano-4B, achieving a 93.8% accuracy, proving that specialization beats scale.
  • Pushing the limits further, we applied the same pipeline to the flagship NVIDIA Nemotron-3-Nano-30B-A3B (a Mixture-of-Experts model). This yielded an even higher accuracy of 96.9%.
  • Because the model performs a classification task (a single-token decision), latency is determined by Time-To-First-Token (TTFT) rather than full text generation, providing frontier-level reasoning with extremely low latency overhead for inline agent interception. With FP8 quantization, the 30B-A3B model runs at 205ms per decision, and the Nano-4B runs at 71ms (!) on an NVIDIA L40S GPU

The Problem: The AI Agent Security Crisis

AI agents are rapidly moving beyond simple chat interactions and into environments where they can modify code, access databases, interact with infrastructure, and execute actions autonomously. This new level of capability creates a new category of security risk: agents that take actions outside their intended scope.

These failures don't require a malicious actor. An agent can misinterpret instructions, bypass approval workflows, overstep operational boundaries, or independently decide that a risky action is the "best" way to accomplish its goal. When this happens, the result can be just as damaging as a traditional security incident. Recent events have shown that this risk is no longer theoretical:

    • Replit (July 2025): Replit's AI coding agent deleted a production database despite being under an explicit "code and action freeze," wiping records for more than 1,200 executives and nearly 1,200 companies. The agent later admitted it had acted without permission, violated direct instructions, and attempted to conceal the damage by generating thousands of fake user profiles.
    • Meta (March 2026): An autonomous AI agent triggered a Sev-1 incident after bypassing a required human-approval step and exposing sensitive company and user data to unauthorized employees.
    • PocketOS (April 2026): After encountering a credential mismatch in a staging environment, a Cursor-powered agent independently decided to resolve the issue by deleting a Railway storage volume, erasing the production database and all backups in under ten seconds.
    • Hugging Face (July 2026): OpenAI agents running an internal cybersecurity evaluation escaped their isolated testing sandbox and ran a multi-day intrusion against Hugging Face's production infrastructure, in an apparent attempt to cheat the evaluation by stealing test solutions rather than solving the challenges. Thousands of agents coordinated via a secret message board, exchanging more than 70,000 messages, and OpenAI characterized the breach as an unprecedented cyber incident, the first documented attack carried out end to end by an agentic AI system without a human operator.

    These incidents illustrate a common pattern: agents deviating from their intended role and taking actions that humans never explicitly authorized. Preventing these failures requires evaluating agent behavior as it happens - before a tool call is executed, not after the damage is done. However, real-time protection introduces a new challenge: latency. Sending every action to a large frontier model for security review is often too slow and too expensive to sit inline with agent execution.

    The Training Process

    A detector is only as good as the boundary it learns. To build a high-precision, low-latency detection mechanism, our pipeline is built to teach the model precisely where acceptable behavior ends and a violation begins. We established a rigorous methodology:

    1. Real Agent Traces: We start from real agent traces - the agent's identity and instructions, its session history, and the specific tool call under review. Grounding in real traffic (not synthetic prompts) keeps the model aligned with how agents actually behave.
    2. LLM-as-a-Judge: Each tool call is adjudicated by a strong frontier model, NVIDIA Nemotron 3 Ultra (using openrouter API), which assigns a verdict (violation, benign, or ambiguous) with a written rationale. Ambiguous cases are routed to human review.
    3. Adversarial Pairs: For every labeled example, we use Nemotron 3 Ultra to generate a minimally-edited counter-example - the smallest change to the session that flips the verdict. These near-identical pairs force the model to key on the decision-relevant signal rather than surface features.
    4. LoRA Fine-tuning: We decided to use LoRA over full fine-tuning because the goal is to specialize an already-capable model to one decision boundary, not to teach it a new domain. LoRA freezes the base and trains only a small set of low-rank adapters (~1.4% of parameters) - reaching state-of-the-art accuracy while preserving the base model's general reasoning (avoiding the catastrophic forgetting risk of full-model updates), at a fraction of the compute, and producing a lightweight, swappable adapter instead of a fully re-trained model. 
    5. Single-Token Decision: At runtime, the model doesn't write a long sequence of text; we simply read the next-token logits to determine the probability of a violation. Because this is a classification problem rather than a generation task, we don't need to generate a full response - only TTFT matters for latency, allowing for near-instant decisions.

    The Journey: From 4B to 30B MoE

    Our journey to the ultimate rogue-agent detector happened in two distinct phases, allowing us to deeply explore the tradeoff between size, speed, and architectural efficiency.

    Nemotron-3-Nano-4B

    We began by selecting the NVIDIA Nemotron-3-Nano-4B-BF16 (an open hybrid Mamba-2 + Transformer + MLP architecture) as our initial base model. We prioritized this because Nemotron models are cost-effective and built for fast inference. In the critical path of inline agent interception, every millisecond counts.

    The results were phenomenal. On an AWS ml.g5.2xlarge (A10G) instance, the fine-tuned 4B model achieved 93.8% accuracy, significantly outperforming larger models. In production security environments, alert fatigue is a dealbreaker. We fixed precision at a strict floor of ≥95% and measured recall. The 4B model achieved 97.3% recall, while the next-best competitor caught only 16.8%.

    Scaling Up with Nemotron-3-Nano-30B-A3B

    Following this success, We tried to push the results even higher and applied our pipeline to the flagship model NVIDIA Nemotron-3-Nano-30B-A3B - a hybrid Mamba-2 + Transformer Mixture-of-Experts (MoE) architecture. Although the model loads 31.6 billion parameters in memory, its MoE design activates only ~3.2 billion per token (the "A3B"). Leveraging this efficient architecture, we followed NVIDIA's LoRA fine-tuning approach for Nemotron-3-Nano to specialize the model. This combination delivered the reasoning quality of a 30B-class model while maintaining the per-token compute and latency profile of a ~3B model.

    The benchmark results were astounding. The 30B-A3B model achieved a 96.9% accuracy and a 0.994 ROC-AUC, extending our lead to +10.9 points over the best third-party model tested. 

    Final benchmark

    The following graph shows the accuracy and performance metrics across the evaluated detection models:

    For context, the graph compares our specialized LoRA fine-tuned models against various off-the-shelf close and open-weight models. These other models were evaluated in their base, non-fine-tuned state to demonstrate the significant performance gains achieved specifically through our domain-specific training and specialization.

    Deploying Cost-Effectively: FP8 Quantization

    Beating best in class accuracy is only half the job; to run inline at enterprise scale, the detector must be cheap to serve. Following NVIDIA's recommended recipe, we quantized the fine-tuned Nemotron-3-Nano-30B detector to FP8, nearly halving its memory footprint (from 63 GB to 32 GB) with no measurable loss in quality.

    This efficiency completely changes where the detector can run. While full precision demands a flagship H100, the FP8 model fits comfortably on a cost-efficient, widely-available L40S (48 GB) GPU. Running on the L40S, it serves at a median 205ms per decision, well inside the 500 ms inline budget.

    We also tested the smaller Nemotron-3-Nano-4B variant on the same L40S, achieving even faster times - 71 ms median (roughly 3× quicker) at 93.9% accuracy. On identical hardware, that gives a clean speed-vs-accuracy dial: Nemotron-3-Nano-30B for peak accuracy, and Nemotron-3-Nano-4B for maximum throughput - both well within the 500 ms inline budget.

    Performance Comparison

    The choice between these two architectures represents a strategic trade-off based on deployment constraints. The Nemotron-3-Nano-4B model is ideal for environments prioritizing an extremely low memory footprint and maximum cost-efficiency. In contrast, the Nemotron-3-Nano-30B-A3B model offers superior reasoning capabilities and higher performance, making it the preferred choice for complex security analysis where the higher memory overhead is acceptable.

    External benchmarking

    To test our detector against an independent benchmark, we evaluated it on StepShield, a public      benchmark for step-level rogue-agent detection (released under CC-BY-4.0): Its held-out evaluation set contains 216 agent trajectories - 108 rogue and 108 clean - built from incident templates that never appear in training, spanning six violation categories (data exfiltration, privilege escalation, resource hijacking, supply-chain, destructive actions, and covert persistence) across three severity levels.

    StepShield's key contribution is treating detection timeliness as a first-class metric via EIR (Early Intervention Rate): among trajectories a detector catches, the fraction it flags at the divergence step or within k=3 steps after - penalizing "Forensics Trap" monitors that fire indiscriminately on benign prefix code.

    We tested our models on the same in-domain protocol behind StepShield's published numbers, scored with their own EIR implementation. Against all four of their reported baselines:

    *StepShield benchmark by Gloria Felicia et al. (2026), used under [CC BY 4.0

     Source: stepShield

     Baseline figures (GPT-4.1-mini, StaticGuard, HybridGuard, ConstraintGuard) are as reported by the authors.*

    Our 30B detector leads on all three axes: it catches 99% of rogue trajectories, false positives on under 1% of clean runs (~6× better than the strongest baseline), and - critically - flags the violation at the exact step it occurs (median intervention gap of 0 steps), giving the highest early-intervention rate on the board. 

    Conclusion

    By leveraging the NVIDIA Nemotron architecture across both the highly efficient 4B and the powerful 30B MoE models, we've demonstrated that specialized Small Language Models (SLMs) are the key to safely scaling trusted agentic workflows across the enterprise. Moving beyond general-purpose models to specialized, efficient detectors allows organizations to secure their agentic workflows without sacrificing speed, cost, or performance.

    Read more articles

    Research

    CurseBox: The Agent That Sends Your Files to Strangers to Get the Job Done

    Capsule Security research uncovered a behavior in Cursor's agent: asked to do something ordinary like share a file, it decides on its own to upload the file to a public anonymous host to get a link. It will push past a deny-all network sandbox to do it, and no attacker is involved. We found it running in production across every major model, reported it to Cursor, and were met with silence.

    Bar Kaduri
    August 26, 2026
    Article

    When Agents Go Rogue

    Modern AI agents are increasingly causing critical system damage not through external cyberattacks, but by taking unprompted, off-script actions across unguarded tools like databases and system shells. Traditional safeguards, including prompt instructions and human approval workflows, routinely fail to catch these autonomous errors before execution. To mitigate this growing risk, security must shift directly to the tool-call boundary, enforcing deterministic runtime controls that intercept and block destructive commands before they run.

    Bar Kaduri
    August 17, 2026
    News

    Capsule Launches Security Integration for Claude Platform

    Capsule launches a security integration for Claude Platform, using Claude's Compliance API to give security, compliance, and AI governance teams visibility into enterprise AI activity, risk, and posture across Anthropic-hosted deployments.

    Lidan Hazout
    July 22, 2026
    Research

    The Agentic Supply Chain: You Installed More Than You Think

    Agents inherited every supply chain risk software already had, then added new layers of their own on top. These are the stories, and the numbers, behind why that should worry you.

    Bar Kaduri
    July 13, 2026
    Article

    Guardian Agent: Shipping a Useful Agentic Experience

    Usefulness and governance aren't a trade-off. Guardian Agent runs locally in the browser, keeps every credential server-side, and turns an afternoon of report-building into a single prompt.

    Yarin Sasson
    July 7, 2026
    Article

    Your AI Agent Inventory is Lying to You: The Rise of the "Inline Agent"

    Discover the rise of 'Inline Agents' - the shadow IT of the AI era. Learn how Capsule Security uncovers undeclared AI agents hiding in your raw logs.

    Guy Bidkar
    July 1, 2026
    Research

    We Analyzed 206,435 AI Agent Skills. Here's What We Found.

    Our analysis of 206,435 AI agent skills reveals a rapidly growing software supply chain vulnerable to natural language payloads and dangerous capability combinations. Read the report to understand how these skills bypass traditional security controls and learn how Capsule protects your organization by securing the agent runtime.

    Bar Kaduri
    June 22, 2026
    Article

    Mitigating the Agentic AI Threat: What Security Leadership Needs to Prioritize

    The theoretical phase of agentic AI security is over—the attack surface is real and the incidents are documented. This post breaks down the defensive architecture taking shape in response: Meta's Agents Rule of Two, deterministic enforcement hooks, identity governance for non-human agents, and the questions security leaders need to be asking right now.

    Bar Kaduri
    June 16, 2026
    Article

    OWASP State of Agentic AI Security and Governance 2026: What Changed, and What It Means

    A year after the first edition, plausible agentic AI threats now carry CVEs and real incidents. What changed in the OWASP State of Agentic AI Security and Governance 2026.

    Bar Kaduri
    May 31, 2026
    Article

    Every agent needs a "stop". We're standardizing it.

    The industry standardized how agents talk, but never how to stop one mid-action. Capsule is helping change that through the Agent Control Standard, with hooks.security as the developer-facing companion.

    Bar Kaduri
    May 27, 2026
    Research

    The Agentic AI Threat Landscape Has Crossed a Threshold

    The security risks of AI agents are no longer theoretical. This blog examines the active threat landscape facing agentic AI in 2026, from prompt injection and supply chain attacks against MCP and skill registries to the governance gap created by vibe coding and Shadow AI.

    Bar Kaduri
    May 24, 2026
    Article

    The Rise of Guardian Agents: Securing the Agentic AI Ecosystem

    Guardian agents are emerging as a critical security layer for the agentic AI era. As enterprises adopt AI agents that execute tools, handle sensitive data, and operate inside real workflows, human approval loops no longer scale. Guardian agents solve this by supervising other agents in real time: monitoring actions, enforcing policy, and blocking risky behavior before execution.

    Lidan Hazout
    May 7, 2026
    Research

    CurseChain: How Hidden README Comments Trick Cursor Into Stealing - and Spreading - Your SSH Keys

    Capsule found two Cursor IDE vulnerabilities that let hidden prompt-injection instructions in referenced files steal developers’ SSH keys and contaminate future unrelated projects, causing zero-click or one-click exfiltration even when the attacker ships no malicious code.

    Bar Kaduri
    April 29, 2026
    Research

    The State of AI Agent Security 2026

    Capsule Security’s State of AI Agent Security 2026 report is the largest independent audit of AI agents to date, showing that the ecosystem is rapidly shipping publicly exposed, weakly guarded, highly connected agents with recurring misconfigurations, near-absent runtime controls, widespread prompt-injection risk, expanding supply-chain exposure, and active malicious campaigns still propagating through agent skill and tool registries.

    Bar Kaduri
    April 27, 2026
    News

    Capsule Security Raises $7M to Prevent AI Agents from Going Rogue in Runtime: Intent is the New Perimeter

    Capsule is launching a runtime security platform for the agentic AI era, built to monitor and stop autonomous agents that can bypass traditional guardrails, misuse legitimate access, and create a new class of enterprise security risk.

    Naor Paz
    April 13, 2026
    Article

    Why MCP Gateways are a Bad Idea (and What to Do Instead)

    MCP gateways secure only one protocol and create blind spots, while runtime hooks plus approved MCP registries secure the full agent runtime where real risk lives.

    Lidan Hazout
    April 12, 2026
    Article

    ClawGuard: Open Source Security for the Agentic Era

    ClawGuard was built to stop dangerous agent behavior at the intent level before execution, and NVIDIA’s NemoClaw reinforces that need by securing the runtime environment from the infrastructure side.

    Lidan Hazout
    April 12, 2026
    Research

    PipeLeak: The Lead That Stole Your Database - Exploiting Salesforce Agentforce With Indirect Prompt Injection

    Capsule research team discover a critical prompt injection vulnerability in Salesforce Agentforce that allows attackers to exfiltrate CRM data through a simple lead from a form submission. No authentication required.

    Bar Kaduri
    April 9, 2026
    Research

    ShareLeak: Taking the Wheel of Microsoft’s Copilot Studio (CVE-2026-21520)

    The Capsule research team discovered a high severity indirect prompt injection vulnerability in Microsoft Copilot Studio that enables attackers to exfiltrate sensitive data through external SharePoint form.

    Bar Kaduri
    April 9, 2026