All courses

What never to let an agent touch

List the usual no-go zones: production systems and databases, real customer data, deploy and payment credentials, your home directory, and anything without a backup. Explain how to keep them unreachable rather than just asking the agent nicely.

Builds on: Approvals and permission modes, Environment variables and where secrets live

Read it card by card Start the whole course

Your laptop reaches more than your project

You're about to let an agent fix a small bug in your team's web shop. On your laptop you have: - an open terminal where you set a deploy token earlier today. You'll start the agent from it. - the project's `.env`, pointing at the live customer database and holding your payment provider's live key - a customer export in `~/Downloads` You plan to type: *'Fix the bug. Don't touch production.'* Which of these could the agent actually reach?

It acts as you, so words are not walls

All of them. The agent's commands run as *you*: same account, same files, same environment variables. 'Don't touch production' is just text the model reads. It can misjudge which database is which, or run a script that quietly reads `.env`. Approvals only help if you spot the danger in the moment. Anything it reads is also sent to the model provider. The real protection is distance: it can't damage what it can't reach.

The no-go zones

Keep these **out of reach**, not just forbidden in words: - **Production**: the live systems and databases real users depend on. Keep their URLs and logins off this machine. - **Real customer data**: use made-up samples instead. - **Deploy and payment credentials**: keep them out of the terminal and the project's `.env`. - **Your home directory**: start the agent in the project root, not `~`. Its commands still run as you, so turn on your tool's sandbox (an enforced wall around what commands can reach) if it has one. - **Anything without a backup**: copy it first, or keep the agent away.

A 30-second check before you start

Run this in the terminal you'll start the agent from. - The `grep` catches common secret names. Names vary, so skim the full `env` list too. - `unset` removes a variable from this terminal only. If a startup file sets it, it returns in every new terminal, so delete it there too. - Then read `.env`. The database is on `localhost`: a local copy you filled with fake data. The payment key starts `sk_test_`, so it's a test key, not a live one. Now start the agent from here.
$ pwd
/home/sam
$ cd projects/shop
$ env | grep -i -E 'prod|live|key|token|secret'
DEPLOY_TOKEN=dpl_8f3...
$ unset DEPLOY_TOKEN
$ cat .env
DATABASE_URL=postgres://localhost/shop_dev
PAYMENT_KEY=sk_test_51H...

Why the warning didn't save you

▸ You: Delete the test orders from the database. Do NOT touch production. Your `.env` holds a URL a colleague sent you. It is actually production. The agent reads `.env`, takes it for the test database, and runs a delete. Your warning didn't help, because neither of you knew. The structural fix: point `.env` at a local database with fake orders, and keep production credentials off this machine. Now the worst case is a test database you can rebuild.

Out of reach, not just off-limits

If the agent can reach something, assume it might touch it. Protect production, real customer data, deploy and payment credentials, your home directory and anything without a backup by keeping them unreachable. Use a clean environment, a local database with test data, backups, and the project root as the starting folder, with the tool's sandbox on if it has one. A rule in your prompt is a reminder, not a lock.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.