An agent should reach only the tools, data and actions that the human it acts for could reach. Bind it to that person's identity so a compromised or confused agent cannot exceed their authority.

Access Control for AI Agents (RBAC/ABAC, Least Privilege)Diagram with these labels, in reading order: generates; evaluates; enforces; requests access; User Identity; and Roles; Short-lived Token; (Scoped Access); Policy Engine; (ABAC/RBAC); Tool Boundary; (Authorization Check); AI Agent; (Calls Tools).generatesevaluatesenforcesrequests accessUser Identityand RolesShort-lived Token(Scoped Access)Policy Engine(ABAC/RBAC)Tool Boundary(Authorization Check)AI Agent(Calls Tools)
Access Control Flow for AI Agents

On-behalf-of tokens instead of service credentials

Issue a short-lived, down-scoped token that represents the end user. It carries that user's roles and attributes, so the agent holds exactly the permissions the user holds. OAuth on-behalf-of and STS AssumeRole are two ways to mint such tokens.

The token is what limits the agent: whatever the model is talked into requesting, the call fails if the user could not have made it. That is why the token must be short-lived and tied to one person, and not a credential shared across users.

The alternative is a single API key that grants broad access to every tool. One successful prompt injection then yields admin rights over the whole system. Per-user tokens plus per-tool checks contain the blast radius to what that user could already do.

Authorization at the tool boundary

The model chooses tools from untrusted natural language, so prompt injection becomes a privilege-escalation path. Enforcement therefore sits outside the model: each tool re-checks RBAC or ABAC policy against the caller's identity and does not trust the model to restrain itself.

  1. Mint a scoped token for the user.
  2. The agent calls a tool with that token.
  3. The tool asks a policy engine such as OPA or Cedar to evaluate the ABAC rules.
  4. High-impact tools additionally require human confirmation.

The same rule applies to MCP servers (Model Context Protocol): deploy them with per-user scopes and not a shared admin key, so one user's permissions stay isolated from another's.

The service-mesh comparison

An agent that tries to read a sensitive database, for example, reaches a database tool that checks the user's permissions before it returns anything. Passing the caller's JWT down a service mesh, with each service authorizing independently at every hop, is the closest ordinary pattern. The difference is that a mesh routes calls by fixed code, while an agent picks its calls from text an attacker may influence.

Which deployments need per-user scoping

Any agent that touches multi-tenant or sensitive data needs per-user tokens and tool-level authorization. A read-only single-tenant demo can use something lighter, and it should still default to least privilege.

Token scope A broad service credential can lead to full system compromise. Use scoped tokens to limit access.

Unauthorized retrievals under a user's identity

Example scenario: a user reports that an agent acting as them retrieved data they should not see, with 5 instances logged (an illustrative figure). A likely cause is overlapping role definitions that grant the agent more than intended.

Access Control for AI Agents (RBAC/ABAC, Least Privilege)Diagram with these labels, in reading order: Access Violation Detected; Check RBAC Configuration; Check ABAC Policies; Inspect User Identity; Verification; Update RBAC Settings; Revise ABAC Rules; Enhance Identity.Access Violation DetectedCheck RBAC ConfigurationCheck ABAC PoliciesInspect User IdentityVerificationUpdate RBAC SettingsRevise ABAC RulesEnhance IdentityVerification
Unauthorized access by AI agent
  • Check the access control list for the agent's permissions.
  • Log the specific actions the agent took in each incident.
  • Review role definitions for overlaps or misconfiguration.

Tighten the policies with stricter roles and least-privilege access. This adds role-management overhead. Monitor access logs for further attempts and audit role permissions on a schedule.

Back to the knowledge baseRequest an assessment