In the last chapter you saw the ways an agent like Aria gets taken advantage of: instructions hidden in the text it reads, permissions wider than the job, a refund issued when it should have paused. This chapter installs the first and cheapest defense against all of them. You give Aria the least access it needs to do its job and nothing more, and you cap every action it can take, so that even a bad decision can only reach so far. The word for this is least privilege, and it is the rule the whole rest of the course leans on.
Start from what Aria actually needs
Most agents are built the other way around. Someone wires Aria up to the store's systems, hands it a broad API key because that is the key sitting in the drawer, and moves on. Now Aria can read every order, edit every account, refund any card, cancel shipments, and export the whole customer list, because the key it was given can do all of that. Almost none of those powers are ever used. They just sit there, waiting for the one prompt-injected message or one confused decision that turns an unused power into an incident.
Least privilege flips the default. Instead of starting wide and hoping nothing goes wrong, you start from the job and grant only the powers that job requires. Aria handles three things: where is my order, what is on my account, and I would like a refund. So before you grant anything, it helps to lay the broad grant next to the short list of what the work actually needs.

Read that gap. The left side is everything the broad key can do; the right side is the handful of things the support job needs. The whole practice of least privilege is closing that gap, deciding deliberately which powers cross over to the right and refusing the rest. Everything else in this chapter is just how you do that closing carefully, one kind of access at a time.
Read tools and write tools are not the same risk
The first cut to make is between reading and writing. When Aria looks up order 4815 or opens J. Okafor's account record, it is reading. Nothing in the world changes. The worst case is that it sees something it should summarize but does not act on. When Aria issues a refund, it is writing. Money moves, and you cannot un-move it by apologizing. Treating those two as the same kind of access is how teams end up granting a write power to get a read job done.
So group Aria's tools by what they can change, and put a harder boundary around the writes. Reads can be relatively generous, because a read that goes wrong is recoverable. Writes should be few, named, and capped. The picture below sorts Aria's actual tools into the two groups, with the agent sitting between them.
Notice how lopsided that is, and how it should be. Aria has two ways to read and exactly one way to write, and the single write is already wearing a cap. That asymmetry is the shape of a well-scoped agent. If you find yourself granting a write tool so the agent can technically read something, stop and find the read-only version of that tool instead. Almost every API has one.
Allowlist the few things, do not blocklist the many
Once you have decided which tools Aria gets, you wire that decision in as an allowlist. An allowlist names the small set of things that are permitted and refuses everything else by default. Its opposite, a blocklist, tries to name the bad things and allow the rest, and it loses, because you can never finish writing down everything bad. With an allowlist, anything you did not explicitly think of is denied for free, which is exactly the behavior you want around money and data.
In practice this is a screen of toggles, or the config behind one. You turn on the few powers the job needs and leave everything else off. Watch what that looks like as the over-broad powers come off one at a time, and keep an eye on the meter on the right.
Every toggle you switched off is reach that a bad decision, or a cleverly worded message, can no longer turn into an action. The three powers left on are the allowlist. Notice the meter never had to know what attacks exist. It only had to count how few doors are open, because least privilege defends you without you predicting the specific thing that goes wrong.
Cap every action, not just the tool
Granting the refund tool is not the same as granting an unlimited refund. The tool is on the allowlist, but the allowlist alone would let Aria refund $5,000 as easily as $5. So the next layer of least privilege is a cap on the action itself. For Switchback the rule is simple and concrete: Aria may issue a refund up to $50 on its own. Anything over $50 stops and waits for the on-call human to approve. The cap is not a suggestion in the prompt; it is a number checked in code before the refund tool is ever called.

The diagram is the whole policy in one fork. A refund of $50 or less flows straight through, because that is small enough that an occasional mistake is cheap to absorb. A refund over the cap, like a full $128 order, branches to a human instead of going out automatically. The point of the cap is not that $50 is a magic number. It is that you have decided in advance how much damage a single unattended Aria decision is allowed to do, and you enforced that number in code rather than trusting the model to remember it.
Make the credentials narrow and short-lived
The tools, the allowlist, and the cap all assume Aria is the one calling them. But Aria reaches those systems with a credential, an API key or a token, and that credential is its own piece of the blast radius. A broad, never-expiring key is a standing invitation: if it leaks, or if Aria is talked into using it past its intent, it works just as well for the attacker as it did for you. Least privilege applies to the credential too, in two ways: make its scope narrow, and make its life short.
Narrow means the credential can only do the one job. For Aria's inbox access you do not hand it a token that can read, send, and delete mail. You request gmail.readonly, a scope that can read messages and nothing else, so even a fully hijacked Aria cannot send mail from the company address or empty the inbox. Short-lived means the credential is issued fresh, expires quickly, and is replaced rather than left lying around. A token that lives for ten minutes is a far smaller prize than one that lives forever.

Walk the flow left to right. Aria asks only for the narrow scope it needs, a short-lived token is minted for exactly that scope, Aria does its read, and the token expires on its own a few minutes later. Nothing in that chain is a key that an attacker could pick up tomorrow and still use. The credential is small in what it can do and small in how long it can do it, which is the same idea as the allowlist and the cap, applied to the thing Aria authenticates with.
What least privilege buys you
Step back and look at what these four moves do together. Reads are separated from writes, the writes are on a short allowlist, every refund is capped at $50, and the credentials are narrow and short-lived. None of these defenses tries to predict the specific attack. They simply make sure that whatever goes wrong, Aria did not have the power to make it catastrophic. That is the quiet strength of least privilege: it works against the failure you did not see coming, because the power to cause that failure was never granted in the first place.
The course will keep building on this. The next chapter assumes Aria is already scoped down and asks the harder question of how to stop untrusted text from steering even a well-scoped agent. But scoping comes first, because every later defense is cheaper and smaller when the agent it is protecting can only reach a few things in the first place. Get least privilege right and you have already removed most of the worst outcomes from the table.
- Least privilege means granting only the powers the job needs and nothing more, so a bad call can only reach so far.
- Start from the job, not the broad API key in the drawer: list what Aria actually does, then grant only that.
- Separate read tools from write tools, and put the harder boundary around writes, because a bad write is the one you cannot undo.
- Wire access in as an allowlist that denies by default, never a blocklist that tries to name every bad thing.
- Cap every action in code, not in the prompt: Aria refunds up to $50 on its own and pauses for a human above that.
- Make credentials narrow and short-lived, like a gmail.readonly token that expires, so a leaked key is a small prize.


