(Note · · 6 min read)

An AI agent needs the same permission system as a person

A chatbot that answers questions can be wrong. An agent that issues refunds, edits records or sends messages can be wrong and expensive. The difference is not the model, it is that one of them acts — and the moment software acts on your behalf, the question stops being a prompting question and becomes the oldest question in backend engineering: who is allowed to do what.

By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka

A prompt is not a permission

Telling a model it must never delete a customer is a request, not a control. It works most of the time, which is the dangerous kind of failure, because the exception arrives after you have stopped watching. The same reasoning applies that applies to a user interface: hiding a button does not stop the request behind it.

In Paylio, the payroll product I build, every action is checked for permission on the server when the request arrives, no matter what the interface showed — 139 fine-grained permissions across 7 built-in roles plus custom roles each company defines. None of that logic lives in the frontend, because the frontend is not a place where rules can be enforced. A model's prompt is the same kind of place.

So the limit goes between the agent and the system it is acting on. The agent asks to call a tool; something that is not the agent decides whether that call is allowed, and executes it. That boundary is the entire design.

Give the agent an identity, not your credentials

The common shortcut is to hand the agent the same keys the application uses, which makes it as powerful as the whole system and untraceable within it. Give it its own identity instead, with its own scopes, and grant the minimum the task needs. An agent that answers questions about orders needs to read orders. It does not need to issue refunds because one day it might be asked to.

A separate identity also means the audit trail can answer the only question that matters after something goes wrong: what did it do, and on whose authority. If the agent's actions are indistinguishable from the application's, there is no answer.

When an agent acts for a particular person, it should carry that person's permissions, not exceed them. An assistant that can read any customer's data while helping one customer is a data breach waiting for the right question.

Sort actions by whether you can undo them

Not every tool call deserves the same treatment. The useful split is not risky versus safe, it is reversible versus not.

  • Reading data, drafting text, running a calculation: let it run. Nothing it does cannot be thrown away.
  • Writing to a record it owns, inside a limit you set: let it run, log it, make it reversible.
  • Money moving, messages sent to customers, deletions, anything a regulator or a lawyer would ask about: a person approves before it executes, every time.

The third category is worth being strict about, because it is where the value of an approval gate is concentrated and where the cost of removing it is unbounded. Decide the list with the business, not with the engineer, and write it down where it is enforced rather than in a document.

An approval gate is only real if the person approving can see what they are approving. Show the exact action, the exact target and the amount; not a summary the model wrote of what it intends to do.

A loop will spend your money while you sleep

The most common expensive incident with agents is not a bad decision, it is a cycle: the agent calls a tool, dislikes the result, tries again, and keeps going. Nothing in the model stops it, because from inside the loop every iteration looks reasonable.

Bound it from outside. A maximum number of steps per task, a token or cost ceiling per run, and a wall-clock deadline, enforced by the code that runs the agent rather than requested in its instructions. When a bound is hit, stop and surface it as a failure a person can see. For a system where one agent calls another, the ceiling belongs to the whole run, not to each agent, or the total is simply the sum of several budgets nobody set.

Track spend per agent and per task, not just as a monthly total on an invoice. A loop that started this morning is only visible if something is counting while it runs.

Nothing here is new

Every control above already exists in ordinary backend engineering: least-privilege identities, server-side authorisation, approval workflows for irreversible actions, rate limits, quotas, audit logs. Agents do not need a new discipline invented for them. They need the existing one applied, which is mostly a matter of noticing that an agent is a client making requests, not a colleague being given instructions.

The practical test before letting one loose: if a stranger got hold of this agent and asked it to do the worst thing it is capable of, what would stop them? If the answer is a sentence in the prompt, it is not a control yet.

Common questions

Can I control what an AI agent does through its prompt?

No. A prompt is a request, not a control, and it works most of the time, which hides the exception until it is expensive. Enforce limits between the agent and the system it acts on: the agent asks to call a tool, and code that is not the agent decides whether that call is allowed.

Should an AI agent use the application's existing API keys?

No. Give it its own identity with its own scopes and the minimum access the task needs, so its actions are traceable and bounded. When it acts on behalf of a person, it should carry that person's permissions rather than exceed them.

Which AI agent actions need human approval?

The irreversible ones: money moving, messages to customers, deletions, and anything a regulator or lawyer would ask about. Reading, drafting and calculating can run freely; writes inside a set limit can run if they are logged and reversible. The approval must show the exact action, target and amount, not the model's summary of its intent.

How do I stop an AI agent running up a large bill?

Bound it outside the model: a maximum number of steps per task, a cost or token ceiling per run, and a wall-clock deadline, all enforced by the code running the agent. For multi-agent systems the ceiling belongs to the whole run rather than each agent, and spend should be tracked per task while it runs, not read off a monthly invoice.

Do AI agents need a new kind of security?

Not really. Least-privilege identities, server-side authorisation, approval workflows, rate limits, quotas and audit logs all already exist. The shift is treating the agent as a client making requests rather than a colleague receiving instructions.

Need something like this built?