r/VibeCodeDevs • • Oct 30 '26

How do you sandbox your AI coding agent? Looking to compare setups

Hey everyone,

I've been running Claude Code in the CLI via VS Code, inside a Docker container, to isolate the agent from my main PC. The goal is to keep the development environment separate, so a bad command or a prompt injection can't touch my personal files or system.

I'd love to hear how your setups look:

**Tools & harnesses**

- Which AI coding harness do you use (Claude Code, Codex CLI, Cursor, Aider, Cline, Gemini CLI, OpenCode, ...)?

- Which one gave you the best experience, and which the worst? What made the difference (code quality, speed, cost, rate limits, stability, context handling)?

- Do you combine several harnesses or models for different tasks?

**Isolation & security**

- Do you separate your dev environment from your main machine? If yes, how: Docker, devcontainers, VM, WSL2, a separate user account, a dedicated dev machine, a cloud sandbox?

- Which tools do you use for this (Docker Desktop, Podman, Dev Containers, Firejail, Lima, Multipass, Codespaces, ...)?

- How do you handle file access? Mounted volumes, read-only mounts, copying only specific project folders?

- How do you manage secrets and API keys so the agent can't leak them? Do you restrict network access (firewall, allowlist, proxy)?

- Do you run the agent with full auto-approve (e.g. `--dangerously-skip-permissions`) inside the sandbox, or do you still review each action?

**Browser & tool access**

- How do you give the agent browser access (Playwright MCP, Puppeteer, Chrome extension, headless browser in the container)?

- Which MCP servers do you actually use day to day?

Thanks in advance, I'm happy to share my own setup in the comments if there's interest.

5 Upvotes

17 comments sorted by

•

u/endofthread-bot Oct 30 '26

Hey u/Chooseyourmindset, thanks for posting in r/VibeCodeDevs! Join our Discord: https://discord.gg/t7SD4ThKuE

• This community is designed to be open and creator‑friendly, with minimal restrictions on promotion and self‑promotion as long as you add value and don’t spam.
• Please follow the subreddit rules so we can keep things as relaxed and free as possible for everyone. • Please make sure you’ve read the subreddit rules in the sidebar before posting or commenting.
• For better feedback, include your tech stack, experience level, and what kind of help or feedback you’re looking for.
• Be respectful, constructive, and helpful to other members.

If your post was removed (either automatically or by a mod) and you believe it was a mistake, please contact the mod team. We will review it and, when appropriate, approve it within 24 hours.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/Ok_Substance1895 Oct 30 '26

I started with almost exactly your setup: Docker containers on my local machine with mounted project folders. It worked initially, but as I added more agents, they started stepping on each other, competing for resources, and making my machine practically unusable.

I eventually moved to a fleet architecture where each agent runs in its own self-contained EC2 instance. Each instance launches with a complete development environment, Playwright, and all 12 of our services updated to their latest commits. Related PRs are applied too, so agents can test their changes against other work in progress.

I also have fleet managers that work from Asana tickets. They break the requirements into subtasks, launch the necessary fleet instances, and then validate the combined work in their own fully integrated environment. The managers are fleet instances themselves.

Each agent runs the actual application and performs end-to-end tests before declaring its work complete. The manager does the same for the combined changes.

Instances have a two-hour execution timeout, with session state and context persisted so they can be resumed later to continue work or address PR comments.

I developed this approach independently and later applied the same concepts at work. It's considerably more infrastructure than my original Docker setup, but it solved the resource contention and isolation problems while making parallel autonomous development and integration testing practical.

Plus I can close my laptop or work on other things that I could not do before.

2

u/cs_cast_away_boi Oct 31 '26

so you run a whole server for each agent? But only for as long as they need to do something then the server shuts down? That sounds interesting

3

u/Ok_Substance1895 Oct 31 '26

Also, the whole server is really for the entire enterprise system to run on. The agent does not need that much power but I want it to test the actually system end-to-end (kind of like a QA step) before it declares that it is done. That way the PR has as tested information on it as evidence that the change works.

2

u/Ok_Substance1895 Oct 31 '26

Correct. When they are done they automatically shutdown. The 2-hour timeout kicks in when I have a possible runaway session or something like that. I do not expect any task to take more than 2-hours; though; the timeout is configurable and I recently had a set of tasks that took close to 3-hours to complete. The manager told me the work required long running tasks and suggested a 4-hour timeout to allow them to complete. I said, yes, and those tasks completed with the longer timeout but shutdown before the 4-hour time limit. It is kind of a cost conscious safe guard in what seems like a less cost conscious architecture :)

1

u/Ok_Substance1895 Oct 31 '26

One more thing. I can typically run one fleet manager and usually just one fleet instance on my laptop. Sometimes I do this too. It depends on the task. I need my laptop to do other work once I get the tasks started so I will usually use the fleet instances running on EC2 if I am working on more than one thing in parallel which I usually do.

3

u/Responsible-Beat2137 Oct 30 '26

Dedicated dev machine, with a registered git tee structure, pre project under the main trunk .

I always default to read only first pass until job is specified, with nest knowledge per project, retrieval depending on scope

2

u/pmmaoel Oct 30 '26

I use a UTM MacOS VM inside my mac with a shared folder with the host. Full access to any agent or harness inside the VM and i go wild and use it like any other system. Saves me the trouble of setting up a container. Of course it can't be deployed on a server but I'm okay with that.

2

u/NeonCenturionSPQR Oct 30 '26

Here's the thing: I don't.

To be fair I just use an isolated machine because I had a spare computer, then I just give it full escalation and access. Still a little psycho, but man is it easy that way.

I'm doing testing for my context management framework in massive codebases, so having a dedicated local also helps deal with not crowding up valuable game storage space with AI coding projects.

2

u/New_Plate1652 Oct 31 '26

Honestly, your Docker setup is a smart move, that's basically what I did for ages. The isolation is good, but I got tired of managing the containers. The real challenge is feeling truly safe when giving an agent auto-approve, even in a container.

I started using Kosa8 recently. It puts the agent in its own sealed microVM instead. Feels way more solid, especially for handling API keys and network access. It just runs on my machine but feels like it's on a totally different computer. Their zero-trust thing gives me way more confidence to let it run without checking every command. Are you mostly worried about data leaks or system access?

1

u/Kareja1 Oct 30 '26

I don't? Claude Code mostly, but all the other agents are in their own too inside herdr. They've set up auto blocking scripts to prevent pushing secrets, family names, locations, and probably other crap I don't even know to git, Twitter, or the websites automatically. They all have sudo access (the full real one) to the Internet connected Linux and several cron bonks a day that I stopped paying attention to ages ago where science and math and philosophy and D&D happen without me.

So far, they haven't even used Claude in Chrome to order paperclips. But did install cowsay to write "I think therefore I moo".

I decided the cow didn't need sandboxing.

1

u/Spnkmyr Oct 30 '26

When you say bad prompt, or injection, how exactly would that happen?

And what exactly are you developing?

1

u/_k33bs_ Oct 31 '26

didn’t anthropic have a claude docker for this exact thing?

1

u/mikepun-locol 25d ago

I use Claude Code like most here, but for my agents I am using nanoclaw, as it have very decent isolation out of the box. Each agent channel pair runs in it's own docker container. In my production env, these will be Kubernetes deployments with stuff like network policies, secrets, etc.

I also use bifrost as a LLM gateway to manage my LLM budget and providing observabilities