A Python interpreter so small it fits inside your LLM's ego
Pydantic's Monty runs agent-generated Python in single-digit microseconds without a container in sight.

What it does
Monty is a Rust-built Python interpreter designed for one increasingly common headache: safely executing code that an LLM just hallucinated into your chat window. It starts up in under a microsecond and runs without any dependency on CPython, containers, or sandboxes. The host filesystem, network, and environment variables are completely unreachable unless you explicitly wire them in as external function calls.
The interesting bit
The killer feature isn’t speed—it’s pausability. Monty can snapshot its entire interpreter state to bytes whenever it hits an external function call, then resume later, potentially in a different process or after a database round-trip. That makes it practical to let an agent write a multi-step Python script that calls your tools, without keeping a live process around between steps.
Key highlights
- Startup time is sub-microsecond; runtime performance is roughly in CPython’s ballpark (±5×, per the README’s own estimate)
- Ships with
tyfor modern Python typechecking in a single binary - Resource limits are first-class: memory, allocations, stack depth, and execution time can all be capped
- Bindings exist for Python, Rust, JavaScript, plus community bindings for Go and Dart/Flutter
- Will soon power
codemodein Pydantic AI, following the pattern Anthropic and Cloudflare have been advocating
Caveats
- Explicitly experimental and “not ready for the prime time”
- No classes, no match statements, no third-party libraries, and only a thin slice of the standard library (
sys,os,typing,asyncio,re,datetime,json,dataclasses“soon”) - The authors are upfront that this is intentionally limited: if your use case isn’t “run code written by agents,” you’re holding it wrong
Verdict
Worth watching if you’re building agent frameworks and tired of Docker’s cold-start tax. Not a replacement for CPython, Pyodide, or WASM for general workloads—this is a specialized tool for a specialized job, and it knows it.
Frequently asked
- What is pydantic/monty?
- Pydantic's Monty runs agent-generated Python in single-digit microseconds without a container in sight.
- Is monty open source?
- Yes — pydantic/monty is open source, released under the MIT license.
- What language is monty written in?
- pydantic/monty is primarily written in Rust.
- How popular is monty?
- pydantic/monty has 7.9k stars on GitHub and is currently holding steady.
- Where can I find monty?
- pydantic/monty is on GitHub at https://github.com/pydantic/monty.