392 comments

Reminds me of sandboxy - https://github.com/apple/containerization/tree/main/examples...

Also if your thing doesn't work with `pi` out of the box, then low effort

ucyo
Just put the following to your `.config/sandboxy/agents/pi.json`

{ "allowedHosts": [ ".anthropic.com", ".claude.com", ".pi.dev", "npm.org", ".npmjs.org", ".github.com", ".githubusercontent.com", ".pypi.org", ".pythonhosted.org" ], "baseImage": "docker.io\/library\/node:22", "displayName": "Pi", "environmentVariables": [ "IS_SANDBOX=1" ], "installCommands": [ "npm install -g --ignore-scripts @earendil-works/pi-coding-agent", "npm install -g global-agent" ], "launchCommand": [ "pi" ], "mounts": [ { "containerPath": "\/root\/.pi", "hostPath": "~\/.pi", "readOnly": false } ] }⏎

Requires login. Garbage.
What? Does using sbx require login? Bummer.
Yes and they have a specific subscription for managing sandbox policies across the enterprise: Docker AI Governance
You can create those manually but if you want to enforce those then you need the subscription
I build a OSS lightweight, portable VM for those that don't want lock ins: https://github.com/smol-machines/smolvm
nicoty
I have a solution based on Nix that can be used to generate reproducible container images: https://github.com/nothingnesses/agent-images . It lets you customise which agents, harnesses, or any other packages you want included in the VM and it uses `agent-box` for sandboxing.
wonderful, will try to test this in smol machines as well
dizhn
This looks like gvisor but is a vm like firecracker right? Any reason you did not want to use firecracker?

(I am testing this now as a backend for my pet project which currently supports firecracker and gvisor. No network.)

It's a batteries included alternative to firecracker with a couple of new ideas tossed into the mix i.e. portable like a container (bake into a single file and rehydrate the vm anywhere), dynamic resource allocation, etc.
pixard
Ah let's see, do they still want you to LOGIN, in order to use a local dev tool? Yes, yes they do. No thanks Docker. You can keep your buzzword reasoning as to why this is needed.
The one thing I wonder about is how you enforce the usage of Docker Sandboxes vs running the agent on the host directly, apart from scanning machines for binaries
been using this for a while - works great! Has also had a lot of updates over the past year so worth checking out again if you tried it a while ago
zingar
Do the agents come preinstalled in the images? Or do they somehow use whatever I’ve installed locally? The former makes sense to me but then I’m wondering whether the sandbox images stay up to date with new releases of each image.
aborsy
The agent is per installed. If there is an update to the agent, the VM notifies you on a first run and updates it if you approve.

Other than the login problem, it’s a decent option.

notsirius OC
Sometimes is up to date. When its not - you can just use a kit and add command: install : codex update https://docs.docker.com/ai/sandboxes/customize/kits/
Docker management will fail their tech at every opportunity.
outof
Like many people, I suspect, I used Claude to write my own agent sandbox that suits my needs very well. Investing my time in a propietary product has become a hard sell.
zingar
Were you following any patterns/standards/advice on what you needed to protect against? Anything you can point the rest of us to?
You want to prevent the agent/others from reaching your home directory and other things. As long as you don't mount/sync directories/files from/to the container, so no mounting like "-v $(pwd):/app", but instead copy in, then when done, copy out.

And of course, instead of doing the "copy in > copy out" process manually, get your local agent to write a bash script that does that for you, given what directory you're in, and you're basically G2G.

tjoff
What is the advantage of copying rather than a bind-mount?
"Oops I deleted everything under $FOLDER – that mistake is on me" doesn't kill it on your host system
tjoff
Sure, but all projects are version controlled? You only mount the project dir so you can only loose your current changes - which is the same if you copy...
hvb2
What specifically are you looking for? If you start from the premise that it runs as you right now, then that's something you can easily improve upon.

Start by mounting just your repo and passing in the keys for the agent. Take it from there, it's like software engineering, you iterate.

When you run into issues you expand the tools in the container available to it.

> Were you following any patterns/standards/advice on what you needed to protect against?

Just the general knowledge that sharing a kernel with untrusted software is too dangerous, that hardware virtualization is an infinitely smaller attack surface and that the entire industry will be in deep shit if people or AI breaks hypervisors.

Initial threat model was supply chain attacks but eventually grew to include AI harnesses as well. Not very worried about them hacking me, more about accident prevention.

So that means each VM must be running a completely independent kernel that's fully isolated from the host's file system. They must also have fail closed network filtering built in.

> Anything you can point the rest of us to?

I have published my virtdev's design document.

https://github.com/matheusmoreira/virtdev/blob/master/DESIGN...

Yes, it is AI generated.

In summary, it's a QEMU VM orchestrator with a base OS image and project specific delta images. VM lifecycle is managed by systemd. System level isolation is already pretty good and it already solves the "AI wiped out my $HOME" problem. I'm currently working on a custom network stack to replace the nftables based firewall.

I did the same thing. It was my first "vibecoded" project. I've been using it every day and it's great. I'm writing a custom Rust network stack for it right now. Gonna replace the current nftables firewall with it.

As for Docker Sandboxes, I'll just ask Sol literally right now to see what it does better than my virtdev, and then I'll improve virtdev instead of using Docker.

rvz
Why developers will never pay for their tools.
TO me, that's the important distinction: sandboxing limits what the agent can do but it doesn't necessarily enforce that the agent must run inside the sandbox. You need a separate control layer to enforce that boundary.
nezhar
You design the sandbox so the agent starts in that layer. The next thing you can do is to limit the network access, this is what I'm working on right now.

Or do you mean something else?