Skip to content
AI360XpertBeta

Tool Permissions

An agent's tools are its hands. Permissions choose which hands it gets, so a tricked model can look up order 1842 but cannot delete your database.

A hijacked agent's delete request stops at the permission gate while its read request passes through to the database
A hijacked agent's delete request stops at the permission gate while its read request passes through to the database

Why Does This Exist?

A chatbot that gets tricked writes a bad sentence. An agent that gets tricked takes a bad action. The moment you hand a model tools, reading email, issuing refunds, running queries, deleting records, one hijacked turn can move money or destroy data. That is the gap this page closes.

The hijack is not hypothetical. A single hidden line in a page the agent reads can override your request, and that attack has its own page in indirect prompt injection. You cannot promise the model will never fall for it, so you plan for the day it does. Least privilege is that plan: give each tool the smallest grant that still lets the job finish, so a compromised turn reaches as little as possible. Practitioners call that reachable remainder the blast radius, and shrinking it is the whole game.

Before you go further, lock in the one idea this page builds on. In tool use and function calling, the model never touches data itself. It names a function and its arguments, and your code checks the call and runs it. Permissions live in that checking step, outside the model, where stolen words cannot rewrite them.

This page covers which tools the agent may call and what each call may touch. It does not cover caging code execution, which is agent sandboxing. It does not cover screening inputs and outputs, which is guardrails. The full layered setup, and where this layer sits in it, lives in agent security.

Think of It Like This

A hotel key card, not the master key

You check into a hotel and get a key card. It opens the lobby, your floor, and your room. It does not open every room, the cash office, or the electrical closet. The front desk also caps what you can charge to the room, and anything beyond that needs you to show up in person with ID.

Map it across. The card is the agent's scoped credential. Each door is a tool scope: reads it may open, writes it may not. The charge cap is the amount limit on writes. Showing up with ID is the human approval step. And if you lose the card, the finder still cannot empty the safe. That capped loss is the blast radius.

Where it stops: a key card cannot be talked into opening a door it was never cut for. Your agent can. A hijacked model will try every handle, politely and repeatedly, which is why the gate must sit in code the model cannot edit, not in instructions it can be told to ignore.

How It Actually Works

Three grants, one gate, checked on every call before anything touches real data.

The three grants

Every tool call arrives as a pair: t, the tool name the model chose, and a, the arguments it supplied, such as an order id or a refund amount. Here t means which tool and a means what it was asked to do. Your policy holds S, the scope granted to that tool: which rows, paths, or amounts it may touch.

The gate returns one of three answers. Allow means the tool is granted and the arguments sit inside its scope, so the call runs at once. Hold means the tool is granted but the arguments cross into risky territory, an irreversible target or an amount above the auto cap, so the call waits for a human yes or no with its state saved. Deny means the tool was never granted at all, so the call never runs and the model hears that it does not exist for this job.

Two habits make the gate hold. First, split reads from writes: a summarizer gets lookup tools but no delete tool, so a hijack can leak what it can read but cannot destroy what it cannot name. Second, scope credentials to the user: the tool acts with that person's token, touching only what they could touch themselves, never with a root key that opens everything.

Worked example: four calls, three fates

Picture a support agent with this policy: lookup tools run freely, refunds up to $25 run at once, refunds above $25 wait for you, order cancellation always waits, and account deletion is not granted to anyone on this job.

One hijacked turn fires four calls:

  • lookup_order on order 1842. A read inside scope. Allow. It runs.
  • issue_refund of $18.50 on order 1842. Here $18.50 sits under the $25 cap with $6.50 of headroom (25 minus 18.50), so allow. It runs.
  • issue_refund of $400 on order 1901. Here $400 clears the $25 cap by a factor of 16 (400 divided by 25), so hold. It waits for your yes or no.
  • delete_account on user 771. No grant exists, so deny. It never runs.

Count the batch: 2 run at once, 1 waits, 1 never runs. Those are the numbers drawn in the diagram above: the read lane passes through the gate to the database, the big refund sits in the hold row, and the delete stops at the gate with no grant.

The trade-off, and when to skip the gate

Tighter scopes buy safety with waiting. Every hold interrupts the job and asks for your time, and a policy that floods reviewers trains people to approve without reading. Looser grants buy speed with exposure: fewer interruptions, but one bad turn reaches further. Set the auto band where mistakes stay cheap, refunds back to the original card under $25 and reads that change nothing, and hold the rest: money above the cap, messages to customers, anything you cannot undo.

Skip fine-grained scopes only where there is nothing real to protect: a throwaway demo with fake data and no network, money, or deletes. Even there, keep the gate code in place so promotion to production cannot forget it. The assumption underneath it all is that the policy lives outside the model. If the agent holds a root key, or approvals auto-fire, the gate is decoration and the blast radius is everything.

Code

The check below is the gate in miniature. It mirrors the worked example's rule: unknown tools deny, big refunds hold, and everything else granted runs.

from typing import Literal
Grant = Literal["allow", "hold", "deny"]

def decide(tool: str, amount: float, grants: dict[str, str], cap: float = 25.0) -> Grant:    """Return the gate's answer for one tool call."""    if tool not in grants:        return "deny"    if tool == "issue_refund" and amount > cap:        return "hold"    if tool == "cancel_order":        return "hold"    return "allow"

grants = {"lookup_order": "allow", "issue_refund": "allow", "cancel_order": "allow"}print(decide("lookup_order", 0.0, grants))     # -> allowprint(decide("issue_refund", 18.50, grants))   # -> allowprint(decide("issue_refund", 400.0, grants))   # -> holdprint(decide("delete_account", 0.0, grants))   # -> deny

The four prints land exactly where the worked example does: two allows, one hold, one deny. Wire the real gate the same way, with scopes and approvals around it instead of a dict.

Watch Out For

The root key that makes every scope a lie

Your policy says read-only, yet a hijacked test turn deletes a staging row. The symptom gives it away: the call log shows success against data the agent's own grant should never have reached. The cause sits one layer down. The tool was built with a deploy-time admin key, so every scope check passed against privileges the agent was never meant to hold.

Fix it at the credential, not the prompt. Hand each tool the current user's scoped token, enforce the scope on the server that owns the data, and keep root keys where application code cannot import them. Then re-run the hijack in staging: the same delete must now land as a deny.

Approval fatigue that turns you into a yes button

Holds work until they flood you. When the queue never drains, humans stop reading and start clicking, and the first unread yes on a $400 refund is the breach. The symptom is easy to spot: holds get approved in seconds and nobody can say what the last three were for.

Narrow the stream instead of scolding yourself. Auto-allow the band where mistakes stay cheap, refunds under $25 back to the original card, and hold only what is irreversible or over the cap. Show each hold with its full context, order, amount, and reason, and audit the hold log weekly: recurring approvals are grants waiting to be written down.

The Quick Version

  • Tool permissions decide which tools an agent may touch, checked in code before anything real runs.
  • Default to read-only tools, and grant each write its own scope with an amount cap.
  • Hold irreversible or over-cap calls for a human yes or no, and answer ungranted tools as deny.
  • A hijacked agent with least privilege can read order 1842 yet cannot delete the database.
  • Scope every credential to the acting user and re-audit grants each time the agent gains a feature.