Edge Python a 170 KB sandboxed Python subset (WASM) for running agent-generated code client-side (directly in the browser)

Reddit r/ArtificialInteligence Tools

Summary

Edge Python is a 170 KB WASM-based sandboxed Python subset that runs agent-generated code directly in the browser without a server, supporting classes, async/await, pattern matching, and more.

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. Demo: https://demo.edgepython.com Repo: https://github.com/dylan-sutton-chavez/edge-python Happy to discuss :).
Original Article

Similar Articles

Running Python code in a sandbox with MicroPython and WASM

Simon Willison's Blog

Simon Willison introduces micropython-wasm, an alpha package that runs Python code in a sandbox using MicroPython compiled to WebAssembly, enabling safe plugin execution within Python applications like Datasette.

micropython-wasm 0.1a2

Simon Willison's Blog

MicroPython ported to WebAssembly as a tool for sandboxed Python execution in the browser.

agentOS

Product Hunt

agentOS is a 254× cheaper sandbox alternative powered by WebAssembly, designed for secure code execution.