AI Agent Permissions: How to Limit What Your Agent Can Do
To trust an agent with your cloud, limit its access, not its intelligence: a dedicated key, least-privilege scopes, a monthly spend cap and human approval of every price. On 0x.cloud, sensible AI agent permissions look like this: the agent gets its own API key with scopes to read and create servers, a cap such as $20 per month, and no delete permission unless it truly needs it. Then no new purchase the agent makes can go past the amount you allowed.
Agents make mistakes fast and with confidence. They can create five servers instead of one, pick a bigger plan than needed, or delete the wrong machine. The OWASP Top 10 for LLM applications calls this Excessive Agency, and the cure is the same everywhere: fewer permissions, less money at stake, more confirmations.
What Can Go Wrong and What Prevents It
| Risk | Example | Guardrail |
|---|---|---|
| Overspending | agent creates five s4-8 servers instead of one s1-2 | monthly spend cap and a max server lifetime on the key |
| Wrong plan or period | yearly billing instead of hourly | dry_run plus human approval |
| Deleting the wrong thing | agent "cleans up" a production server | no delete permission, 24-hour restore |
| Leaked key | key ends up in a public repo | dedicated key, spend cap, fast revocation |
| Damage inside the server | agent running as root breaks the system | no servers.exec, separate non-root user |
| Touching other servers | agent "cleans up" production | key sees only the servers it created |
Set Up AI Agent Permissions in 10 Minutes: 7 Steps
1. One Key per Agent
Never hand an agent the key you use yourself. In your dashboard, under API keys, create a separate key for Claude Code, another for n8n, another for Cursor. Each gets its own scopes and cap, and if something goes wrong you disable one key instead of everything.
2. Least-Privilege Scopes
Scopes are granted independently. These are the ones that matter for an agent:
| Scope | What it allows | Who needs it |
|---|---|---|
servers.read, billing.read |
price list, balance, server list | any agent |
servers.create |
creating servers and exact dry_run quotes |
agents that spin up servers for tasks |
servers.delete |
deleting servers | only agents that clean up after themselves |
servers.exec |
commands and files inside the server as root, no SSH | agents that deploy to their own server |
Heads up: a new key gets servers.* by default, which means every server permission, including delete and exec. Uncheck what the agent does not need. Start with read and add create once you have seen how the agent behaves. Scopes and caps change only in the dashboard, so the agent cannot raise its own through the API. Details in API key permissions.
3. A Monthly Spend Cap
The cap applies to the key, not the whole account. Set the amount you could afford to lose in the worst case: $10–20 per month for experiments, more for real workloads. A paid request over the cap is refused with 402 key_spend_limit_reached and nothing is charged. The counter includes servers, add-ons, and the hourly charges and renewals of servers this key created. The cap does not stop servers that are already running, so pair it with step 4. How to pick the number: API key spend limit.
4. Delete as a Separate Permission, Plus a Timer
Without delete permission, the agent cannot remove a single server. Even with it, the MCP delete_server tool requires an explicit confirm: true.
To keep temporary servers from living forever without giving delete rights, use a timer: the agent passes ttl_hours on create, and the server deletes itself with the unused amount back on your balance. The key settings also take a ceiling: every server the key creates is deleted after at most N hours. If it does need to delete (for example, it creates servers for an hour and removes them), you still have a safety net: a deleted server can be restored within 24 hours, and the unused amount goes back to your balance. More in deleting and restoring a server.
5. dry_run and Human Approval
Every create request can go out first with dry_run: the service returns the exact price and creates nothing. Require the agent to show you the price and wait for your yes. Also keep tool approval on in the client itself: Claude, Claude Code and Cursor ask before calling an MCP tool by default, so do not switch that off for tools that spend money.
Follow these rules with 0x.cloud: before creating any server, run dry_run first, show me the plan, billing period, hourly and monthly price, and wait for my explicit approval. Never delete anything unless I name the server. If the price is over $10 per month, suggest a cheaper option.
6. Extra Key Restrictions
The key settings in the dashboard have a few more switches worth turning on for an agent:
- own servers only: the key sees and touches only servers it created, so your production does not exist for it;
- ask before delete and overwrite: delete, reinstall and snapshot rollback go through only after you approve them in the dashboard;
- key expiry and an IP allowlist;
- a rate limit in requests per minute (120 by default).
If the agent hits its cap, it can send you a one-time spend request that you approve or deny in the dashboard. Every change a key makes (tool, server, amount) is recorded in the key's activity log, kept for 90 days.
7. Keep the Key in an Environment Variable
- Store the key in an environment variable or in your MCP client settings.
- Never paste it into a prompt or a file that goes into git. Add
.envto.gitignore. - If the key may have leaked, disable or delete it in the dashboard right away and issue a new one.
# key in an environment variable, not in code
export OX_API_KEY="your_key"
echo ".env" >> .gitignore
Limits Inside the Server
Key permissions control the cloud: creating and deleting servers. Inside a server, it depends on how the agent gets in. With servers.exec, it runs commands through MCP (run_command) as root, so grant that scope only for servers the agent created itself. Over SSH, it has whatever rights its Linux user has. Do not run the agent as root: create a separate sudo user as described in add a sudo user on Ubuntu, and keep model API keys only on the server that needs them.
Common Mistakes
One key for everything. The agent gets your personal key with every permission. Fix: a dedicated key with minimal scopes.
A huge cap "just in case." A $1,000 cap does not protect you from a $500 mistake. Set a realistic amount and raise it when needed.
Everything auto-approved. "Always allow" on the create tool removes your last checkpoint. Keep approval on at least for create and delete.
Delete permission granted by default. If the agent does not clean up servers, it does not need it, and remember that the default key already includes it.
Where to Run an Agent With These Guardrails
The safest setup gives the agent its own server instead of production. For a coding agent on 0x.cloud, s2-4 (2 vCPU, 4 GB RAM, $15.99 per month) with the "For AI agents" image fits well: Node, Python, Git, tmux and Docker come preinstalled. A bot runs fine on s1-2 at $7.99. Hourly billing plus a delete timer keep experiments cheap: an s1-2 hour costs about $0.054725. More on VPS for AI agents.
FAQ
Can an AI agent drain my whole balance? It cannot make new purchases past its key's monthly spend cap: such a request is refused and nothing is charged. The cap does not stop hourly servers it already created, though, and they keep billing. So also cap how long the key's servers can live.
What permissions should I give an agent first? Read only (servers.read, billing.read) with spending off. The agent sees the price list, balance and your server list, but cannot create or delete anything. Add servers.create (also needed for exact dry_run quotes) once you trust how it behaves.
What should I do if an agent's key leaks? Disable or delete the key in your dashboard right away and issue a new one. Review your server list and delete anything extra: the unused amount returns to your balance.
What if the agent deletes a server I need? A deleted server can be restored within 24 hours. To prevent it, do not give the agent's key delete permission.