Monty is a Python interpreter written from scratch in Rust, purpose-built to safely execute LLM-generated code in agentic workflows. Unlike CPython or container-based sandboxes, Monty starts in microseconds (6µs cold), is completely sandboxed by design with no file/network/system access unless explicitly permitted by the host, and can serialize its entire interpreter state to a database for durable long-running workflows. Samuel Colvin, creator of Pydantic (10B downloads), built Monty largely with AI assistance. Key design choices include deliberate language incompleteness (no classes, no third-party packages), a suspend-and-resume model for tool calls, integration with Ruff's AST parser and the ty type checker, PGO builds for up to 50% performance gains, and WebAssembly support. The primary use case is 'code mode' — having LLMs write short Python programs that batch multiple tool calls, reducing agent costs from ~$2 to 4 cents per task. Monty also has broader applications for safe user-provided scripting wherever eval() is too risky and a full sandbox is too complex.
Sort: