Simon Willison's MicroPython/WASM Sandboxed Code Execution for AI Agents · history
Version 3
2026-06-08 08:23 UTC · 40 items
What
Simon Willison has released a suite of alpha packages for AI agent tooling in Datasette: micropython-wasm (a WASM-sandboxed MicroPython runtime), datasette-agent-micropython (routing agent code execution through the sandbox), and datasette-agent-edit (implementing Claude's text editor pattern as a reusable plugin layer). [1][3][5] His June 6 technical post explains the design rationale in detail. [4] External commentary is limited but consistent: observers frame sandboxed execution as the correct instinct for AI agents, and at least one voice argues the sandbox itself will become the core product once agents routinely execute code. [6][8]
Why it matters
As AI agents that execute code become more common, reliable sandboxing is a prerequisite for safe deployment. Willison's approach stacks two containment layers — MicroPython's restricted Python subset and WebAssembly's memory isolation — and ships both as pip-installable libraries. His stated aim is to show the approach is viable enough that companies with professional security teams will commit to it and open source their own hardened implementations. [4]
Open questions
Will the sandbox hold under sustained adversarial prompting beyond the initial GPT-5.5 tests? [3]
Will companies with dedicated security teams adopt and open source Python-in-WASM solutions, as Willison hopes? [4]
What are the practical limits of MicroPython versus full CPython for AI-generated code — which standard library features or syntax are unavailable?
Will sandboxed execution become a standalone product category, as Pavlenko's 'the sandbox is the product' framing suggests? [8]
Narrative
Simon Willison released three alpha packages on June 2, 2026, aimed at sandboxed Python execution for AI agents in the Datasette ecosystem. The core package, micropython-wasm, bundles a customized WebAssembly build of MicroPython and runs it through Python's wasmtime bindings. A same-day bug-fix release (0.1a1) followed. The companion plugin, datasette-agent-micropython, integrates the sandbox into Datasette Agent — Willison's LLM-powered assistant for the Datasette data exploration tool — routing code-execution requests through the MicroPython/WASM sandbox instead of running them natively. [1][2][3]
Willison's June 6 technical post explains the design decisions. [4] He chose MicroPython over Pyodide because Pyodide cannot run server-side as of late 2024, making MicroPython the most practical Python-in-WASM option for embedded server applications. For persistent interpreter state across multiple agent turns, he routes execution through a MicroPython instance running in a background thread that blocks on a host-side queue. He favored WASM over V8-in-Python alternatives based on WebAssembly's browser security track record and the availability of active wasmtime Python bindings. AI coding agents — specifically Codex Desktop and GPT-5.5 — wrote the core implementation, including 78 lines of C bridging host functions into WASM. Willison is candid about the project's experimental state and acknowledges the irony of adding another immature sandboxing library to an ecosystem he has criticized for that same quality.
On June 7, Willison released a further plugin, datasette-agent-edit, expanding the agent tooling layer in a different direction. [5] Rather than sandboxed execution, this plugin implements Claude's text editor design — with view, str_replace, and insert tools — as a reusable base so that other Datasette plugins requiring agentic text editing do not need to recreate the pattern independently. Willison frames agentic editing as non-trivial to implement correctly and cites Claude's text editor as his preferred published pattern for the task.
External commentary is limited but consistent in direction. Qiang Han endorsed the sandboxed execution design as 'the right instinct — don't trust the agent's edit, gate it,' referencing a related project called Glyph 0.3.0. [6][7] Mykyta Pavlenko offered a more structural framing: 'The sandbox is the product once agents can run code,' paired with a separate note that he does not want agents with more autonomy yet. [8][9] Landon Huber noted that GPT-5.5 has not yet escaped the sandbox, calling it promising if cautionary. [10] No independent security analysis or third-party adversarial testing has entered the public record.
Timeline
- 2026-06-02: micropython-wasm 0.1a0 released: a WASM build of MicroPython wrapped with wasmtime for sandboxed Python execution. [1]
- 2026-06-02: micropython-wasm 0.1a1 released: bug fixes uncovered while building the Datasette Agent integration. [2]
- 2026-06-02: datasette-agent-micropython 0.1a0 released: plugin routes Datasette Agent's code execution into the MicroPython/WASM sandbox; GPT-5.5 has not yet escaped. [3]
- 2026-06-05: Qiang Han endorses sandboxed execution as 'the right instinct' and references a related project Glyph 0.3.0. [6][7]
- 2026-06-06: Willison publishes full technical post: explains Pyodide's server-side limitation, persistent state via thread/queue, and that AI agents wrote 78 lines of C bridging code. [4]
- 2026-06-06: Mykyta Pavlenko argues 'the sandbox is the product once agents can run code' and separately states he does not want agents with more autonomy yet. [8][9]
- 2026-06-07: datasette-agent-edit 0.1a0 released: implements Claude's text editor pattern (view, str_replace, insert) as a reusable base layer for agentic editing across Datasette plugins. [5]
Perspectives
Simon Willison
Cautiously optimistic: frames the project as a personal experiment demonstrating Python-in-WASM is viable, while being explicit about alpha status and self-aware about adding another immature sandboxing library to the ecosystem. Hopes professional security teams will build on and open source hardened versions. Separately building out a broader agent editing layer for Datasette.
Evolution: Expanded from brief release notes to a detailed technical post with explicit design rationale; stance is consistent, scope has widened with the datasette-agent-edit release.
Qiang Han (@QiangHan20)
Endorses the sandboxed execution approach as 'the right instinct,' framing it as a security principle: don't trust agent output, gate it through a sandbox. References Glyph 0.3.0 as a related project.
Evolution: Consistent; first and only appearance.
Mykyta Pavlenko (@mktpavlenko)
Frames sandboxing as infrastructure-level necessity ('the sandbox is the product once agents can run code') while expressing personal reluctance to grant agents more autonomy in the near term.
Evolution: First appearance; adds a structural product framing absent from other commentators.
Landon Huber (@LandonDHuber)
Cautiously positive: notes GPT-5.5 has not escaped the sandbox, calling it promising but implicitly acknowledging that sandbox survival under real adversarial conditions remains unproven.
Evolution: First appearance; amplifier role.
Sources
- [1] micropython-wasm 0.1a0 — Simon Willison (2026-06-02)
- [2] micropython-wasm 0.1a1 — Simon Willison (2026-06-02)
- [3] datasette-agent-micropython 0.1a0 — Simon Willison (2026-06-02)
- [4] Running Python code in a sandbox with MicroPython and WASM — Simon Willison (2026-06-06)
- [5] datasette-agent-edit 0.1a0 — Simon Willison (2026-06-07)
- [6] RT @QiangHan20: Sandboxed MicroPython for Datasette Agent is the right instinct — don't trust the agent's edit, gate it.... — reactive:simon-willison-wasm-sandbox (2026-06-05)
- [7] Sandboxed MicroPython for Datasette Agent is the right instinct — don't trust the agent's edit, gate it. Glyph 0.3.0's g... — reactive:simon-willison-wasm-sandbox (2026-06-05)
- [8] The sandbox is the product once agents can run code. — reactive:simon-willison-wasm-sandbox (2026-06-06)
- [9] I don't want agents with more autonomy yet. — reactive:simon-willison-wasm-sandbox (2026-06-06)
- [10] Datasette Agent can now spin up MicroPython code in a sandbox and GPT‑5.5 still hasn't escaped – that's promising, thou... — reactive:simon-willison-wasm-sandbox (2026-06-06)