Least Privilege for AI Agents: Capabilities That Stay Safe


Least privilege is often summarized as “give only the access required for the job.” For an AI agent, that sentence becomes more demanding: the agent’s next action may be selected at runtime, influenced by untrusted content, and executed long after a user first requested help. The safe answer is not a bigger role “so it can finish.” It is an architecture that keeps authority narrow at every consequential tool call.
NIST defines least privilege as restricting access to the minimum necessary for assigned tasks. Its current work on software and AI agent identity specifically asks how agents prove authority for a particular action and how dynamic policy can change as context changes. That is the right frame: least privilege is not a checkbox added at deployment; it is a decision made while a real resource and real request are in hand.
Least Privilege Is a Runtime Property
The OWASP authorization guidance (opens in new tab) recommends deny-by-default, server-side enforcement, and permission checks on every request. Apply all three to agents. A model’s system prompt, tool description, or claimed user approval is not permission. It is input to an orchestration decision.
An agent run should carry a purpose, initiating principal, tenant, expiry, and narrow requested capabilities. The tool that owns data evaluates those facts against its own authoritative resource. This prevents a model from converting “summarize this account” into “export every account” merely because both operations happened to use the same broad API token.
Design Capabilities Instead of Broad Tools
The boundary starts at the tool API. Prefer a focused domain operation over a generic transport or database primitive:
| Focused capability | Scope | Broad alternative to avoid |
|---|---|---|
case:comment | One tenant and case relationship | CRM administrator token |
email:draft | Create an unsent draft for one recipient | Send arbitrary email |
refund:propose | A policy-limited proposal | Payment-provider write access |
document:extract | Read approved documents only | Filesystem or storage bucket read |
The focused form makes policy, logging, approval, and tests comprehensible. A reviewer can ask whether an agent may propose a refund under $100. No one can realistically review what “call any internal API” means after new endpoints are added.
type RequestRefund = {
orderId: string;
reason: string;
amountCents: number;
};
export async function proposeRefund(
input: RequestRefund,
delegationId: string
) {
const delegation = await delegations.requireActive(delegationId);
const order = await orders.find(input.orderId);
await policy.assertAllowed({
subject: delegation.initiator,
tenantId: delegation.tenantId,
action: "refund:propose",
resource: order,
context: { amountCents: input.amountCents },
});
return refunds.createProposal({
...input,
orderId: order.id,
runId: delegation.runId,
});
}The agent cannot choose a different action string or an unrelated resource and hope the tool will accept it. The tool’s signature and policy boundary create the constraint.
Authorize the Real Resource at the Boundary
Never authorize only a user role or a model-supplied tenant ID. Load the resource, then evaluate the user’s relationship, the tenant, classification, request amount, workflow status, and current policy. Role-based access can be one input, but relationship and attribute-aware rules are often needed for tenant-scoped products.
Prompt Injection Is an Authority-Confusion Test
Assume an agent will eventually read instructions that tell it to bypass a rule, reveal a secret, or call a more powerful tool. A policy check at the tool boundary limits the damage even when model reasoning follows hostile content.
Do not share infrastructure credentials across tools of different sensitivity. The agent runtime may need a workload identity to call a tool gateway; the gateway should in turn hold only the permissions necessary for its named capability. Database, queue, and vendor credentials deserve the same separation.
Use Time, Approval, and Revocation as Controls
Authority has a lifespan. A read-only analysis might receive a short-lived grant for a project. A high-impact action may require a one-time approval bound to an exact record, amount, and expiry. A long-running agent should re-check active delegation after waiting, retrying, or resuming from a queue.
Approval should show a person the intended action and consequence—not a generic “allow agent” switch. Create a consumable grant after approval and reject reuse. When a user revokes consent or an operator cancels a run, tools need a durable revocation check, not merely a promise that a token will expire later.
Separate observation from action
Read access can still be sensitive, but it has a different blast radius from an external write. Give an agent a path to inspect a small, approved view of a resource before granting it authority to change that resource. A support agent can summarize a ticket before it may draft a reply; a finance agent can compute a refund proposal before it can create a payment instruction.
That separation improves agent behaviour as well as security. The model has a clear tool ladder: inspect, explain, propose, request approval, execute. It is less likely to combine investigation and side effect in one opaque call, and users see a meaningful checkpoint before a decision crosses a boundary.
Capability boundaries should survive growth
The fastest path to excessive permissions is a helpful general-purpose tool. It begins as customerApi, then acquires export, delete, merge, and billing operations as features arrive. A role that was acceptable for an internal prototype eventually becomes a production liability because every new endpoint inherits the old grant.
Version capabilities intentionally. Adding orders:read should not silently grant orders:cancel. Adding a new sensitive field should not automatically expose it to an existing summarization capability. Keep policy tests beside each capability so a product change must state who can use the new operation, against which resources, and under which conditions.
Design a safe failure response
When a policy check fails, return a controlled denial that helps the orchestrator choose a safe next step. It may say that approval is required or that the requested operation is unavailable; it should not leak the existence, ownership, or confidential attributes of another tenant’s resource. A denial is normal control flow, not a reason for an agent to retry with a different identifier.
For high-impact tools, require explicit confirmation inside the tool call as a second guard. The confirmation should bind the action’s stable inputs—recipient, amount, document version, or deletion target—so a later model turn cannot accidentally reuse it for a different operation. A human approval that is detached from concrete parameters is just an attractive version of a broad role.
Test the Grants You Refuse
Least privilege earns trust through negative tests. Test cross-tenant identifiers, expired delegations, cancelled runs, a role removed mid-workflow, repeated approvals, elevated amounts, and an agent requesting an action outside its declared purpose. Assert not only that the tool returns denial, but that no external side effect occurred.
Log the initiator, workload, run, capability, resource reference, decision, policy version, and outcome. Do not log raw prompts, credentials, or full customer documents. A good audit record lets an operator answer “who was allowed to do what, and why?” without becoming a privacy leak.
Operational rollout order
Retrofitting least privilege is easier when it is staged. First, inventory tool calls and identify the broadest credentials. Next, add decision logging in observe-only mode so you can discover legitimate paths without silently changing them. Then introduce focused capability wrappers around the highest-impact writes, deny newly unknown paths, and gradually shrink the underlying credentials. Finally, rehearse revocation and incident response with a real run ID and a safe test tenant.
Do not wait for perfect policy language before reducing obvious excess. Removing a general database credential from an agent that only needs to draft messages is immediately valuable. The goal is continuous authority reduction paired with evidence that users can still complete their legitimate work.
A capability review before every new tool
Before adding a tool, write its authorization contract in one sentence: “An authenticated support agent, acting for a member of this tenant, may draft—but not send—a reply to a case assigned to that member’s team.” If the sentence needs “and anything else related to cases,” the capability is too broad.
Then review the tool against four questions. What authoritative resource will it load? What exact action will policy evaluate? Which input values affect the decision? What will prove that a denied call had no side effect? These questions turn a vague security review into code, tests, and observability requirements the team can actually implement.
The same review should include the tool’s failure mode. If a request is denied, can the agent offer a safe alternative such as a read-only summary or an approval request? If a required grant expires mid-run, does the job stop cleanly and report its state? A useful capability system keeps failures legible instead of encouraging the orchestrator to search for a more powerful route.
Key Takeaways
- Treat least privilege as a fresh resource-level decision at every consequential tool call.
- Design narrow domain capabilities rather than broad API, database, or vendor access.
- Deny by default and authorize authoritative resources at the service boundary.
- Bind grants to time, tenant, purpose, and where needed a single approved action.
- Prove safety with tests for denial, revocation, retries, and cross-tenant misuse.
Next, we explore sandboxing: how execution isolation, filesystem boundaries, network controls, and durable audit trails keep agent code and tools contained when permissions alone are not enough.