# How to stop an AI agent from deleting cloud resources through an API

Source: https://osevel.com/learn/stop-ai-agent-cloud-api-deletes/ · reviewed 2026-11-28

> Database rules do not help when the agent deletes the database itself through the provider’s API. Keep provider tokens out of files the agent can read, give the agent a stand-in instead of the token, and check each call on its way out: reads and everyday changes go through, and a call that deletes data or backups, reveals a secret or gives someone access waits for a person.

## How an agent reaches a cloud API

- A token in a .env file, a shell profile or a CLI’s own login file, which the agent reads like any other file.
- The provider’s CLI, run by the agent with that login.
- The provider’s hosted MCP server.
- One call can delete a project, a volume or a backup, or return every secret of a service.

## It has happened

In April 2026 a Cursor agent at the startup PocketOS found a Railway token in an unrelated file and used it to delete a storage volume. The backups were on the same volume, and the company was down for about 30 hours, as Tom’s Hardware and Euronews reported.


## What works in general

- Use the provider’s narrowest token where it has one: a project token, not an account token.
- Keep tokens out of plain files in the project and the home folder.
- Put a check between the agent and the provider that knows which calls are dangerous.
- Make dangerous calls wait for a person who sees the whole call.

## What OsApi does

- OsApi checks the calls agents make to Railway, Neon, Supabase, Render, Vercel and GitHub, their APIs and hosted MCP servers, before they leave your computer.
- The agent holds a stand-in, not the token; OsVault puts the real key in on the way out, after OsApi has decided.
- Reads and everyday changes go through. A call that could delete a database, its backups or a repository, reveal a secret or give someone access is held, and so is a write OsApi does not know.
- You allow or refuse a held call in the dashboard with your passkey, or at the terminal with a code. An approval lets exactly that call through once, within 15 minutes.
- Deleting data or backups, and restoring over data, always ask, whatever your own rules say.
- osevel api scan lists the provider keys an agent could use without OsApi seeing the calls, and never prints a key.

## Questions

### Does OsApi see a token in a .env file?

No. It sees a call only when the agent uses a key OsVault holds locked. osevel api scan lists the keys it cannot see, so you can move them into a vault.

### Do deploys wait for approval?

Not by default: deploys, jobs and functions go through. A preset makes them ask in production runs.

### Is a force push with git checked?

No. OsApi reads GitHub’s API, not git itself, so a force push through git is not checked yet.
