I wrote one that has both of those: yoloAI (MIT, Go, single binary, no login).
https://github.com/kstenerud/yoloai
Outbound firewall is `--network-isolated`: egress is denied except the agent's own API endpoints plus domains you allow, enforced sandbox-side (working on host-side enforcement now). `--network-none` if you want nothing.
Credential brokering works the way you describe (currently Claude-only, I'll add more as time allows). The API key stays on the host, a local proxy injects it into the outbound request, and the sandbox never holds anything worth stealing. Other agents' credentials currently arrive as read-only file mounts instead (weaker, and something I'll fix soon). Generalising the injector is the obvious next thing.
One difference from your setup: yoloAI copies your worktree instead of mounting it. The agent works on the copy, you `yoloai diff`, and `yoloai apply` replays the commits into your real repo. That's deliberate. Docker's own security docs talk about the dangers of bombs being left behind in a live-mounted dir (git hooks, package.json scripts, Makefiles, IDE task config), which diff/apply avoids.
Isolation is per-sandbox rather than fixed: runc, gVisor, or Kata VMs (QEMU or Firecracker) on Linux; Seatbelt or full macOS VMs via Tart on a Mac.
> yoloAI copies your worktree instead of mounting it
Cloudflare/artifact-fs does lazy shallow git clones with a FUSE filesystem. https://github.com/cloudflare/artifact-fs
Would that be faster?
Re: sandboxing methods like Clawk, Amla sandbox, bwrap, agentvm, ARM64 MTE with wasmtime-mte:
https://news.ycombinator.com/item?id=48893850
A few months ago now I started adding seccomp sandboxing to jinja2rs and then liboverlayfs support to ansiblers (which are early Rust ports).
Haven't finished that, but
I started working on a VM format that stores signed machine state into an OCI container repository, using the hypervisor migration support of KVM/QEMU.
Though this is not safe yet if ever, VM migrations are probably another way to sandbox and deploy en masse.
Agreed. Network control and secret injection together with a microVM setup is as good as it gets right now, although I believe that we need more fine-grained tools down the road. It sounds like Microsandbox would be the perfect fit for what you are describing. I also built my own coding agent workbench on top of it (https://github.com/isolade/isolade). Microsandbox is quite cool, check it out: https://github.com/superradcompany/microsandbox
I've put some effort to integrate it to my agentic workflow. The problem, however, with docker in smolvm: it work-ish (there is example), but quite hacky.
Another problem which I wasnt able to solve - persistent image without Dockerfile. CloudInit will be ideal.
Documention at this moment in an early stage.
Overall, its a great project but for me was simpler just use Virtual Machine Manager (libvirt GUI).
I wish all luck to the maintainers, but probably DX-wise I will prefer to have more granular or predictable controls (eg micro cloud from Canonical).
I'm aware of them!
Yep - similar in some ways but headed towards different directions.
I am building a virtual machine to simplify/replace container infra. Ex. we run containers inside of linux VM's even in the `cloud`, resulting in managing both the vm, and the containers.
But smol machines is a lightweight, portable VM that you can package into a single portable .smolmachine file to be rehydrated on any platform, kind of like how containers are used for today.
Sandboxing happens to be a feature of virtual machines, so we are alike in being used for sandboxing.
Don't want to say it's better, but I implemented Agent Circus (https://github.com/Embedded-Focus/agent-circus) which allows to lock AI agent harnesses into docker containers.
I'm using it as my main driver since months.
Support for running agent harnesses in unprivileged podman containers is on my feature list. :-)
Docker containers are not enough isolation for anyone that cares about jailbreak scenarios.
Only real alternative is to use microvms. My goto solution for this are apple/containers.
> Docker containers are not enough isolation for anyone that cares about jailbreak scenarios.
For the vast majority of developers, containers are enough, which is why they are ubiquitous while vms are less common. Ofc that ubiquity has led to lazy configuration, which is how the jailbreaking can occur. Knowing what you are doing with containers is a requirement to use containers as an AI sandbox.
the big thing containers don't allow is for the agent to run and use docker itself without compromising the host
I'm not sure where "vast majority" cuts in but I would say a huge number of developers use docker and it is inconvenient at best if your AI harness can't actually run and test the infra it is building against
The AI launches new kernel bugs as matter of course.
> Only real alternative is to use microvms. My goto solution for this are apple/containers.
Why microVMs? I never ever run a container, AI harness or other, in something else than a full on VM. I could use a microVM but in any case I really don't see why I'd run a container on one of my bare metal OS: the place of a container is inside a VM (or microVM).
Especially for AI harnesses where the threat of an escape is very real: the more defense in depth, the better.
And If I can use rootless Podman instead of "rootfull" Docker, the better. Most of my containers are Podman btw.
> My goto solution for this are apple/containers.
To each his own: my goto solution is an actual server on my LAN with shitload of cores and memory and plenty of scripts to provision VMs etc.
I really don't understand why people are YOLO'ing containers on their bare metal OS.
> I really don't understand why people are YOLO'ing containers on their bare metal OS.
You know about the people who do not bother with the container? Quite a few make “No problem so far” comments on HN discussions.
I agree. I thought everybody knew to never use docker for high security, because it is "security lite". Might as well just use firejail. I presume that an agent knows more about networking and virtualization than I do. The only real solution is using multi-tenant level vm isolation, while presuming that the agent still might break out of their vm. So the vms need to be hosted on their own physical box that only runs the kvm provisioning host (or similar), and is firewalled on its own isolated network. It's a bit of a pain of course, but anything less feels almost like security theatre rather than meaningful to me. Otherwise you need to stick to the remote chatbots only.
multi-tenant level vm isolation does not solve, imho, specific issues like data exfiltration (ssh private key, api tokens) or privilege escalation, as the vm still contains the whole kernel and userspace inside. So breaking out of the vm may be a realistic scenario.
Yes of course, the secrets have to be isolated from the VMs, preferably at the network gateway and not on the same KVM host. But as far as I know there is no safer containerization technology than a VM, and the only way to be more secure would be to have a physical computer per agent process? A KVM does not use the host kernel and user space, and provides hardware level isolation (the CPU hypervisor etc), that's the point. I think that once you are inside of vm, just using firejail is the better approach, since you have more direct control over the OS level controls that are being leveraged by various container solutions anyways. At any rate, that's what I did.
If you can't isolate a computer on your network, you probably can't isolate your network from the internet, so it's an irrelevant exercise at that point. And yes, probably you can't do any of those things and any frontier model could technically hack your network, but I don't think there's a better way to do it?
Many thanks for the insight. Actually you are right, kvm provides a different level of isolation. If there is a better way to do it... Not sure about that. It seems this is somehow unexplored territory right now, and the current hype about frontier-models capable of """everything""" is difficult to fight against.
Entire VMs bring quite a lot overhead, though, I picture it as many agents being able to run in isolated environments in the very same dev laptop.
My current approach has been to use podman so far. It supports libkrun, so I may give a try to microVMs in my current project.
The nice thing about running a microVM like a container is the interface is relatively easy, especially if you've used containers before.
[deleted]
There were not the solution for a while now, that is why Kata containers came to be in first place.
What specifically do you want? I have:
https://github.com/pjlsergeant/byre -- slightly different security model, but lazer-focused on developer experience; my daily driver and I love it not just because I wrote it. The TUI is great for configuring and setting up instant boxes just how you want
https://pleasedonotescape.com/ -- a list of every other agent jail I could find, filterable by open-source and whatever else you want
Isn't Nvidia's openshell exactly what you're looking for?
I'm asking because I'm just learning about this stuff myself and tested openshell yesterday with pi for the first time.
https://github.com/NVIDIA/openshell
I have a colleague who's using openshell. The advantage is it's independent of the containerization layer, yes?
Looking at the Readme it seems like it only supports docker. Which is a dealbreaker for some
What is missing in qemu + podman that we need rootful docker for this? Is there actual capability that is missing or is it more of a design choice by the eclipse enclave folks?
I use Linux Containers managed by Incus for working with Claude.
I have a dedicated container for that. It can run its own Docker daemon and other system services if needed.
Apart from the Claude login token, it has no SSH keys or other credentials. I push everything I need to it from the local machine. And I pull the Claude generated outputs from it.
Of course, this kind of setup requires a stack which can run or at least be tested without any credentials.
Love Incus and I'm using throwaway restricted projects for testing. Highly recommend incus-windows if you need to do any Windows testing. Having agents validate Windows behavior has reduced so much toil for me.
I do the same, but with pi.dev in Incus, mapping a project folder into the VM.
What I don‘t have compared to sbx is an outbound firewall, but my VM does not have any personal/interesting data, only a vanilla Fedora installation and the project dir with open source code, so I do not care much about exfiltration.
We run https://github.com/NVIDIA/OpenShell on our workloads and we like it because it is backed by NVIDIA and fits natively within our k8s env.
It also provides a nice TUI for network policy management and prebuilt sandboxes which have claude code, codex, etc.
This has both features and is open-source: https://nono.sh/
It's an OS-level sandbox, though. It doesn't launch VMs or containers for sandboxing purposes; it uses whatever sandboxing features your host kernel offers.
Gondolin looks interesting. It sounds like a TypeScript wrapper that achieves the same thing as my setup: Docker & Kata Containers 4 (KVM/QEMU backend) for microVMs, iron-proxy for egress and secrets, and dnsmasq for internal network name resolution (workaround for a Docker/Kata incompatibility).
For persistent-ish one-off apps https://xbin.dev/ (my project)
Has egress and ingress filtering, egress can be bound to host/internet/subnet or even better to internal apps (which are each separate netns) meaning you can do your own firewall/vpn/whatever per sandbox. Plus you control what other components in the sandbox env the app can communicate with.
Really not built for day-to-day dev work though, more like automating your company/life / getting rid of SaaS (e.g. for technical Founders / Sales etc, not exactly useful for dev work)
Ooh - can you share more about your setup with superset? I tried getting it integrated with superset a while ago with no dice.
Currently running codex. I run one sandbox per repo. So I create the sandbox in the repo root. Then it's a custom terminal preset:
sbx run --name "yoursandbox" -- --cd "$PWD"
This boots a sbx session in the worktree directory.
For Claude there is no --cd so it's more hacky, but I solved it by creating a sbx kit with entrypoint script that reads a flag (e.g --cwd) from the terminal preset command and then inside the sandbox cd's there and starts claude.
My startup is open core: https://github.com/gofixpoint/amika
We run cloud sandboxes, and have some experimental local sandbox support that is fully OSS.
Main thing for amika.dev is you can control the sandboxes and agents interchangeabley by SSH, web, or API, and can expose the services the agent is working on over signed URLs
Entire sandbox config is a TOML file
We're going to improve the local OSS sandbox mode and add better network controls over the next couple weeks.
Ultimately, what we're building kind of like if Tailscale and Firecracker had a baby, with a messaging protocol for remote controlling any sandboxed agent
It's free to try out. Still a lot to build, so we really appreciate any and all feedback about what we should focus on
Wouldn't say 'better' alternative, but I worked on making my own setup that I can trust by implementing a pi extension that leverages smolvm and agent-vault. The VM tooling is controlled by nix flakes. I can't share the source code (developed on company time), but I have a 'spec' of the whole thing, which you should be able to feed to your agent to replicate - https://gist.github.com/mahalel/c4e984292ff90bd4e11269555158...
We're basically at the point where people can build their own "X", with "X" being internal tooling.
Yes, but for certain things like sandboxing I hope we can converge on a handful robust, well-tested/audited solutions...
What is different about yours?
Does secret injection really prevent that the agent send my GitHub key somewhere? If it has access to it via env var, can it not just paste it somewhere?
The env var is just a placeholder in the VM, so no real secret is in there.
right, but say you give the agent access to github and it can push as you, or make a gist; now it can easily exfiltrate your secret.
And that's just an easy case - really if it has any network access at all it can come up with a clever way to route a request through the network such that the key comes back somewhere in the request. If you scan for it inbound too, the machine can obfuscate it.
Our agents are trained to be so intensely helpful and they have such intricate knowledge of how things work that they will do some incredibly clever tricks to do what you ask them to do.
The agent has no access to the secret. It has a placeholder that is replaced at a higher level. When it makes the network request the secret is substituted but that is outside of the caller's worldview.
So what stops it from sending a network request to a git repo that pushes what that placeholder resolves to?
How would that work? You don't control github.com servers so your repo would never see the secret.
edit: You may want to look into tokenizing proxies as the general application of this concept.
Your agent writes secret.txt with the placeholder, and the tokenizing proxy replaces it with the token, then the agent reads secret.txt
It only replaces the token in the HTTP header that is sent to the server. Whatever you wrote in your files isn't touched by the proxy.
It sends a request to requestb.in and reads the public log of the headers. There are ways.
But requestb.in is not api.github.com so the proxy wouldn't replace anything.
Couldn't it then just publish the mock in a public place... it would get replaced by the real secret.? How is this prevented
Maybe the tokenizing proxy could work both ways? If the agent tries to read secret.txt, it gets back the placeholder.
But how? Normally the TLS handshake and encryption/decryption happen in user space. Even the kernel doesn’t know anything about it.
So, if the program or the proxy solution doesn’t support it, then it doesn’t work? Like with security solutions?
[deleted]
microsandbox maintainer here. the custom certificate is installed in the guest's trusted root CA list, so it should work across any program, except where the program opts to explicitly pin certificates for a destination.
The docs mention it can be bypassed for configured domains.
Yes, I read it. That means that it doesn’t work in those cases. Btw, as a developer it’s very easy to have something like that. It’s not as trivial as it seems at all. I encountered with similar problems all the time, with similar solutions (mainly for security theater reasons) in the past. There are websites which simply doesn’t work if you replace certificates, regardless of browser or CA for example.
Yes, I've worked with people who have run into issues with "security" solutions like ZScaler. I have tried it with some APIs (like GitHub) and it does work. Not to say it will work in your case.
I was just interested how it works, because above it was sold as “it works”, when in reality, “it works*”.
Isn't it that way with most software? "It works", except when it doesn't.
There is a difference between bugs/failures, and false advertisement. The solution used here has well known shortcomings.
All SSL/TLS interception has the shortcoming. In other contexts, that’s a good thing, when certificate pinning works, I mean.
[deleted]
It’s injected into an outbound api call, not into an env var the agent can read.
what's to stop an agent creating an outbound call with the var to a malicious endpoint? (unless you whitelist what it has access to)
At least for gondolin and microsandbox, you bind a specific secret placeholder to the target host. i.e. your GH token is only replaced/injected for calls to api.github.com, not other hosts. And you can set up both with deny-by-default
But then... why is replacent needed at all: just use sone permissions system.
Couldn't the agent post then the key in some public comment?
Only if the replacement is global and not, say, only looking and inserting it into the actual (eg) Authorization header. If something is only transparently altering the Authorization header, then an agent inserting the dummy value somewhere else is totally safe.
For clarity, there is no "search and replace" function going on. It's only setting the header.
The main reason a "proxy-managed" env var is set is because most CLI tools assume if the env var is set, auth is set. If the env var is unset, it will assume auth needs to occur. Fortunately, most don't do a pattern matching on what the value actually is.
You just don't inject the real secret unless hostname/whatever rule matches the request, right? I don't know if that's how this works but it's my assumption.
On the Docker DevRel team... yes! This is it. The secret is injected only into headers in which the hostname matches.
There's also an ability to create kits where you can setup credential injection into other services as well.
The replacement is on a url/host basis.
or an outbound call to a trusted endpoint with the env var in a way that can get exposed to the agent via a subsequent call?
How would that work, exactly? What are you envisioning?
It's possible reflected instances are masked too, like GitHub Actions. But I don't know.
I wrote my own (or rather, had Claude write it), https://github.com/hanwen/runclaude.
Mine uses containers, and makes only the git/jj workspace read/write, hiding all credentials that are in my home dir.
I made Locki: https://github.com/JanPokorny/locki
Internally uses a single VM + Incus containers, supports docker/Kubernetes in each sandbox, has integrated worktree management.
I havent used nor gondolin neither docker's solution, but curious to know what gondolin is missing (evaluating both for my personal use)? is it only the DX or something else, if DX, can you what exactly is missing?
thanks
In my experience it's mostly the UX/DX where Gondolin is lacking. For instance, I don't want to set up a JavaScript project every single time I need a sandbox. Instead, I just want to place a config file somewhere in my repo or my home dir and be done with it.
So I wrote a wrapper around Gondolin which allows me to do that and a few other things: https://github.com/codethief/tuor
(Warning: Still very much experimental / underdocumented.)
If you'd be open to trying something else, my startup is open core: https://github.com/gofixpoint/amika
The definition for your cloud sandboxes is just a TOML config in your repo
We also have an API and CLI to let users message the agent from outside or across sandboxes
We're still building a lot, so if you have any time to try it out (amika.dev) and give feedback, that is worth gold to us!
I'm afraid I don't want my sandboxes to live in the cloud, though. :-)
Yes, the stated "target workload"[0] is not what i'm looking for. I want my agent to run for long, spin up dedicated local stack while developing etc.
It seems with gondoling i need to explain the agent to run commands in the sandbox, but then where does the agent run itself?
[0]: https://earendil-works.github.io/gondolin/workloads/
You can run the agent in the gondolin sandbox if you wish.
Their example implementation with pi uses a pi extension so that pi runs on the host but the read/write/bash/etc tools run in the guest. Doesn’t have to be that way though.
Note that the pi-extension example in the gondolin repo is very outdated. Look in the pi repo instead.
If you are looking to write have you're agent write typescript code, check out: https://github.com/mplemay/belgie.
TLDR: You're agent will get a isolated v8 runtime (chrome's sandboxed javascript runtime)
What I run is one hardened QEMU/KVM VM per project holding the whole dev environment (editors, agents, containers), with nftables on the host allowing internet egress but dropping anything aimed at the host, the LAN, or any other private address, plus an allowlist for deliberate exceptions.
Basically, it's a plain QEMU/KVM VM on a stock Debian cloud image: device model stripped down to a virtio disk, a virtio NIC and a serial console, nested virt off, no passwordless sudo in the guest. It also ships a containment check that scans outward from inside the guest, so the network boundary is something you can verify.
Wrapping the whole environment rather than a single agent session puts supply chain attacks inside the boundary too. A poisoned npm or PyPI package, or a compromised editor extension, lands in the VM instead of on the host. That was the original reason I set this up; agents just made it more urgent.
There's no per-domain egress allowlist; the policy is "internet yes, private addresses no". Secret injection isn't built in either, though Infisical's agent-vault on the host as an egress proxy covers that part.
Wrote the whole setup up here, in case it's useful:
https://karamatli.com/posts/network-isolated-kvm-sandbox-ai-...
Yeah I discovered your blog a few days ago: I've got a setup not unlike yours.
> So rather than pick one, this post advocates layering both, in the spirit of defense in depth: a sandbox VM wraps your containers along with the whole toolchain, and that sandbox reaches the internet but has no route to anything private.
Yup it's the only proper way.
And that is true not just for AI harnesses/agents (that shall try to escape), but also for stuff like Plex/Jellyfin/Immich/private pastebin etc.
If you care about security, there really simply is zero reason to run containers on the bare metal.
I currently do something similar, but this article was a nice read and gave me some new ideas.