Simon Willison's MicroPython/WASM Sandboxed Code Execution for AI Agents · history
Version 4
2026-06-13 02:09 UTC · 45 items
What
Simon Willison has released a suite of alpha packages for AI agent tooling in Datasette built around two complementary safety strategies: MicroPython-in-WASM sandboxing for code execution, and human-in-the-loop interruption for consequential agent actions. [1][3] As of June 10, datasette-agent 0.2a0 adds tools that can pause mid-execution to ask users questions (yes/no, multiple-choice, or free-text), with suspended conversations persisting across server restarts; a new save_query tool requires explicit human approval before writing anything. [6] External commentary endorses sandboxed execution as sound infrastructure design, though no independent security analysis has appeared.
Why it matters
Willison's framework shows that agent safety in practice is layered: sandboxing limits what code can do, while human-in-the-loop interruption limits what the agent can decide on its own. Both mechanisms are now shipping as pip-installable plugins, giving other developers a concrete reference implementation rather than a design document.
Open questions
Will the MicroPython/WASM sandbox hold under sustained adversarial prompting beyond the initial GPT-5.5 tests? [3]
How does the ask_user() interruption pattern scale when agents run many sequential operations — does it become friction-heavy in practice? [6]
Will companies with dedicated security teams adopt and open source hardened Python-in-WASM implementations, 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?
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 in detail. [4] He chose MicroPython over Pyodide because Pyodide cannot run server-side as of late 2024. 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. 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 datasette-agent-edit 0.1a0, implementing 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. [5] On June 10, datasette-agent 0.2a0 extended the safety model in a different direction: human-in-the-loop interruption. Tools that declare a context parameter now receive a ToolContext object and can call await context.ask_user(...) to pause mid-execution and ask the user a yes/no, multiple-choice, or free-text question. Suspended conversations persist to the internal database and survive server restarts, with stored answers replayed on re-execution. A new save_query tool demonstrates the pattern in practice: the agent shows the full SQL plus proposed metadata, and nothing is written until the user approves. [6]
External commentary is limited but consistent in direction. Qiang Han endorsed sandboxed execution as 'the right instinct — don't trust the agent's edit, gate it.' [7] Mykyta Pavlenko offered a structural framing — 'the sandbox is the product once agents can run code' — while separately noting 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. [7][11]
- 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]
- 2026-06-10: datasette-agent 0.2a0 released: tools can pause mid-execution via ask_user() to request human input; suspended conversations persist across restarts; save_query tool requires explicit approval before writing. [6]
Perspectives
Simon Willison
Cautiously optimistic: frames the project as demonstrating that Python-in-WASM sandboxing is viable, while being explicit about alpha status. Expanding agent safety in two directions — sandboxed execution and human-in-the-loop interruption — with each released as a reusable pip-installable plugin.
Evolution: Scope has widened with each release; the 0.2a0 datasette-agent release shows a shift from pure sandboxing toward a layered safety model that also gates consequential actions on human approval.
Qiang Han (@QiangHan20)
Endorses sandboxed execution as 'the right instinct,' framing it as a security principle: don't trust agent output, gate it through a sandbox.
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: Consistent; 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 while implicitly acknowledging sandbox survival under real adversarial conditions remains unproven.
Evolution: Consistent; 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] datasette-agent 0.2a0 — Simon Willison (2026-06-10)
- [7] 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)
- [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)
- [11] 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)