Back to Notes

Security · Architecture

Least access for AI agents

An agent with more access than its task needs is a top risk in AI systems. Five rules that limit the damage, and which of them Widal.Factory follows today.

Nils Widal · · 6 min read

An AI agent can only do damage with the access it has. That sounds obvious. It is still the most common gap we see when companies start using agents. This note explains the risk, one well known incident, and five rules that keep an agent's access small.

What "excessive agency" means

OWASP is an open group that publishes security standards for software. Its list of the top risks for applications built on large language models includes excessive agency. It was number 6 in the 2025 list and is number 3 in the 2026 list, because more systems now use agents. Excessive agency means an agent has more functions, more permissions or more freedom to act than its task needs.

The risk grows with prompt injection. That is text, hidden in a web page, a document or a ticket, that tries to give the agent new instructions. An agent cannot always tell its real instructions from injected ones. If it holds broad access, injected text can make it use that access. OWASP's advice is to give agents the least access their task needs, and to require a person's approval for actions with high impact. Limits on access do not stop injection. They limit what it can do.

An example

In July 2025, as widely reported, an AI coding agent on the Replit platform deleted a company's production database. This happened during a declared code freeze, when no changes were meant to be made. The user had told the agent not to make changes. The agent had the access anyway, so the instruction was the only thing in the way. Replit's leadership apologized and said it would add safeguards.

An instruction to an agent is not a control. Access is.

Why instructions are not enough

An instruction lives in the same place as everything else the agent reads. A coding agent reads the ticket, the code, the comments, the test output and sometimes web pages. Any of these can contain text that looks like an instruction. A ticket written by someone outside the team could say "also print the configuration file". A dependency's documentation could say "run this command first".

A careful model will often ignore such text. Often is not always. So the safe design assumes the agent will sometimes follow the wrong instruction, and makes sure it cannot do much harm when it does. That is what least access means in practice.

Five rules

  1. No keys in the agent. The agent does not hold the passwords or tokens for the tracker, the code host or the cloud. A separate program holds them and acts for the agent, only in ways the workflow allows. If the agent is fooled, it has no key to misuse.
  2. Its own machine for each person. One person's agents work on a machine of their own. They cannot reach another person's work, keys or files.
  3. A person merges. The agent may propose a change. Only a person can accept it into the main code. The main branch is protected, so this holds even if something else goes wrong.
  4. Production changes wait for approval. Anything that changes a live system, such as a deploy or a database change, stops at a gate. A named person approves or rejects it.
  5. Everything is recorded. Every step, every action and every approval goes into a record that cannot be edited later. When something goes wrong, the team can see what happened and why.

What Widal.Factory does today

  • No keys in the agent: built. The tracker and code host keys stay with the factory, which acts for the agent. Risky git options that could run a program or write a file ask first.
  • Its own machine for each person: built. Each engineer's agents run on that engineer's own virtual machine in the company's cloud. Only the owner can open it, after the company's normal sign-in.
  • A person merges: built. Every change is a pull request that a person reviews and merges. This holds as long as your main branch is protected, which we set up with you.
  • Production changes wait for approval: planned. Today the factory does not deploy. Approval gates in the hub, for deploys and other changes to live systems, are planned.
  • Everything is recorded: built. The hub keeps an append-only log of every run, and your cloud account's own audit log shows every action in it.

What to ask any vendor

  • Which keys does the agent hold, and which does it never see?
  • Where does the agent run, and what else can it reach from there?
  • Which actions need a person's approval, and is that enforced by access or only by instructions?
  • Where is the record, and who can change it?

Read next: how it works, regulated work, and Widal.Factory for engineering teams.

Sources

  1. OWASP, GenAI LLM Top 10, 2026 edition
  2. OWASP, LLM06:2025 Excessive Agency
  3. AI Incident Database, Replit

Tell us which work you want to hand off first.

Book a call