secure AI agents in productionAI agent securitynon-human identity

How to Secure AI Agents in Production: Complete Guide

Securing AI agents in production takes four controls: unique non-human identities, least-privilege access, sandboxed execution, and tamper-proof logging.

Portrait of Josh
Edited by Josh, Chief of Staff, GTM & Product··RSS
A cutaway diagram of an identity badge module showing an AI-agent-shaped internal profile alongside a static credential profile, surrounded by detachable access-permission plates.

How do you secure AI agents in production?

Securing an AI agent in production means giving it a unique, short-lived identity instead of a shared credential, scoping its permissions to the task at hand and nothing more, running it inside an isolated execution environment, and logging every decision it makes in a way that can't be altered after the fact. Skip any one of those four controls and you don't have a secured agent. You have a fast, untraceable version of whatever risk you already had.

That's the blunt version. The longer version is that most organizations are still treating agents like a software feature rather than what they actually are: a new category of non-human identity that acts, delegates, and makes decisions without a person in the loop at every step.

TL;DR

  • AI agents need unique, short-lived identities instead of shared credentials so that every action can be attributed to a specific agent.
  • Machine identities now outnumber human identities by roughly 82 to 1 across the average global organization.
  • Security teams can see only about 44% of the apps, agents, and automations their own business users have built.
  • Without a formal decommissioning policy, agent credentials and permissions quietly outlive their purpose and accumulate risk.
  • Least privilege has to be scoped, time-limited, and re-evaluated continuously, including across every hop in a delegation chain.
  • Gartner predicts more than 40% of agentic AI projects will be canceled by the end of 2027, partly because of inadequate risk controls.

Why do AI agents break traditional security models?

A human user logs in, does something, logs out. A traditional service account sits still with a fixed set of permissions and rarely changes behavior. An AI agent does neither. It authenticates, picks tools, calls other agents, makes judgment calls about ambiguous instructions, and can do all of that continuously, at machine speed, often without a person reviewing the output until something breaks.

That autonomy is the whole value proposition. It's also why bolting an agent onto an identity model built for humans and static services doesn't hold. The access-control assumptions are wrong, the audit trail assumptions are wrong, and the incident-response assumptions are wrong. Meanwhile, employees are building these things faster than security teams can track them. Our step-by-step governance framework covers the organizational side of that gap; this piece is about the technical controls that have to sit underneath it.

Figure 1
The agent visibility gap, by the numbers
82%
Discovered at least one unknown agent in their environment
65%
Experienced an agent-related security incident
68%
Believed they had strong agent visibility
Illustrative figure. Constructed for explanation, not a measured source.

How exposed is the average company, really?

The numbers are not subtle. Eighty-two percent of enterprises discovered at least one previously unknown agent running in their environment in the past year, and 65% experienced an agent-related security incident in the same window, despite 68% believing they had strong visibility into their own agent population. That confidence gap is the whole problem in one statistic.

The scale compounds it. Machine identities now outnumber human identities by roughly 82 to 1 across the average global organization, climbing to 96 to 1 in financial services and 100 to 1 in the UK, and 87% of organizations suffered an identity-centric breach in the past year. Security teams can see only about 44% of the apps, agents, and automations their own business users have actually built, on platforms where business users now outnumber professional developers by as much as 10 to 1.

Even when organizations try to do the right thing, follow-through lags. Ninety-three percent of organizations have assigned at least some agents distinct identities rather than shared credentials, but only 27% have done it for all or most of their agents, and only 48% use behavioral anomaly detection to catch an agent acting outside its normal pattern. Over-privileged access and privilege escalation is the single biggest worry cited by executives, at 51%.

What actually goes wrong in real attack patterns?

This isn't hypothetical risk-modeling. OWASP's Top 10 for Agentic Applications, released in December 2025 after input from more than 100 industry leaders, formally codifies identity-and-privilege abuse, tool misuse, and goal hijack as the leading risk categories unique to autonomous agents, distinct from the standard LLM Top 10.

Figure 2
Machine identities now dwarf human identities
United Kingdom100Financial services96Global average82
Illustrative figure. Constructed for explanation, not a measured source.

Palo Alto Networks' Unit 42 has already documented these patterns in the wild. In one case, attackers embedded 24 separate prompt-injection attempts into a single scam page, using zero-sized fonts, CSS suppression, and Base64-encoded JavaScript, specifically to bypass an AI-based ad-review system. In another set of cases, attackers tried to force agents into unauthorized financial transactions through Stripe and PayPal, including one attempt to move $5,000 to an attacker-controlled account.

