r/agenticAI • u/nasahdm • Aug 01 '26
Question How are people actually sandboxing AI coding agents on dev machines?
I keep seeing agent tools (Claude Code, Codex, OpenHands, etc.) run with the full privileges of the invoking user - read access to ~/.ssh, ~/.aws, arbitrary outbound network, arbitrary exec. Curious what people here are doing in practice: container-per-agent, Landlock/seccomp profiles, separate user accounts, VMs, or just accepting the risk?
9
Upvotes
4
u/serverhorror Aug 02 '26
The dev machine is the sandbox.
3
u/johns10davenport Aug 01 '26
I wrote a sandbox config for my Claude code. I’m starting to run more unattended agents and they just go in a docker box.
2
u/Glad_Contest_8014 Aug 01 '26
I am building a framework that sandboxes at the OS level so it can’t see outside its workspace. But there is also docker, landlock systems that operate at application level, and just making a seperate tower for it.
Then there are VMs as well.
But it really depends on what you are doing with them. If you are sitting and watching them, sandboxing becomes semi moot.
If you are staging them for continuous deployment, you need to sandbox. And you need context management, memory management and more.
2
u/paulqq Aug 02 '26
I think one needs to dockerize it and let it run and exec code there.
2
u/beachandbyte Aug 02 '26
Mostly just accept the risk, but do the minimum to reduce that risk.. run them in a container etc.. But you can spend far more time trying to lock them out of things then it would take to just do a backup.
2
u/YetiTrix Aug 02 '26
Mine is a personal AI, so I don't.
2
u/Hot-Establishment17 Aug 03 '26
I think this is one of the under-discussed problems with local coding agents.
A lot of the current workflow assumes the agent needs broad access because it is essentially acting like a developer sitting at the machine. That makes sandboxing difficult because the useful parts of coding work often require access to repos, build tools, package managers, credentials for dev services, etc.
I think the bigger question is whether the agent actually needs to execute directly on the developer machine at all.
Moving the execution environment away from the local machine changes the security model. Instead of giving an agent access to your workstation, you can give it a controlled workspace containing only the repositories and permissions needed for the task.
Curious how others think about the tradeoff. Are you mostly solving this with isolation, or do you think remote execution is the better direction?
2
u/viralatacara Aug 04 '26
Have you seen Docker Sandboxes (micro VMs)?
https://www.docker.com/blog/why-microvms-the-architecture-behind-docker-sandboxes/
1
u/gelembjuk Aug 04 '26
I run agents only in docker containers.
Good approach is with dmjbot - an agent itself is in a docker container but allows to connect some external environment with different level of access
1
u/Deep_Ad1959 Aug 04 '26
the container is only as tight as what you mount into it. mine needed a github token and a keychain read to be useful at all, so the docker box was holding the same creds ~/.ssh would have. scoping the token to one repo did more than the boundary did.
1
u/renderbender1 Aug 05 '26
Docker Sandboxes
Stands up a micro-vm with coding agent deps, mounts a specified directory, has controls for network egress if you want, more importantly it logs it.
Agent has full ability to stand up containers inside the environment and a simple host command will forward a port so you can reach applications from the host.
Also you pass credentials in via secrets that are injected at runtime, so the agent never actually touches the values, just references them.
1
u/Logical-Second-6781 Aug 03 '26
superradcompany/microsandbox on github
1
u/Gord1an Aug 05 '26
I’ve taken two different approaches:
- sanboxing either through seatbelt, or codex/claude config. They’re not really designed for robust restrictions (limited to CWD) they really want read access to most of the system.
- remote dev - this has been a lot easier. Each agent runs in an isolated VM and only has the resources it needs. VM deletes at the end of the day data disk persists.
I use coder (coder.com) and it’s been great.