Skip to content
· 5 min di lettura

Least privilege for AI agents

Every engineer who has worked on permissions knows the phrase least privilege. Applied to an agent it is almost always applied wrongly, and the reason is that the model we inherited was built for people joining a company and inheriting a role. An agent does not join a company. It gets a task.

Why the role model does not transfer


  • Roles are long. A person in a finance team keeps permissions for years, and each year the role is reviewed. An agent's authority should last for the length of one task and then expire.
  • Roles are broad. The finance role can do most finance things because the human behind it accumulates judgement over time. An agent has no accumulation. Its judgement is whatever the model produces this second.
  • Roles are attributed to a person. Every access log ends at a human. An agent's action has to end at an identity that is not a person, or the log is a false account.
  • Roles are reviewed by a human who knows the person. Nobody knows what an agent was doing at 3am last Tuesday, so the review has to come from the record instead of from familiarity.

Give an agent a role and you get the worst of both worlds: broad authority with a weak justification. I would rather it have no standing authority at all and a scoped capability that expires when the task ends.

The unit of delegation is a task


The authorisation should be written per task, in the language of the task, and it should be derived from a standing mandate rather than replacing it. A standing mandate is the small, signed document a person grants: an amount, a period, recipients, categories. A task authorisation is one use of that mandate, and it dies when the task is done.


This gives the two properties I actually want. Revocation becomes trivial, because revoking the mandate kills every task authorisation derived from it. And the record becomes readable, because each row names the task, and a reader can reconstruct the whole run by reading the tasks in order.


There is a real design detail in here that I learned from reading someone else's protocol rather than from a principle. Google's payment protocol recommends setting the expiry on an autonomous mandate to the smallest value that will let the task complete. Smallest, not convenient. If the task needs four hours, the capability lives four hours, and then it is gone.


There is one place where least privilege stops being an infrastructure question and becomes a product one, and it is the interaction with the model. The model decides what to propose, and the more capable the model, the more it will propose outside the shape you anticipated. Narrowing the authority is therefore not a way to compensate for a weak planner, it is a way to bound what a strong planner can do to you. The tighter the boundary, the less the planner's ambition matters, and that inversion is worth sitting with: in this category, capability and safety are not the same axis.

The narrowest useful authority


The second half of least privilege is that the authority must still be useful. Over restriction is the failure mode people do not talk about, because it looks like safety. An agent authorised to spend only at one merchant and only up to five euro is safe and useless, and the user's response is to widen it manually, at the moment they are busiest, which is how you end up back at the shared card.


The way I set the boundary is to write it as a sentence the user would recognise as their own intention, then let the engine find the narrowest version of that sentence that the task actually needs. Not narrower than the sentence. Narrower than the task.

The four questions I ask before shipping a permission


  • Does this authority outlive the task? If yes, it is too broad, whatever the amount says.
  • Could the same result be reached with a smaller capability? A single merchant is smaller than a category. A cap on this order is smaller than a monthly cap.
  • If this leaked into a public log, would it read as something the principal would recognise?
  • Does it expire on its own? A permission that survives until someone revokes it is a standing permission wearing a task's clothes.

The third question is the one that catches me. If the row in the log would surprise the person it belongs to, the permission is wrong, no matter how small the amount is. Surprise is the signal. An amount is just a number.


The same principle has a version in the infrastructure, and it is the one I would copy into any agent system. No long lived shared secret that an agent can hold for weeks. A task authorisation produces a credential with the narrowest scope the task needs and an expiry that matches the task, and the credential dies with the task. Revocation stops being an operation that has to reach every component, because there is no component holding anything to revoke. This is the least privilege argument made in a language engineers already accept, which is the only language it survives in.


It also makes the record cleaner. When every credential is short lived and named after the task that produced it, the audit trail stops being a reconstruction and becomes a by product. You do not go looking for what the agent was allowed to do, because the thing that let it do anything is in the same row as the thing it did.

Why this is the boring part of the product


Nobody demos least privilege, because the demo of least privilege is an agent correctly not doing something, and that is a hard thing to put on a landing page. It is also the feature that decides whether the other features are safe to switch on. I have spent this year on a system whose most important behaviour is refusing, and I am not going to pretend that is exciting. It is the reason the exciting parts are allowed.


I am building it at Noesia. The mandate layer that the task authorisations derive from is in what should an AI agent be allowed to do, the credential that carries the scope is in an AI agent should never have your credit card, and the mechanics are in designing an agent policy engine. Why I think the boring version wins is on boring systems.

Building Know Computer, a personal context layer for the AI era. Reply via [email protected].

Altro

Note