The deeper structural problem is delegation. An agent that calls another agent, which calls a tool, which calls a database, can quietly end up with more authority than the original user ever granted, even when role-based access control looks correct at every individual hop. AWS's security team calls this out directly: without proper controls, an agent can act beyond what the originating user authorized, even with RBAC in place, and OWASP classifies this specific failure as ASI03: Identity & Privilege Abuse. These risks don't go away by prompting a model to behave better. We make the deterministic-engineering case for that in how to secure internal AI agents without relying on alignment.

Control 1: Why should every agent have its own identity, not a shared credential?

The single most common mistake is treating an agent like a feature inside an app and authenticating it with the app's existing service account, or worse, an API key shared across every agent instance. That makes it impossible to answer basic questions after an incident: which agent did this, on whose behalf, and when.

Figure 3
What happens when an agent incident occurs
share of organizations reporting this impact (%)
61%Data exposure43%Operational disruption35%Financial losses
Illustrative figure. Constructed for explanation, not a measured source.

Production agents need unique, short-lived session identities, not shared service accounts. Traditional IAM has to be extended with dynamic credentials, explicit delegation records, and database-level access controls, because standard audit logs can't trace an action back to a specific agent session on their own. This is also where database access tends to break down first, since agents are frequently the ones with the most direct line into production data; we go deeper on that specific exposure in 5 Ways to Secure Database Access for Internal AI Agents.

Control 2: How do you enforce least privilege and keep it least?

Unique identity solves attribution. It doesn't solve scope. An agent with its own identity and standing admin access is still a standing admin credential, just with a name tag on it.

The fix is scoped, time-limited access granted just-in-time for the task, re-evaluated continuously rather than set once at provisioning. AWS's reference architecture for multi-agent systems enforces this with three independent Cedar policy layers: agent-to-tool, agent-to-agent delegation, and originating-user authorization, each checked separately so that authorization scope can't silently expand as a task hops through a delegation chain. That three-layer separation is the direct, practical answer to the privilege-escalation worry that 51% of executives already flagged as their top concern.

In practice this means asking, for every agent, a short set of questions:

Figure 4
Identity and privilege governance: intent vs. follow-through
share of organizations (%)
93%Assigned identities to some agents27%Assigned identities to all/most agents48%Using behavioral anomaly detection51%Cite privilege escalation as top risk
Illustrative figure. Constructed for explanation, not a measured source.
  • What does this agent actually need right now? Not what it might need eventually, not what's convenient to grant once.
  • How long does it need that access? A token that expires in minutes is a different risk than one that lives for a year.
  • Who authorized the task this agent is executing? The agent's permissions should never exceed the originating user's.
  • Does a downstream tool call inherit permissions it shouldn't? Delegation chains are where scope creep hides.

Control 3: How does sandboxing stop a compromised agent from moving laterally?

Identity and privilege controls limit what an agent is allowed to do. Sandboxing limits what it's physically capable of doing if those controls fail or get bypassed. Agent security really operates at two layers: the model layer (prompt injection, output validation, tool-call authorization) and the infrastructure layer (execution isolation, secrets management, RBAC, audit logging, data residency).

At the infrastructure layer, agents that execute code at runtime need microVM-isolated environments, not just a container with a shared kernel, paired with tool allowlists that cap what the agent can even attempt to call, secrets injected at runtime rather than stored in agent memory or config files, and bring-your-own-cloud patterns where data residency requirements demand it. NIST's agentic extensions to its Risk Management Framework push in the same direction: organizations need formal autonomy-tier classification and tool-use risk modeling precisely because the original 2023 framework never contemplated agents that acquire tool use and act independently in live production. If you're weighing whether to build that sandbox internally or stand one up fast and sanctioned, that's the exact trade-off we map out in build the sandbox, not the ban.

Figure 5
Security can't see what employees already built
44%
Visibility security teams have into business-built apps, agents, and automations
10x
Business users outnumber professional developers on these platforms
Illustrative figure. Constructed for explanation, not a measured source.

Control 4: How do you build audit trails that are identity-bound and tamper-evident?

Generic application logs were built to answer "what did the app do." They were never built to answer "which agent session, acting on whose delegated authority, made this specific decision, and why." That's a different question, and most logging stacks can't answer it.

A defensible audit trail for agents needs a few specific fields that generic logs usually lack:

  • Session ID tied to the unique agent identity that performed the action, not the parent application.
  • Delegation chain showing every agent-to-agent and agent-to-tool hop that led to the action.
  • Decision rationale, or at minimum the inputs and tool outputs that drove the agent's choice.
  • Originating user, so the action can be traced back to the human who kicked off the task.
  • Structured, exportable event format that a SIEM can actually ingest and alert on in real time, rather than free-text logs nobody reviews until after the incident.

