Live data from Hacker News

Running Python code in a sandbox with MicroPython and WASM

simonwillison.net

21–30 of 46 posts

Re: Running Python code in a sandbox with MicroPython and WASM

#21
We are working to solve the "sandoxing in Wasm" problem across multiple runtimes.

https://labs.leaningtech.com/blog/browserpod-deep-dive

Node.js is now fully supported, Python is in preview and Rust is coming soon.

For a glimpse of the possibilities, check our Claude Code running fully in the browser: https://browsercode.io/claude

Re: Running Python code in a sandbox with MicroPython and WASM

#23
Literally working on a product that does this, hah :) I really do think that AI + automation + carefully-designed guardrails will unleash a deluge of productivity for normies, and we've barely scratched the surface.

The state of AI apps is absolutely trash right now, it’s embarrassing that these companies that raised millions are releasing the shittiest slop around without any product ethos. Obviously we're seeing what sticks, but come on guys.

I'm using Brett Cannon's `https://github.com/brettcannon/cpython-wasi-build` running inside a WASI rust container with a carefully-designed host SDK (e.g. sandboxed Chromium access, diff, sandboxed filesystem, pandas subset, PDF reading, etc.). Essentially the AI sees a goal, a plan, and essentially treats the "task space" as a WASI-powered Python notebook.

Mainly focused on the user experience, and I think that local LLMs (secure/private) + standard Python + host functions + (some external stuff like screen reading & quarantined web access) is more than enough for 90% of actionable tasks.

Very exciting times ahead.

Re: Running Python code in a sandbox with MicroPython and WASM

#25
post #14

What’s your experience with Monty? Been looking at it for one of our environments and it seems very promising.

I've tried it out a bit - it does look solid and it has a good team behind it. It's a subset of Python though (much more so than MicroPython), which is fine for LLMs since they can easily work around any limitations but does mean you can't use a lot of existing Python code with it. I hope they implement classes soon! I'm also a little bit nervous about the safety. It's a fresh implementation in Rust, which means plen…

Any thoughts on https://github.com/dylan-sutton-chavez/edge-python or http://edgepython.com/ ?

Re: Running Python code in a sandbox with MicroPython and WASM

#26
On linux I devised this strategy for letting llm webuis or coding agent to securely run programs by burying their environment under multiple layers of locally arranged sandboxing.

Basically: run as another user -> run inside firejail sandbox -> run inside a stripped down alpine linux vm with smolvm.

See the whole procedure here: https://www.reddit.com/r/LocalLLaMA/comments/1tm93ng/how_i_d...

P.S. directories can be easily shared between the sandboxed guest and the host os

P.P.S. to stay a bit more on the safe side I also changed the name of the package manager for the guest os to something else so that when a coding agent would try to autonomously install external packages it will fail. I've then instructed it to (politely) ask for whatever it needs to be eventually manually installed by me

Re: Running Python code in a sandbox with MicroPython and WASM

#27
post #14

Earlier quoted context omitted.

I've tried it out a bit - it does look solid and it has a good team behind it. It's a subset of Python though (much more so than MicroPython), which is fine for LLMs since they can easily work around any limitations but does mean you can't use a lot of existing Python code with it. I hope they implement classes soon! I'm also a little bit nervous about the safety. It's a fresh implementation in Rust, which means plen…

Any thoughts on https://github.com/dylan-sutton-chavez/edge-python or http://edgepython.com/ ?

Ok that looks promising! I like that it's built for WASM, and the docs mention wasmtime here: https://edgepython.com/getting-started/what-it-is
Post reply on HN