Giving an AI Agent Access: Permissions and Guardrails
A step-by-step approach to scoping accounts, files, tools and spending for an AI agent, with approvals, logs and a way to shut it off.
Key takeaways
- Start from the task and grant only what it requires, preferring read-only access.
- Use a separate account or scoped token so you can limit, audit and revoke the agent without touching your own.
- Require confirmation for sending, deleting, paying, publishing and changing access.
- Enforce limits in software and account settings, because written instructions alone can be ignored.
- Keep backups, logs and a tested way to switch the agent off.
Give an AI agent the smallest set of permissions that lets it finish the job, through its own account or token where possible, with approval required for anything you couldn't easily undo. Then make sure you can see what it did and cut it off in under a minute.
The reason for caution is practical. An agent chooses its own steps, it can misunderstand you, and text it reads along the way can try to redirect it. You want a setup where the worst realistic mistake is annoying and not disastrous.
Start with the task, not the tool
Setup screens often ask for everything at once: your mail, your drive, your calendar. Pause and write one sentence describing the job. "Draft replies to support questions using our help articles." Then list what that sentence requires:
- read the incoming support messages;
- read the help articles;
- save drafts.
It doesn't require sending, deleting, reading your personal mail or seeing billing records. Anything not on the list stays off. You can add access later when a real need appears, which is far easier than discovering what was exposed.
Ranking actions by risk
Not all permissions are equal.
| Level | Examples | Default stance |
|---|---|---|
| Read public data | Web search, published docs | Allow |
| Read private data | Mail, files, customer records | Allow narrowly, think about where it can flow |
| Create drafts or copies | Draft email, new branch, scratch file | Allow, review afterward |
| Modify existing data | Edit records, rename files | Allow with history or backups, or ask first |
| Send, publish, delete, pay | Email, posts, purchases, removal | Ask every time |
| Change access or security | Add users, create keys, alter firewall rules | Keep with a human |
Reading looks harmless, but combined with any outward channel it becomes a path for leaks. That combination is what makes prompt injection dangerous.
Give the agent its own identity
Letting an agent use your main login means it inherits everything you can do, and its actions look like yours in every log.
Better options, depending on what the service supports:
- A dedicated account with membership only in the relevant folders or projects.
- A scoped token limited to specific actions, ideally with an expiry date. Understanding keys, tokens and OAuth scopes helps you read these screens.
- A delegated connection through the service's authorization flow, which you can revoke from account settings.
Don't paste your password into a chat so the agent can "log in for you". Where a login is needed, enter it yourself in the real sign-in page, and keep secrets in a store the harness reads without showing them to the model.
Never remove multi-factor protection from an account to make automation easier. If a workflow can't work with it, redesign the workflow.
Three worked setups
These hypothetical examples show the same method applied to different jobs.
A research helper. It gets web search and the ability to write into one notes folder. It gets no access to mail or private files. The main risk is misleading content, so you ask for links beside each claim and check the important ones.
An inbox triage assistant. It reads messages, applies labels and writes drafts. It cannot send, delete or change forwarding rules. Because every email is untrusted input, it also gets no web browsing, which closes an obvious route for sending information out.
A coding agent. It works in a copy of one repository inside a container, runs tests and proposes changes on a separate branch. It has no production credentials. A person reviews the differences before anything merges, and installing new dependencies requires approval.
In each case you can describe in one breath what the agent could do on its worst day. That's a good sign. If you can't, the access is too tangled.
Fence the environment
For agents that run code or commands, the surrounding environment is your strongest guardrail.
- Run them in a container, virtual machine or separate user account.
- Mount only the project folder, and mount reference material read-only.
- Keep production credentials out of the environment entirely.
- Restrict outbound network access to destinations the task needs.
- Use version control so every change is visible and reversible. In a Git project,
git statusandgit diffshow what changed before you accept it. - Take a snapshot or backup before a large operation.
A sandbox is only as good as what you put inside it. A folder containing your key files, mounted into an isolated container, is still exposed.
Design approvals people will actually read
If an agent asks permission fifty times an hour, you'll start approving without looking. That's worse than fewer, better prompts.
- Auto-allow harmless reading inside the agreed scope.
- Group related drafts for one review at the end.
- Stop for the actions that matter, and show specifics: the recipient, the full message, the file list, the amount, the exact command.
- Make "no" easy, and let the agent continue other safe work.
- Be suspicious of any request that doesn't connect to your task.
Avoid "always allow" for broad categories such as running any command or sending to any address. If you grant a standing permission, make it narrow: this tool, this folder.
Set limits that don't depend on good behavior
Writing "never spend more than a small amount" in the instructions is a request. A limit in the payment system is a rule.
- Spending caps on model usage and any paid service.
- Maximum steps and running time per task.
- Rate limits on messages, deletions and external requests.
- A virtual or prepaid card with a low limit, if purchases are truly needed.
- Allowlists for recipients or websites.
- An automatic stop after repeated errors.
Think about loops. An agent that retries a failing job all night can produce a surprising bill or flood someone's inbox.
Browser agents need extra care
An agent that drives your everyday browser is signed in wherever you are. It can reach banking, shopping, mail and social accounts without ever asking for a password, because the sessions already exist.
Use a separate browser profile for agent work, signed in only to the sites the task needs. Keep payment details and the password manager out of that profile. Sit and watch the first runs, and handle sign-ins, purchases and agreement checkboxes yourself.
Check the terms of the sites involved as well. Some prohibit automated access, and accounts can be limited for it. Many sites also detect automated traffic and may challenge or block the agent. Trying to disguise it isn't the answer; use an official interface where one exists, or do that step by hand.
Shared and family accounts
If an agent acts inside a shared space, such as a family calendar, a team drive or a joint shopping account, other people are exposed to its mistakes and its view of their data. Tell them before you connect it. Limit it to your own items where the service allows, and avoid giving it any administrator role over other users.
Write clear instructions too
Instructions aren't security, but they prevent many honest mistakes. A good brief states:
- the goal and what "done" looks like;
- what is off limits;
- when to stop and ask;
- how to handle missing information (ask, don't guess);
- what report you want: actions taken, items skipped, anything unusual.
For example: "Work only in the reports folder. Don't delete anything. If a file seems to be missing, tell me instead of recreating it. Finish with a list of every file you changed."
Ask for a plan first on larger tasks. Reviewing a short plan catches a misread goal before any damage.
Watch, review, revoke
Once it's in regular use, check the activity log on a schedule. Set alerts for events that should never happen. Review connected apps in your account settings and remove stale grants, much as you would with any third-party app permission.
Know your off switch: where to revoke the token, disable the account and stop running tasks. Try it once before you need it.
When something goes wrong
- Stop the agent and revoke its credentials.
- Preserve logs and the conversation before cleaning up.
- List what it read, changed and sent.
- Restore from version history or backups.
- Rotate any secret that was visible to it.
- Tell people affected, and your security or privacy contact if this is work.
- Fix the permission or limit that allowed it, then retest.
A short pre-flight check
Before you press start, answer these:
- What's the worst thing it could do with this access?
- Could I undo that?
- Would I notice?
- Does anything it reads come from strangers?
- How do I turn it off?
If the first answer worries you, remove access until it doesn't. Teams can fold these questions into their workplace AI rules, and anyone connecting new tools through MCP servers should ask them for each server added.