Run LLM-generated Python safely from Go with monty-go: a pure-Go WASM wrapper

monty-go: Pure-Go wrapper for Pydantic's Monty Python Interpreter

monty-go is a pure-Go wrapper around Pydantic's Monty Python interpreter, compiled to WebAssembly and run via wazero. It lets Go agents execute LLM-generated Python code safely in a sandboxed WASM instance with sub-millisecond startup, pausing for external function calls handled by Go callbacks. No containers, CGO, or subprocesses. Includes resource limits, print capture, and OS call routing. Designed for code-mode agents, it cuts LLM calls from N to 1, reducing latency and cost.

No containers. No sandbox services. No `exec()`. Just a 2.9MB WASM binary embedded in your Go binary.
  1. camdenclark

    Funny -- I just built a pure go wrapper myself because this one is super out of date!

    https://github.com/CamdenClark/monty-go

    It implements the new subprocess model for spawning Monty VMs that help keep your main thread isolated if one of the VMs crashes.

    Because Monty is packaged as a binary now, you don't need to do the WASM embedding stuff, you just need to make sure you have the binary. (Similar to how you would run playwright in Go, for example)

  2. mkl

    Monty itself seems much more interesting than a Go wrapper for a WASM runtime running the Rust implementation that runs the Python code. There was a big discussion about it 6 months ago: https://news.ycombinator.com/item?id=46918254

  3. digdugdirk

    Is this Python in Rust in WASM in Go?

    The Monty name was a perfect choice, Yakety Sax was playing in the distance as I read through the readme.

    Jokes aside, I do love seeing WASM as a bridge to enable cool stuff like this.

More from this day

2026-08-30