Giving an agent a shell feels like a small step. It's one tool in a list, next to "search the web" and "read file". In practice it's the tool that turns every other mistake into something that actually happens on a real machine.
I've watched a few teams wire this up, and the order is usually: get it working, demo it, then think about what it can touch. I'd flip that. Here's the list I go through before an agent gets to run anything. It's short on purpose. A long checklist is one nobody reads twice.
Quick disclosure: I'm a founding member of Sandscale, which runs agent code in microVMs. Most of this list has nothing to do with which sandbox you pick, and the last section is about what no sandbox fixes.
1. Write down what the shell is for
Not "the agent can run commands". Something like "the agent runs the test suite and installs packages from the lockfile". If you can't write that sentence, you don't know what to allow yet, and you'll end up allowing everything.
That sentence also tells you what a weird run looks like. An agent that was meant to run tests and is now opening SSH connections is easy to spot when you wrote the sentence down.
2. Not on your laptop
Your laptop has your SSH keys, your cloud credentials, your browser sessions and your company VPN. An agent with a shell there has all of it, whether or not you meant to share.
Give it a machine that has nothing worth stealing on it. For code you didn't write and haven't read, I want that machine to have its own kernel, not a container sharing one with other work. That's my bias and also why Sandscale boxes are Firecracker microVMs. A well-configured container is far better than your laptop, though, so don't let perfect stop you.
3. Secrets never go in the prompt
If a key is in the prompt, it's in the model's context, in your logs, and one prompt injection away from being printed back. I treat anything the model can read as something it can leak.
What I want instead: the secret is stored once, the run references it, and it's injected when the run starts. That's how Sandscale Vault works. Values aren't placed in prompts or logs:
sandscale vault kv put app/db password=- The - reads the value without echoing it. Whatever tool you use, the idea is the same: the model asks for "the database", not for the password.
And scope the keys you do hand over. A key that can only read one bucket is a much smaller problem when it leaks than your admin token.
4. Decide what it can reach on the network
Most agent tasks need a package registry and maybe one or two APIs. Very few need the whole internet. Start from the list the task actually needs and add to it when something breaks, not the other way round.
An allowlist is not a wall, though. Data can still leave through a host you allowed, or in ways people don't think about, like DNS lookups. It narrows the problem. It doesn't close it.
5. Set limits before the first run
A timeout on every command and on the box itself. A cap on CPU and memory. A cap on how many boxes can run at once. These feel like ops chores, and they're also security controls: a runaway loop or a fork bomb is a lot less dramatic inside a box that dies after ten minutes.
6. Pick the few actions that need a human
Approving every call is the fastest way to get people clicking "yes" without reading. I'd rather pick the handful of actions that can't be undone: pushing to a protected branch, deploying, sending anything to a customer, spending money. Those wait for a person. Everything inside the box runs freely, because the box is the boundary.
7. Keep a log you'd actually read
Commands, exit codes, which run, which agent, who started it. When something goes wrong you'll want to answer "what did it do and when", and "the model said it was fine" won't be an answer anyone accepts. Sandscale writes these to a hash-chained audit log, but plain structured logs in your own store beat nothing by a mile.
8. Know how to stop everything at once
Before you scale to ten agents, find out how you stop all ten in one go. Not by hunting through a dashboard at 2 AM. A kill switch you've never tested is a hope, not a control.
What a sandbox doesn't solve
This is the part I wish more vendors said out loud, so here it is.
A sandbox keeps bad code away from your host. It doesn't make the agent's work correct. If the agent writes a subtle bug and you merge it, the sandbox did its job and you still shipped the bug. Review still matters.
It doesn't stop the agent misusing access you gave it. If the box holds a token that can delete production data, the box being isolated doesn't help.
It doesn't stop prompt injection. Text in a README or a web page can still steer the agent. The sandbox only limits what that steering can reach.
And it doesn't protect data you sent to a host you allowed. If the agent can post to an API, it can post your files there.
So I think of it in layers. The sandbox limits the blast radius. Secrets handling decides what's in the blast radius. Approvals and logs catch what got through. None of them is enough alone.
The short version
If you only do three things: run it off your laptop, keep secrets out of the prompt, and put a person in front of the actions you can't undo. The rest you add as you go.
What's on your list that isn't on mine? I'm especially curious what people do about item 4, because "just allowlist it" falls apart the first time a build script pulls from somewhere you didn't expect.