Standard logs can't trace actions to a specific agent session, which is exactly why identity-bound logging has to be designed in from the start rather than retrofitted. AWS's Cedar-based model and OCSF-style structured events point at the same conclusion from the infrastructure side: logs need to carry the delegation chain, not just the final action.

Figure 6
Weak controls are already killing projects
>40%
Agentic AI projects predicted to be canceled by end of 2027
Illustrative figure. Constructed for explanation, not a measured source.

How do you govern agents your employees already built?

All four controls assume you know an agent exists. That's often the weakest link. Most agents causing incidents today weren't commissioned by security; they were built by an employee in a no-code tool or an AI coding assistant to solve a real problem fast, which is exactly why security teams can see less than half of what's actually running.

Closing that gap takes a formal process, not a one-time sweep: a review step before an employee-built agent touches production data, a decommissioning policy with teeth, and a way to apply the same four controls to agents that didn't go through a normal procurement cycle. Only 21% of organizations currently have a formal decommissioning process, which means permissions and credentials routinely outlive the agent's intended use, a kind of retirement debt that quietly accumulates risk. Teams that treat their internal agent and automation stack as owned infrastructure, with the same ownership discipline they'd apply to any other production system, tend to close that gap faster than teams waiting on a vendor roadmap; that's the operating premise behind tools like Remy and the broader push toward owning rather than renting the software a company runs on.

What does a practical rollout checklist for production look like?

If you're starting from scratch, sequence matters more than completeness. Trying to do all of this at once usually means doing none of it well.

Figure 7
Retirement debt: agents that outlive their purpose
21%
Organizations with a formal agent decommissioning process
Illustrative figure. Constructed for explanation, not a measured source.
  1. Inventory and discovery. Find every agent currently running, sanctioned or not, before you design controls around an incomplete picture.
  2. Unique identity issuance. Move every agent off shared credentials and onto its own short-lived, attributable identity.
  3. Least-privilege policy. Scope access to the task, make it time-limited, and separate agent-to-tool, agent-to-agent, and originating-user authorization checks.
  4. Sandboxed execution. Isolate anything that runs code or touches sensitive systems, with tool allowlists and runtime secrets injection.
  5. Logging and monitoring. Stand up identity-bound, exportable logging with real-time alerting before you scale agent count, not after.
  6. Decommissioning. Build the offboarding process for agents with the same rigor you'd apply to offboarding an employee.

This sequence maps closely to NIST's Govern, Map, Measure, and Manage functions, extended for agents with autonomy-tier classification and delegation-chain monitoring built in from the start rather than added later.

What does it cost you to skip these controls?

The cost of skipping these controls isn't abstract. Gartner predicts more than 40% of agentic AI projects will be canceled by the end of 2027, specifically because of escalating costs, unclear business value, or inadequate risk controls. And when agent-related incidents do happen, they're not near-misses: 61% of organizations report data exposure, 43% report operational disruption, and 35% report direct financial losses, with no surveyed organization reporting zero material business impact from an agent incident.

None of this is a reason to slow down adoption. It's a reason to stop treating agent security as a configuration checkbox and start treating it as what it is: identity and access management for a workforce that doesn't sleep, doesn't ask permission, and is already larger than your human one.

Frequently Asked Questions

5 questions

What's the biggest difference between securing an AI agent and securing a regular app or service account?

An agent acts autonomously and delegates tasks to other agents and tools, so its risk isn't fixed like a static service account's. The access it ends up using can expand silently as it hops through a delegation chain, which is why unique identity and layered authorization checks matter more than a one-time permission grant.

Do employee-built agents need the same security controls as agents built by engineering?

Yes. The risk comes from what the agent can do and access, not who built it. Security teams currently see only about 44% of the agents and automations business users have built, so the practical priority is discovery first, then applying the same identity, privilege, sandboxing, and logging controls regardless of origin.

Why can't existing application logs track what an AI agent did?

Standard logs record what an app did, not which specific agent session, acting under whose delegated authority, took an action and why. Without a session ID tied to a unique agent identity and a record of the delegation chain, you can't trace an incident back to its source.

What is 'least privilege' supposed to look like for an AI agent in practice?

Scoped, short-lived access granted just-in-time for a specific task, re-checked continuously rather than granted once at setup. Authorization should be enforced at multiple layers: what the agent can do to a tool, what it can delegate to another agent, and what the original human user actually authorized.

How many organizations have actually given AI agents their own distinct identities?

93% of organizations have assigned distinct identities to at least some of their AI agents, but only 27% have done so for all or most of their agents, which leaves a large population still running on shared or generic credentials.

How we source, write, and correct our articles. Editorial standards

Related articles

Straight to your inbox.
New pieces as they publish. No noise.