The Principle of Least Privilege Applied to Agent Tools
Least privilege for agents means every tool starts with the smallest action space that still finishes the job, then expands only with evidence and review.
Search across all documentation pages
Least privilege for agents means every tool starts with the smallest action space that still finishes the job, then expands only with evidence and review.
An LLM that can pick tools inherits every permission those tools carry. Your job is to shrink that inheritance before traffic grows.
In classical security, least privilege says a subject should hold only the rights needed for its task, for only as long as needed.
Agents change the subject: the model proposes actions, and your host executes them.
The model is not a trusted principal. Treat tool definitions as the real authorization boundary.
Three layers matter:
If you only constrain the prompt ("do not delete files") while exposing a full shell, you have policy theater, not least privilege.
Privilege also multiplies across multi-agent designs. A "researcher" with the same write tools as an "executor" recreates a single superuser under different names.
Least privilege fails at any step: kitchen-sink tool lists, weak validation, overpowered credentials, or open egress.
Prefer intent-shaped tools over platform-shaped tools.
| Prefer | Avoid as default |
|---|---|
refund_order(order_id, amount_cents) with max amount | http_request(method, url, body) with prod admin token |
read_ticket(id) | sql_query(sql) against production |
list_files(prefix) under a workdir | run_shell(cmd) as deploy user |
search_docs(query) | browser with logged-in session cookies |
Narrow tools still need validation: type checks, allowlisted IDs, rate limits, and idempotency keys for side effects.
Filesystem and code-execution tools should run in containers or similar isolation with no host mounts they do not need.
Network should default deny, then allow only hosts that tool legitimately calls (model API, your ticket system, not the open internet).
Least privilege without egress control still allows data exfiltration through a "harmless" HTTP tool.
Some rights should not be autonomous: wire transfers, production deploys, mass deletes, external sends to large audiences.
Host-enforced approval is still least privilege: the model may propose, a human or dual-control system grants.
Dynamic tool sets. Load only tools relevant to the current plan step so the model cannot "creatively" reach a dangerous API mid-run.
Privilege bracketing. Elevate for one approved step (mint a one-shot credential), then drop back. Do not leave elevated tokens in long-lived worker memory.
Defense in depth. Prompt rules help operators; they do not replace schema validation, sandboxes, and scoped keys.
Multi-agent handoffs. Pass artifacts and subgoals, not shared super-credentials. The receiving agent should re-authenticate under its own allowlist.
Eval and red team. Measure whether injection or confused tool selection can expand effective privilege. If a pasted document can trigger a refund tool, privilege is too wide or gates are missing.
| Approach | Strength | Weakness | Best fit |
|---|---|---|---|
| Prompt-only restrictions | Fast to write | Bypassable | Never alone in prod |
| Narrow typed tools | Clear intent, easy review | More tooling work | Most production agents |
| Sandbox + no network | Strong for code exec | Harder for tools needing APIs | User-supplied code |
| Short-lived scoped creds | Limits key theft impact | Needs minting infra | Any external API agent |
| Human approval gates | Caps irreversible harm | Latency, UX cost | Money, PII, prod changes |
One read-only tool against non-sensitive data, plus a final text answer. Add write tools only with caps and logging.
If its description could cover many unrelated business actions, or if a single bug can delete data, move money, or hit arbitrary URLs, split it.
Usually no. Missing tools cannot be selected. Keep deny lists for defense in depth inside the host if something is still registered.
It constrains the action space, not the ability to choose within it. Autonomy without bounds is just unsupervised admin access.
All three can help, but enforcement must live in the host and tool implementation. Prompts are guidance only.
Treat remote tool servers as high trust. Allowlist servers, scope OAuth tokens, and prefer tools that expose narrow operations over generic "run anything" endpoints.
Jail to a repo workspace, use allowlisted commands or structured git tools, drop secrets from the sandbox, and require approval for push or deploy.
Avoid it. Split keys by system and role so compromise or over-scope of one tool does not unlock everything.
On every new tool, every autonomy increase, and on a fixed cadence (for example monthly) for production agents.
Yes. Volume is a privilege. Caps on calls, rows, refunds, and emails limit damage from loops and abuse.
Per-run tool allowlist version, policy denials, credential IDs (not secrets), egress destinations, and approval records.
Injection tries to make the model choose harmful tools. Narrow tools and gates reduce what a successful injection can achieve.
Stack versions: Pins from the category manifest (verify at build): OpenRouter (~315+ models, July 2026 pricing/fees); LangGraph 1.0+; CrewAI 1.14+; Microsoft Agent Framework 1.0; Vercel AI SDK 6; Pydantic AI (latest); LlamaIndex (latest); OpenAI Agents SDK (latest + MCP); MCP (Linux Foundation governance); A2A (HTTP+SSE+JSON-RPC 2.0); Solana
@solana/web3.js+@solana/spl-token.
Reviewed by Chris St. John·Last updated Jul 16, 2026