mrkeyoor.com_
Thu 24 Sept 17:22 UTC
AI Toolsevaluationupdated 24 Sept 2026

monty review

Monty is a small Python 3.14 interpreter written in Rust for running code generated by AI. It gives that code no filesystem, environment, network, subprocess, or native-extension access unless the host application supplies a narrow callback or mount.

Verdict

Our Monty install took 28 seconds and 37 MB, but the build exited 1 after 6 seconds and the log tail did not reveal why, so source builders should reproduce that step before adoption. The packaged interpreter is a strong fit for agents that need a small, deliberately limited Python 3.14 language sandbox and only a few audited host calls. Use an OS-isolated alternative when generated code needs third-party packages or when your threat model requires a kernel boundary.

We ran it

Lab card: what happened when we ran montyScreenshot of monty (pydantic.dev/docs/monty)
Install✓ · 28s34 packages · 37 MB
Build✗ · 6s
Testsn/ano test script
Known vulns0(pip-audit)
Repo1374 files~289,541 lines of source · 13.3 MB · 3 CI workflows

Answers from our run

Does monty build from source?

Dependencies installed in 28 seconds (34 packages), and the build failed. We cloned commit 037e91c into a clean Debian container with 3 CPUs and no project-specific setup.

Does monty have tests you can run?

Not through a standard command: the project exposes no test script or target that our harness could run.

Does monty have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use monty?

Workloads that need ordinary CPython packages: Monty has no sys.path or site-packages, and third-party imports are unsupported.

What are the alternatives to monty?

E2B, Pyodide, nsjail. Our Monty install took 28 seconds and 37 MB, but the build exited 1 after 6 seconds and the log tail did not reveal why, so source builders should reproduce that step before adoption.

Setup3/534 packages installed quickly, but our source build exited 1
Docs5/5Security boundaries and Python divergences are documented in detail
Community5/58,268 stars, a same-day push, and active issue reports
Maturity3/5The latest release is v1.0.0-beta.3 with compatibility gaps open

Who it’s for

Agent developers who need arithmetic, data shaping, and controlled tool calls without starting a container for each snippet.
Python, JavaScript, or Rust applications prepared to work within Monty's documented Python subset.
Teams willing to design and audit every host function, object wrapper, filesystem mount, and resource limit.
Stateful agent systems that can benefit from pausing, serializing, and restoring interpreter sessions.

Who it’s NOT for

Workloads that need ordinary CPython packages: Monty has no sys.path or site-packages, and third-party imports are unsupported.
Code that depends on generators, class inheritance, method decorators, match, or the full standard library: the limitations guide lists those features as rejected or absent.
Security policies requiring OS-level isolation in the open-source package: the security guide calls OSS Monty a language-level sandbox, with no container, seccomp filter, or virtual machine.
Applications that expose broad host callbacks to untrusted code: the documentation says those callbacks run with the host process's full authority.
Buyers requiring a stable 1.0 line today: the latest release is v1.0.0-beta.3, and 118 issues and pull requests were open when fetched.

Setup reality

Our sandbox installed 34 packages in 28 seconds and used 37 MB on disk. The build exited 1 after 6 seconds. Its log tail contained SyntaxWarning messages from Python files under crates/monty/test_cases, but it did not show the line that caused the nonzero exit, so we cannot assign a cause.

Local OSS use needs no hosted credential. You install the Python, JavaScript, or Rust package, then decide which inputs, host functions, objects, mounts, and limits a session receives. Remote commercial service use is a separate product.

Our checkout had 1,374 files, about 289,541 source lines, 3 CI workflows, no Dockerfile, and no tests directory. The harness found no test script or target, so tests were skipped. Pip-audit reported 0 known vulnerabilities in the installed Python packages.

Python 3.14 compatibility stops where the sandbox boundary begins

Monty implements a Python 3.14 subset in Rust, and the missing pieces are central to its design. Sandboxed code has no filesystem, environment variables, sockets, subprocesses, threads, native extensions, or third-party packages by default. It can calculate, transform data, define functions and simple classes, handle exceptions, and call a selected standard-library subset. That is a useful language for an agent to express a small job, but it is not a drop-in CPython runtime.

The limitations guide is unusually direct. Generator functions, class inheritance, method decorators, match, wildcard imports, and several other constructs are rejected. The standard library list contains 20 named modules, and each may expose only part of CPython's API. Common modules such as logging, hashlib, uuid, urllib, socket, and subprocess are absent. If a model has learned ordinary Python habits, type checking and clear retry instructions matter because valid CPython can still be invalid Monty code.

Three opt-in mechanisms define what code can reach

