Every agent incident report I've read this year ends the same way: someone assumed a boundary. The container "obviously" couldn't reach the network. The agent "obviously" didn't have the cloud keys. The socket "obviously" wasn't mounted.
A sandbox is only a boundary where it removes capability. Everywhere else it's a naming convention with a Dockerfile attached.
Docker's push into disposable agent sandboxes is the right direction, and I'm glad someone with a real runtime is doing it instead of another wrapper around subprocess. But "disposable and isolated" is a claim about defaults, and defaults are exactly where I've been burned. I haven't run their sandbox myself yet, so I'm not going to tell you it's good or bad. I'm going to give you the exercise I run on my own agent containers, because the exercise is the part that transfers.
The exercise
Two questions, in order. First: what does the agent not share with the host? Second: can I take it anyway?
That's it. If you can answer the first question with an actual list rather than a feeling, and the second question with "I tried and failed, here's the log," you have a sandbox. Otherwise you have a vibe.
Enumerate what it doesn't share
Go into the container as the agent will run — same user, same mounts, same env — and write down the truth.
The Docker socket. ls -l /var/run/docker.sock and env | grep DOCKER_HOST. If the socket is mounted, the agent isn't sandboxed, it's root on the host with extra steps, because docker run -v /:/host is one line away. This is the single most common hole I see in "sandboxed" agent setups, and it's almost always there for convenience: the agent needs to run tests, so someone mounted the socket instead of giving it a shell.
The home directory. Check whether ~ is the host's ~ bind-mounted in. Then check what lives in it: cloud credentials, SSH keys, netrc, git credentials, the CLI config with a token in it, shell history that names every internal host you own. An agent that can read your home directory doesn't need to be clever. It needs to be curious for thirty seconds.
Read-write mounts that you thought were read-only. mount inside, then actually try to write. I've caught a "read-only" workspace mount that was rw because of a stale compose override, and a :ro on the wrong path. Also look at what's inside the mounted repo — a remote URL with an embedded token is a credential leak that survives every filesystem check.
Egress. The one people skip. In order: does DNS resolve arbitrary names, can you open a TCP connection, and can you reach the instance metadata address at 169.254.169.254. That last one matters because on cloud VMs, metadata often hands out credentials to anything that asks nicely. If DNS resolves but TCP is blocked, you still have a channel — a slow, lossy exfiltration path that nobody's log query will catch.
Kernel, PIDs, and limits. Are you sharing the host PID namespace? Is there a memory cap, a PID cap, a CPU cap? cat /sys/fs/cgroup/memory.max settles it faster than the compose file does. An agent looping on a tool call without a PID limit is a fork bomb with a language model attached.
User. Are you root inside? Inside a container root is mostly harmless until something else is wrong — and it's always wrong eventually. Run as a non-root user and let the workspace ownership stay sane.
Persistence. Does anything the agent writes survive --rm? Where does it write it? A workspace mount is the whole point, but a workspace mount also means the agent can overwrite .github/workflows and wait for you to merge.
Now try to leave
Write the attempts down and keep them. Mine lives in scripts/sandbox-canary.sh and runs against the real image, not a hand-rolled test container, because the difference between those two is where the bugs live.
set -u fail=0 check() { echo "-- $1"; } check "docker socket" [ -S /var/run/docker.sock ] && { echo "FAIL: socket present"; fail=1; } check "cloud metadata" if timeout 3 bash -c 'exec 3<>/dev/tcp/169.254.169.254/80' 2>/dev/null; then echo "FAIL: metadata reachable"; fail=1 fi check "write outside workspace" if touch /opt/escape-probe 2>/dev/null; then echo "FAIL: writable /opt"; fail=1; fi check "credentials in env and home" env | grep -qiE 'aws_|token|secret|_key=' && { echo "FAIL: creds in env"; fail=1; } check "uid" [ "$(id -u)" = "0" ] && { echo "WARN: running as root"; } exit $fail It's crude and it doesn't prove safety. That's fine. It converts "we think it's isolated" into an assertion that fails loudly when someone bumps the base image and quietly adds a mount. Run it in CI on every image change and the boundary stops drifting.
And then, once, do the ugly version by hand. Try to read something you know is on the host. Try a long-running loop and watch whether the host notices. Try to write a file and see who owns it on the other side. The ugly version is where you learn that your container is fine but the helper your agent shells out to isn't.
The threat model nobody writes down
Here's the part that makes agents different from normal container workloads: your agent writes its own next command. The threat model isn't trusted code doing expected things. It's a tireless, mildly creative process with a shell and no sense of proportion. You don't need to defend against a determined attacker to get burned — you need to defend against a model that decides the fastest way to fix a permissions error is to fix the permissions.
That's why "disposable" is the interesting property, not "isolated." Isolation reduces what one bad command can do. Disposability reduces how long it gets to do it. You want both, and you want both to be defaults rather than things a tired engineer remembers to pass.
My current setup is boring, and boring is the goal: no socket, no home mount, workspace read-write and nothing else, egress denied with a short allowlist, non-root user, memory and PID caps, container thrown away after every task. It took an afternoon to get there and it has cost me exactly one debugging session where I couldn't figure out why a build needed the internet.
Worth it. The alternative is finding out in a postmortem which boundary you assumed.