Blog/AI Security

Least-privilege tool permissions for AI agents: a design guide

Design narrow, per-tool permissions and credentials so an AI agent can only do the specific jobs you intended, even when something goes wrong.

By Sagar Makker · 7 min read · October 2026
Programming Code
In short
Give each agent tool one narrow job, not a general API client with broad access.
Run tools with the end user's permissions, never a shared admin service account.
Separate read tools from write tools and put limits on every write.
The problem

This is for CTOs, IT heads and engineering leads wiring AI agents into ERP, CRM, ticketing or finance systems. The fastest way to build an agent is to hand it one powerful API key and a generic tool that can call anything. That works in a demo and becomes a liability in production, because any mistake or manipulated instruction runs with full access. This post shows how to design tool permissions so the blast radius of any single failure stays small and visible.

An operations team builds a helpdesk agent that can look up orders. To save time, the developer gives it the same integration user the ERP team uses for batch jobs, which can also edit prices, cancel invoices and export the customer master. The agent only needs to read order status, but nothing in the design stops it doing far more if a prompt or document steers it.

Audits then become guesswork. Logs show the integration user changed a record, but not whether a person, a batch job or the agent did it, or on whose behalf. When the security team asks what the agent can actually do, nobody can answer without reading code. Least privilege was a principle on paper, not a property of the system.

Why it happens
01One shared service account with admin rights is reused for convenience
02Tools are generic, such as call any endpoint, instead of task-specific functions
03Read and write actions are bundled into the same tool and credential
04Agent actions are not tied to the identity of the user who asked
05No per-action limits on amount, record count or frequency
How to fix it
1
Inventory the jobs, not the APIs
The product owner lists the specific jobs the agent must do, such as check order status or draft a credit note. Each job becomes one tool. Anything not on the list does not get a tool, however convenient.
2
Build narrow tools with fixed parameters
Developers write each tool as a small function with typed inputs and a fixed endpoint, for example get order status by order number. Avoid tools that accept arbitrary URLs, queries or method names from the model.
3
Act on behalf of the real user
The platform team passes the requesting user's identity and scopes into every tool call, using delegated tokens where the system supports them. The agent can never see or change more than that user could through the normal screen.
4
Split read and write credentials
Security issues separate credentials for read tools and write tools. Write tools get tighter scopes, per-call limits you choose, such as a maximum amount or record count, and route above-limit requests to human approval.
5
Publish a permission map and review it
The security owner keeps a one-page map of every tool, its scope, its credential and its limits. Review it whenever a tool is added and at a fixed interval, removing tools nobody has used.
Worked example
A logistics firm's customer-service agent

A freight forwarder in Mumbai launched an agent to answer customer questions about bookings and invoices. The first version used a shared integration login that could also amend invoices and change consignee details. Before go-live, the security lead rebuilt the tool set: four read tools for booking status, invoice copy, container events and document list, each scoped to the logged-in customer's account; and one write tool to raise an amendment request, which created a ticket rather than editing data. After the change, the agent answered the same questions, the audit log showed which customer each call served, and the internal audit review of the agent took an afternoon instead of a week.

Common mistakes
×
Relying on the prompt to restrict actions
Telling the model never to cancel orders is not a control. If the credential allows it, assume it can happen, and remove the capability at the API or scope level instead.
×
Giving agents admin for testing, then shipping
Temporary broad access often survives into production. Start with the narrowest scopes from day one and add permissions only when a specific job is blocked and approved.
×
Logging tool calls without user identity
Without the requesting user and session in each log line, you cannot investigate or prove compliance. Record user, tool, parameters, result and approval status for every call.
Where an AI agent helps
Input
A list of agent jobs, target system APIs and the user roles that will use them
Agent does
Generates narrow tool definitions, maps scopes per role, and flags tools with excess privilege
Human gate
Security owner approves every new tool, scope and write limit
Outcome
A reviewed permission map and per-tool scoped credentials ready to deploy
Checklist
List the specific jobs the agent must perform
Replace generic API tools with task-specific functions
Pass end-user identity into every tool call
Issue separate credentials for read and write tools
Set amount and record-count limits on write tools
Review the tool permission map on a fixed schedule
What to measure
Tools with write access as share of total
Tool calls carrying end-user identity
Unused tools removed per review cycle
Write calls routed for approval per week
Questions
Can we use one service account if we filter access in our own code?

It is possible, but riskier, because any bug in your filter exposes everything the account can reach. Prefer delegated user tokens or per-role accounts, and keep your own filter as a second layer, not the only one.

How many tools should an agent have?

As few as the jobs require. A smaller, well-named tool set is easier for the model to use correctly and easier for your team to audit. Add tools only when a real, approved job needs one.

What about legacy systems that only support one admin login?

Put a thin internal API in front of the legacy system that exposes only the narrow operations the agent needs, with its own authorisation checks. The agent calls that layer, never the admin login directly.

Who should approve new agent tools?

The system owner confirms the business need, and the security owner approves scopes and limits. For tools that move money or change customer data, add the finance or data protection lead as a reviewer.

Keep reading
All posts →
Programming CodeAI Security
Securing AI agents that can take actions in your business systems
5 min readRead →
Concrete WallAI Security
Keeping private documents private in RAG and AI search tools
5 min readRead →
Concrete WallAI Security
How to keep API keys and secrets out of LLM prompts and context
6 min readRead →
Next step

Want this fixed in your business?

Send the workflow. You get a scope and a fixed price within two working days — or a straight answer that it isn't a fit.

Secure by default · find → fix → verify · authorised scope only
Send a brief →enquiry@xdqlabs.com