The seven controls in this series so far assume the agents under management are known to the organization — registered, scoped, and instrumented before production. The problem this chapter addresses is what happens when that assumption fails. Shadow AI agents are deployed by teams or individuals without going through the organization's governance process; rogue agents are registered but have deviated from their sanctioned behavior at runtime. Both are materially more dangerous than a known, governed agent with a misconfigured policy, because the detection problem precedes the remediation problem: you cannot contain an agent you do not know is running, and you cannot investigate behavioral drift in an agent you have no baseline for. This maps directly to OWASP Agentic ASI10 (Unbounded Agent Autonomy) and amplifies the blast radius of every other risk in the Agentic Top 10 when the agent in question is outside the governance perimeter.
Shadow agents vs. rogue agents: the distinction matters
The terms are sometimes used interchangeably, but they describe different failure modes with different detection approaches. A shadow agent was never registered with the organization's AI governance process. It may be a developer's proof-of-concept that reached production, a vendor-supplied integration that includes embedded AI capabilities not disclosed in the contract, or a departmental workflow tool that added an AI agent feature in a minor update. The defining characteristic is absence from the asset inventory, which means no policy, no audit trail, and no authorized scope. A rogue agent was registered and approved, but its runtime behavior has diverged from the sanctioned baseline. This can happen because of prompt injection that has persistently altered the agent's goals, a model update that shifted behavior outside tested parameters, a configuration drift, or deliberate modification by an insider. The agent appears legitimate in the registry but is no longer behaving as approved. Both require detection; neither can be addressed through runtime policy alone, because shadow agents are not subject to the runtime policy and rogue agents are evading it.
The four detection vectors
Asset Discovery
Continuous scanning of the network, API gateways, cloud function registries, and SaaS integration logs for traffic patterns that indicate AI model calls — particularly calls to external inference endpoints (OpenAI, Anthropic, Bedrock, Vertex) or self-hosted model servers. An agent running outside governance still has to call a model; that call leaves a trace at the network boundary even if the agent itself is invisible to the application layer.
Identity Verification
Every sanctioned agent should carry a cryptographically verifiable identity issued at registration — a short-lived credential tied to its persona definition, authorized scope, and deployment context. Any agent making tool calls or API calls without a verifiable credential is by definition outside the governance perimeter. The Model Context Protocol authentication specification and OAuth 2.0 mTLS certificate binding both provide workable primitives for this layer.
Behavioral Baseline Comparison
For registered agents, a sanctioned behavioral baseline is established at approval time: the tools the agent uses, the data scopes it typically touches, the model call frequency and token distribution, the trust-tier distribution of its inputs. Continuous comparison of live behavior against the baseline surfaces rogue drift before it manifests as an incident. This is the behavioral analytic layer described in Chapter 7, applied specifically to the rogue detection problem.
Scope Boundary Monitoring
Even without a behavioral baseline, attempting to access data, tools, or systems outside the authorized scope is a strong signal for both shadow and rogue agents. Shadow agents have no scope at all and will appear as unauthorized on every resource access. Rogue agents will generate scope violations when their compromised goal state leads them to attempt access outside what was approved. Both produce the same observable: a resource access attempt with no valid authorization against the requesting identity.
Building an agent registry that enables detection
Detection depends on having something to detect against. An agent registry is the organizational record of every AI agent that has been reviewed, approved, and deployed — analogous to a software bill of materials but for autonomous runtime behavior. Each entry should capture the agent's unique identity (cryptographic key or certificate), the model and version it is authorized to use, the tools and data scopes it is authorized to access, the persona definition it was approved against, the human or team responsible for it, and the deployment context (environment, dependent systems). Without this registry, the question "is this agent sanctioned?" has no authoritative answer, and the network traffic that reveals a shadow agent has nothing to be compared against.
The registry also provides the baseline for rogue detection. At approval time, the agent's expected behavioral envelope is documented — not as a rigid specification (agents are non-deterministic) but as a distribution of expected actions. A coding assistant agent should primarily be calling a code execution tool and a search tool; a data analysis agent should primarily be querying a specific database. When production behavior diverges significantly from that documented envelope, the deviation is a detection signal. The registry turns that signal from a vague intuition into a measurable delta.
Working through these controls yourself? The Skyrelis Agent Checklist condenses this series into a one-page pre-production reference.
Download Free →Detection signals and response tiers
| Signal | Shadow or Rogue? | Response |
|---|---|---|
| AI model API call from an unregistered service identity | Shadow | Block at API gateway; alert security team; initiate asset discovery scan of the originating system |
| Registered agent making model calls with an unrecognized model version | Rogue | Alert; flag session for human review; compare current model against approved version in registry |
| Registered agent accessing data scope outside its authorized boundaries | Rogue | Deny access; real-time alert; suspend session pending review if pattern repeats |
| Registered agent tool-call distribution shifts significantly from documented baseline | Rogue | Alert; increase monitoring fidelity; human review of recent action log before next session |
| Agent traffic observed on networks or systems with no registered agent inventory | Shadow | Immediate containment; network isolation of originating service; incident response initiated |
Containment and remediation
Detection without containment is incomplete. For shadow agents, containment is straightforward in principle: revoke the API credentials or block the network path the agent is using to reach its model, then investigate the deployment path to understand how governance was bypassed. The more operationally important outcome is not just stopping this particular agent, but closing the gap that allowed it to reach production without review. For rogue agents, containment is more nuanced because the agent identity is legitimate — it is the behavior that has deviated. The typical response is session suspension (preventing the agent from taking further actions) while a human reviews the recent action log to determine the scope of the drift, whether any unauthorized actions were taken, and whether the root cause is a prompt injection, a model update, or a configuration change. Remediation then restores the agent to its sanctioned baseline, or retires it if the drift cannot be explained.
Both containment paths depend on the infrastructure built in earlier chapters: the runtime enforcement layer provides the session suspension mechanism, the audit and monitoring layer provides the action log for investigation, and the least-privilege scoping limits the blast radius of any actions taken before detection. Detection is the layer that triggers those mechanisms when an agent has escaped the governance perimeter.
Shadow and Rogue Agent Detection Checklist
See how Skyrelis surfaces shadow and rogue agents
Continuous asset discovery, cryptographic agent identity, behavioral baseline comparison, and automated containment — in one runtime layer.
Frequently Asked Questions
Sources
- OWASP GenAI Security Project: Top 10 for Agentic Applications (2026)
- Cloud Security Alliance: AI Agent Security Starts with Scope Control (May 2026)
- NIST: AI Risk Management Framework
- Model Context Protocol: Authentication Specification
- IETF RFC 8705: OAuth 2.0 Mutual-TLS Client Authentication
- European Commission: EU AI Act
- Microsoft: Authorization and Governance for AI Agents
- OpenTelemetry: GenAI Semantic Conventions