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.
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.
- Mint a scoped token for the user.
- The agent calls a tool with that token.
- The tool asks a policy engine such as OPA or Cedar to evaluate the ABAC rules.
- 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.
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.
- 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.