Running Pydantic's Monty Rust sandboxed Python subset in WebAssembly
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
Developers running LLM-generated Python can now sandbox it in microseconds via Pydantic's Monty, compiled to WebAssembly to run in browsers.
Simon Willison tried Pydantic's new tool called Monty, a small version of the Python programming language built for safely running code written by AI assistants. Normally this needs a slow virtual container; Monty starts in microseconds and blocks access to files and the network. It does not even support class definitions yet. Willison used an AI tool, Claude Code, to compile it into WebAssembly so it runs in a web browser.
Pydantic released Monty, a sandboxed Python subset in Rust for executing AI-generated code without container overhead, with startup in single-digit microseconds versus hundreds of milliseconds. Willison demonstrated it compiled to WebAssembly in two forms, with working browser demos. Teams building coding agents gain a fast, small alternative to container sandboxes; it is early, version 0.0.3, and lacks features like class declarations.
Monty is a Rust implementation of a Python subset from Pydantic, shipped as both a Rust library and Python package (pydantic-monty, tested at 0.0.3), blocking filesystem, environment and network access except via developer-controlled external calls. Willison compiled it to WebAssembly as a standalone .wasm bundle callable from JavaScript and as a CPython 3.13/emscripten wheel loadable in Pyodide, with two GitHub Pages demos. Execution was measured at 4.0ms in the browser. Class declarations are unsupported; agents are expected to adapt from error messages.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Monty Pydantic WebAssembly Pyodide Claude Code Simon Willison
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.