Monty's security guide names 3 paths from the interpreter to the host: functions, wrapped objects or classes, and filesystem or OS callbacks. With none configured, there is no ambient authority for the snippet to discover. A host function suspends the interpreter, runs application code outside the sandbox, then returns a converted result. That design makes the boundary visible in code review because every external capability begins with something the host supplied.

The same design can be weakened by a careless adapter. A callback that accepts any URL becomes a network primitive, and a callback that reads an arbitrary path becomes a filesystem primitive. The docs say host functions run with the full authority of the host process. Read-write mounts carry a similar warning because untrusted code can write files into a real directory. Monty can restrict the interpreter, but it cannot repair an overpowered function or an unsafe mount chosen by the application.

What happened when we ran it

Our measurement setup used a fresh unprivileged Debian container with 3 CPUs, 8 GB of RAM, Python 3.12, and no secrets. In our run, 34 packages installed in 28 seconds and occupied 37 MB. Pip-audit found 0 known vulnerabilities in those installed Python packages. The repository itself contained 1,374 files and about 289,541 source lines at commit 037e91c.

The build exited 1 after 6 seconds. The final log lines were Python SyntaxWarning messages about return and break in finally blocks and identity checks against tuple literals inside crates/monty/test_cases. That tail does not contain the actual reason for the nonzero exit, so we are not treating the warnings as the cause. Our harness found no test script or target and skipped tests rather than claiming a pass or failure.

Resource limits reduce damage but do not promise session survival

Monty exposes limits for memory, feed duration, host-round-trip duration, recursion, garbage collection, suspensions, and total sleep. Some limits are optional, while recursion depth and suspension count retain defaults. This gives a host several ways to stop generated code that allocates or loops forever. The memory budget covers requested allocations inside the worker rather than acting as a simple ceiling on the whole process's resident memory.

Open issue 921, filed against 1.0.0b2, demonstrates why limit behavior still deserves application tests. Nine very large keyword names in a functools.partial can cause a memory-limited worker to terminate when the function is called. The reporter explicitly did not show a parent-process crash, sandbox escape, or cross-session effect. That scope matters: the finding is worker availability under a tight limit, not evidence that Monty's isolation failed.

Snapshots help agents pause, but only trusted bytes should return

Monty can dump a session between feeds or snapshot execution while it is suspended on a host call. The resulting bytes preserve interpreter state so another process can resume the work. That is attractive for durable agent jobs because a request does not have to keep one worker occupied while an external tool runs. It also makes provenance part of the security design.

The snapshot guide says loaders are for unmodified bytes from a trusted, compatible producer. Monty does not authenticate snapshots or fully validate arbitrary contents. Store them behind access control or attach an integrity check before loading. Long-lived sessions have their own caveats: open issue 895 describes a name table filling after roughly 65,000 inputs because each REPL feed interns a new filename. That is a specialized workload, but agent loops can be specialized workloads.

Beta.3 is active, while Python compatibility is still moving

GitHub recorded release v1.0.0-beta.3 and a repository push on September 24, 2026. The repository had 8,268 stars and 118 open issues and pull requests when fetched. The release changed session dump serialization and added source positions for suspensions. Same-day code and release activity show maintenance, while the beta label and open compatibility reports show that API and behavior checks still belong in an upgrade process.

Monty makes the most sense when generated code needs a calculator-sized Python environment plus a few named tools. Its language boundary is easier to reason about than a full interpreter with a long package list, and its documentation tells you where that boundary ends. If the agent needs pandas, shell commands, arbitrary HTTP, or faithful CPython behavior, forcing those needs through host callbacks defeats the point. Put a normal interpreter inside OS isolation instead.

Alternatives

ProjectWhat it isPick it when
E2BA hosted sandbox platform that gives agents isolated cloud computers and a broader runtime environment.pick this instead when generated code needs normal packages, processes, or network access inside a managed remote sandbox.
PyodideCPython compiled to WebAssembly with a browser-oriented package ecosystem.pick this instead when browser execution and wider Python compatibility matter more than Monty's narrow host-call model.
nsjailA Linux process isolation tool built around namespaces, resource limits, and seccomp filters.pick this instead when you need an OS boundary around an ordinary interpreter and can operate Linux sandboxing yourself.

What people are saying

  1. [github-trending] pydantic/monty

Sources

  1. Monty README
  2. Monty security model
  3. Monty Python limitations
  4. Monty v1.0.0-beta.3 release
  5. Memory-limited worker issue 921
  6. Long-lived REPL issue 895

More ai tools reviews

Step-Code · agenticSeek · starnet · lap · stable-diffusion.cpp · Model-Optimizer · the whole board →