Least privilege for agent tools
“How do you apply least privilege to an agent's tools, and why is it harder than for a normal service?”
What this tests
- Scoping permissions per task, per user, per run
- Separating the model from credentials
- Understanding that the model is an unpredictable caller
- Practical mechanisms: scoped tokens, allowlists, read/write separation
Answers by level
Read the beginner answer first and notice what is missing.
Least privilege means the agent can only do what this task for this user requires. Mechanisms: expose a per-task subset of tools rather than the whole catalogue; back tools with credentials scoped to the user's own permissions (the agent acts as the user, not as an admin); split read and write tools so read-only tasks never carry write capability; and constrain arguments (tenant id injected by the tool handler, not supplied by the model). See Tool Permissions and Least Privilege and Permissions, Authentication and Authorisation.
It is harder than for a service because the caller is a model that decides at runtime what to call with what arguments, influenced by content it reads. A service calls the database the way its code says; an agent may call delete because a document told it to. So the permission boundary must be enforced in the tool layer and the backend, never by the prompt, and should assume adversarial arguments.
Operationally: credentials stay in the tool server, short-lived tokens per run, audit logs of every tool call with arguments, and alerts on calls outside the task's expected set.
Green flags · Red flags
- Per-task, per-user, per-run scoping with short-lived tokens
- Credentials in the tool layer, enforcement in the backend
- Read/write separation and server-injected tenant ids
- Escalation path with approval gates for high-risk tools
- Audit logs and alerts on out-of-scope calls
- Considers removing privileged tools from the model entirely
- Permissions enforced via prompt instructions
- A single admin credential shared by all agents
- Model-supplied tenant or user ids trusted by tools
- No auditing