r/PiCodingAgent • u/cade-v • Oct 28 '26
Question How do y'all sandbox Pi?
I use a minimal Pi setup for building hobby projects and some light data analysis for work. I initially used NVIDIA's OpenShell in its early days before v0.1.0 but switched to Docker sandboxes since I find them quicker to manage for my use cases. However I've had some issues with installing and accessing Pi extensions with them.
What's your experience with sandboxing tools? Any recommendations for creating secure, reproducible environments? Thanks!
62
Upvotes
7
u/pilibitti Oct 28 '26
which os?
4
u/wooptoo Oct 28 '26
I wrote a basic tutorial a while ago - Sandboxing Pi: Bubblewrap vs Podman https://wooptoo.com/blog/pi-sandbox-bubblewrap-podman/
It's more Linux centric to be honest, I've heard that MacOS folks use different tools: https://www.reddit.com/r/PiCodingAgent/s/bwhP8lih2F
25
u/fakeclown Oct 28 '26
I am using Docker Sandboxes. What's the issue with accessing Pi extensions? I use them fine. Probably you just need to add npm and github to the sandbox's network allowlist.
33
u/wildjokers Oct 29 '26
I don't. YOLO.
9
u/DimmedSharpness 29d ago
https://nono.sh/ I've been using this for a bit, but I'm still on the lookout for a better alternative
16
u/frolgath Oct 29 '26
Don’t fuck around with sandboxes, permission extensions, etc. Whitelists are always too narrow and so will annoy you or too broad and so will be unsafe. Just run it in a VM. Virt-Manager is free, easy to setup and has great performance. Inside the VM you can give it root access and let it install whatever tools it wants. Never copy any credentials or data you wouldn’t want made public into the VM. Always check the results you copy out of the VM. Worst that can happen if it goes rogue or gets prompt injected is that you need to recreate the VM. Recreate it every session if you want to be sure.
4
u/Effective_Silver4857 Oct 28 '26
akitaonrails/ai-jail
4
u/InnerToe9570 Oct 29 '26
docker sandboxes (sbx). That way secrets can be kept out of reach for the agent.
6
u/jonas-reddit Oct 29 '26
Docker sandbox (sbx) using a custom container with pi and my dev tools, compilers, etc.
https://docs.docker.com/ai/sandboxes/agents/
With lots of examples on how to make it support pi below.
https://github.com/docker/sandbox-kit-spec/tree/main/examples
13
u/ECrispy Oct 29 '26
this is funny, because the original intention and talks by Mario all focused on yolo mode and how guardrails aren't needed.
3
u/one-man-circlejerk Oct 29 '26
I just let it raw dog my machine
3
u/Opening_External_625 Oct 29 '26
sbx with a basic kit
2
u/MaineTim Oct 28 '26
Gondolin extension works well for me.
https://pi.dev/docs/latest/containerization#route-tools-through-gondolin
2
u/ptgamr Oct 29 '26
https://ptgamr.substack.com/p/a-pi-setup-with-permission-sandbox?r=1njvx6&utm_campaign=post-expanded-share&utm_medium=post%20viewer
I do it with a combination of 3 extensions:
- `@gotgenes/pi-permission-system
- `@erichll/pi-auto-review`
- `@erichll/pi-sandbox`
pi-permission system define the list of locations it can access
pi-sandbox run every cmd in a sandbox, with ability to allow certain prefixes cmd to run outside of the sandbox
pi-auto-review for getting another agent to review the toolcall
2
u/xRebellion_ Oct 29 '26
I built a custom sandbox on top of https://github.com/earendil-works/gondolin . That and also a custom permission gate system as a second layer.
2
u/betiz0 Oct 29 '26
Podman
2
u/_RemyLeBeau_ Oct 29 '26
Docker Sandbox for reasons.
https://www.reddit.com/r/PiCodingAgent/comments/1xi3nqb/comment/19rt75dvzpnz9/
2
u/Bomb-OG-Kush Oct 29 '26
I just let it ride
2
u/funk443 Oct 29 '26
separate user
2
u/davblaster Oct 29 '26
I wrote it up here: https://doctrine.engineering/articles/more-convenient-straitjackets/
My pi-for-other-orchestrators runner here is built around the same ideas: https://github.com/davidlee/quotient
4
u/HectaMan Oct 28 '26
I work at Cosmonic, and we are currently rolling this out now - it will be in the next release of Cosmonic Desktop and supported on Kubernetes with Cosmonic Control. Desktop is free; it's like Docker but for fine-grained Wasm sandboxes.
Underneath the hood, we build CNCF wasmCloud, where we support the common policy enforcement points (file, network, config, secrets, etc).
The why here is that we give you the ability to:
What you would sandbox: defined agentic loops, apps, cron, triggers, etc
What's not a good fit: general wide-ranging coding agents
There are some amazing advantages to this architecture, chiefly density and security.
Excuse the marketecture, but that's what I am working on atm for a blogpost. Will be linking resources here shortly.
2
u/ekool Oct 28 '26
I haven't used this but it's been on my list to check out: https://github.com/superradcompany/microsandbox
2
u/Critical-Rule9649 29d ago
Bubblewrap
1
u/Murky-Abalone-9090 Oct 28 '26
Nvidia openshell + custom bash wrapper for manage all openshell flags and driverconfig and other providers and …
1
u/geek_404 Oct 29 '26
I am building a container based system for my team that let's them pick an agent and then it layers on Nono on top so we have container segmentation and nono layers it rules and runtime protection as well. I also pre-populate the skills and such that we default too. If you are interested DM me and I'll send you the repo. https://github.com/nolabs-ai/nono
1
u/pArbo Oct 29 '26
nix sandboxes
1
u/TrickyPlastic Oct 29 '26
pi-landstrip
1
u/3p0h0p3 Oct 29 '26
https://github.com/Sapient-Lumen/W4R3Z/blob/main/Maintained%20Tools/sandpi
1
u/Warhouse512 Oct 29 '26
https://www.agent-of-empires.com
this has been amazing for me
1
u/lazyfai Oct 29 '26
Saw many users used VM, docker or whatever isolation but give the agent all keys 🤣
1
u/iportnov Oct 29 '26
pi install npm:pi-sandbox.
1
u/madddi2011 Oct 29 '26
I've built https://github.com/go-corral/corral
It's essentially bwrap on Linux / seatbelt on macOS and providers that create throwaway tokens for system access so your agent can work with them without having all your permissions and tokens.
1
u/schmurfy2 Oct 29 '26
I use https://github.com/bindsch/scode on osx which wraps the native sandbox tool on os x 1nd bubblewrap on linux.
It block access to my credentials and sensitive files.
I am investigating running it in microvm with tart
1
u/Glum-Drop-5724 29d ago
I am on windows. Run my agent in wsl+bubblewrap. Give it read access to everything, but write access to only Development folder. Its become a mess however with files scattered everywhere.
1
u/radim11 29d ago edited 29d ago
We ended up using custom Docker based containers as the default for coding agents too. The part that made it feel safer was not just putting the agent in a container, but cutting off its direct network access.
The container can only talk to a local proxy. The proxy has an allowlist for destinations and can inject a credential for an approved request, so the agent never gets the raw token in its environment. Repo gets mounted in, but not the home directory or random host credentials.
Docker has been the more reproducible option for us. Native sandboxing can be lighter, but it is easier to accidentally inherit too much from the host.
The extension issue sounds like it may just be the network allowlist. npm, GitHub, and any registry the extension fetches from all need to be reachable. What breaks when Pi tries to install or load one?
Context, we are building https://stashbase.dev
1
u/brotlos_gluecklich 29d ago
Does anyone know a good write for using Docker Sandbox (sbx) with pi? Like how I can sync my global pi settings, extensions, skills into it, together with my project repo, control network access, manage credentials and such?
1
u/nez_har 29d ago
https://github.com/VibePod/vibepod-cli supports Pi and you can run it via Docker or Podman, use custom providers, profiles and restrict network access
1
u/pragmojo 29d ago
I'm using nix agent sandbox: https://github.com/archie-judd/agent-sandbox.nix
1
u/AdorableBreadfruit51 29d ago
It does keep everything isolated in Docker, but it’s annoying because I had to feed it files, directories, config, etc. manually. I had a shared folder mounted in the container, but the container ran as root, so every time I copied something out, I had to manually overwrite the permissions. In the end I deleted the whole setup.
Now I have no guardrails, which isn’t ideal and is actually dangerous. It wrecked my phone when I gave it su privileges. I eventually fixed it, but it was a great learning moment and I'm more careful now with my prompts.
1
u/-rcgomeza- 29d ago
VM with non sudo user
1
u/jinnyjuice 29d ago
Any simple & free solutions for Windows? So hard to find stuff outside of Linux
1
u/juanluisback 29d ago
Shameless self-plug, I published a video recently on how to sandbox Pi using Canonical Workshop (LXD containers) https://youtu.be/u5Q149jlMQ8?si=gp_vhtviHwzQKbGH
1
u/e3e6 29d ago
I don't
1
u/lmpdev 29d ago
I made this https://github.com/perk11/pipod
It has been working reasonably well. I also create a global instruction file to explain to the agents what's going on and that they can install any packages they need (although it was working without it too).
1
u/LaserKittenz 29d ago
Docker/kubernetes seems like the best option imo
1
u/Flaky-Eggplant-3479 29d ago
I make a lot of little pi agents with the sdk and generally just deploy inside a fully featured firecracker vm and give the harness root access
1
u/TechnoCat 29d ago
I use
bwraphttps://codeberg.org/dannyfritz/dotfiles/src/commit/f664a928974114b6c817c857f3e67d1a8c82b556/bin/pise1
u/UpbeatBass6066 29d ago
I think I am moving toward real VMs for each project. I've tried Bubblewrap but being careful about not giving too much permission in tools that I use is tedious. VM boundaries are much simpler and I just install tools in the VM. And I can put the VM on a server cleanly and develop using a terminal via ssh.
1
u/ColonelKlanka 28d ago
have a look at the free nono sandbox cli. it sandboxes the pi agent (or any other agent)
1
u/Maleficent-Ad876 28d ago
Checkout smolvm! Falls right into place
1
u/Express_Quail_1493 27d ago
Nope. Sandbox is the Ai cond0m. I like to live on the edge 😀. LOL but my qwen3.8-27b never does anything crazy though so maybe im hoping for adrenaline from disaster that will never come🥲. Anyway.. living on the edge baby Rawdog🤘
1
u/New_Plate1652 27d ago
Docker's great for speed but those permission issues with extensions are super common. Honestly, the core problem isn't the container tool, it's getting true isolation without breaking your dev flow.
I've been testing kosa8 for my agent projects. Runs each agent in its own microVM so it's totally sealed. It's way better for the sensitive data I sometimes handle. The instant rollback is a lifesaver when things go wrong. Plus, it works right alongside my existing Docker setup.
What's the main thing driving your sandboxing need? Is it more about security for work data, or just keeping hobby projects tidy?
1
u/jodosha 26d ago
I’m building my own (no vibecoding) based on libkrun VMs, Seatbelt (MacOS), Landlock (Linux). Plus other security features (egress, permissions, etc…).
1
u/No_Caterpillar_5428 20d ago
Docker sandboxes make sense for cross-platform work. For macOS, I built Agent Guard as a lighter-weight option using the native Seatbelt sandbox.
With Pi, it limits writes by Pi and its child processes to the launched project and permitted runtime/cache/temp locations, without requiring a container. It also supports OpenCode, OMP, and Grok CLI.
It requires macOS 15+. It isn’t equivalent to a VM: network access remains unrestricted, and files inside writable locations can still be deleted.
Which extensions were giving you trouble?
https://github.com/ebrindley/AgentGuard
1
u/First_Inspection_478 Oct 28 '26
smol-machines/smolvm as a git worktree hook
1
u/psychobarge Oct 28 '26
I built a custom sandbox solution with docker containers and a proxy for api keys i have a mac and a windows version https://github.com/psychobarge/pi-sandbox
1
u/deepit6431 Oct 29 '26
I like pi because it has no permissions and doesn't stop me from doing things. I don't.
1
u/mission_tiefsee 29d ago
This is my solution to this problem. I re-use bubblewrap with a shell wrapper. The thing looks a bit complicted and i need to reword the github readme, but if you are interested just point an agent there and let it read it. Its pure shell (+bubblewrap).
Supports ssh keys per folder, ro, rw mounts of other folder. I use it every day. https://github.com/zweifuchs/limen
0
u/dev_zero Oct 28 '26
I use microsandbox and really like it