// HACKER NEWS — CYBERSECURITY
monty-go: Pure-Go wrapper for Pydantic's Monty Python Interpreter
Run LLM-generated Python safely from Go — no containers, no CGO, no subprocess.
A pure-Go wrapper around Pydantic's Monty Python interpreter, compiled to WebAssembly and loaded via wazero. Your Go agent writes Python code, monty-go executes it in a sandboxed WASM instance with sub-millisecond startup, and pauses whenever the code calls an external function so your Go code can handle it.
LLMs work faster, cheaper, and more reliably when they write code instead of making sequential tool calls. Instead of:
One model call instead of three. The Python code calls your Go functions, Monty pauses at each call, your Go code executes it, and Monty resumes. No containers. No sandbox services. No exec(). Just a 2.9MB WASM binary embedded in your Go binary.
The real power is external function calls. Monty pauses execution whenever Python code calls a function you've declared, your Go callback handles it, and Monty resumes with the return value:
Multiple functions work the same way — register them all and dispatch by name:
Prevent runaway code with memory, time, allocation, and recursion limits:
Infinite loops, memory bombs, and deep recursion all terminate cleanly with a *MontyError. Go's context.Context deadlines are also respected — cancel the context and the WASM instance stops.
Python filesystem and environment access routes through your Go callback:
No filesystem access happens unless your callback allows it.