Edge Python a 170 KB sandboxed Python subset (WASM) for running agent-generated code client-side (directly in the browser)
Sandboxing Python for LLM/agent-generated code is usually done with containers, microVMs, or server-side WASM runtimes.
I wanted something that runs in the browser tab itself: no server, no round-trip, no host process. So I spend few months writing a bytecode compiler + stack VM in Rust that ships as a standalone 170 KB WASM.
The demo is a Rosenblatt perceptron training on an OR gate entirely in the browser. Language surface covers classes, async/await, pattern matching, decorators, generators, f-strings... enough for non-trivial agent code.
A bit of the design:
- Sandboxed by construction; per-VM caps on heap, ops, call depth.
- Native modules ship as separate .wasm via a sealed plugin ABI (handle-based, language-agnostic).
- Optional SHA-256 integrity on URL imports; content-addressed cache with drift detection.
- No stdlib by design, host explicitly grants every capability the script can touch.
Happy to discuss :). Links in the comments.