Skip to content
ReviewRamble

The weekly brief

AI, reviewed, in your inbox.

  • New reviews of tools, models, MCP servers and repos, with the verdict up front
  • Re-checked prices and ratings when something changes
  • New analysis pieces as they are published

Models, agents, MCP servers and the tools actually worth your time.

One email a week. Unsubscribe with the link in any brief. How we use your email

Monty

Pydantic's Rust interpreter for a strict subset of Python 3.14: AI-written code starts in under a millisecond, with no files or network.

Reviewed by ReviewRamble editors · Updated

View on GitHub Open source

Share this page:XLinkedInFacebookRedditWhatsAppEmail

Our rating

4.3/5

Monty makes running model-written Python nearly free in time and infrastructure, as long as your agent can live inside a deliberately small Python and you treat the sandbox as young Rust code that has already been broken once.

What is Monty?

Monty is a Python interpreter written from scratch in Rust by the Pydantic team, built to run code that a language model wrote and nobody has read. It implements a subset of Python 3.14 and ships as a package of about 4.5 MB for Python (pydantic-monty), JavaScript (@pydantic/monty) and Rust (the monty crate). Inside the sandbox there is no filesystem, no environment variables and no network: code reaches the host only through the functions, objects and directory mounts you hand it, and the interpreter's state can be saved and resumed at each host call.

It is the default engine for Code Mode in Pydantic AI and for CodeMode in FastMCP 3.1, where a model writes one short Python program that calls your tools instead of a chain of JSON tool calls. The code is MIT-licensed and reached v1.7.0 on 24 November 2026, after v0.0.1 in January and v1.0.0 on 25 September. A hosted version runs as Agent Sandboxes in Pydantic Logfire, in beta, and a closed-source gRPC server is offered to selected design partners.

Is Monty worth it?

Monty answers a narrow question well: how to run the few lines of Python an agent writes to glue tool calls together without paying for a container each time. Pydantic's own figures, measured on an Apple M3 Max, put a new sandbox from a warm pool at 0.8 ms and a ten-command agent run at 0.4 ms. The same page measures Docker at 195 ms to start plus 700 ms for the run, Pyodide inside Deno at about 2,700 ms while the WASM runtime loads, and a Daytona sandbox at 1.5 s to create. None of these numbers is independent, and Pydantic says it could not reproduce Daytona's advertised start of under 90 ms.

The price is the language. Functions, closures, generators, async and await, match statements, f-strings and basic classes work, and the docs promise CPython 3.14 behaviour for whatever is implemented. Metaclasses, async generators, del, async with and except* are rejected at parse time; classes cannot subclass built-in types, so custom exceptions are out; and with no sys.path, no third-party package will import. Most of the 36 standard-library modules listed are partial, and enum, contextlib, logging, uuid and urllib are missing. Some gaps are silent: __bool__ and __getattr__ are ignored, so every instance is truthy. A Hacker News commenter who tried it in June, before classes arrived, called it a much smaller subset than MicroPython. Models can rewrite around that; existing Python code mostly cannot.

The security model works at the language level, with no container, VM or seccomp filter underneath. In the Python and JavaScript packages each session runs in a worker subprocess that starts with an empty environment, so host secrets are not there to steal. The docs list the limits frankly. Your own callbacks run with full host authority. Workers are reused for 1,000 checkouts by default, which should drop to 1 when callers do not trust each other. Local pools have no request timeout until you set one, snapshots are unsigned, and the WebAssembly build runs in Web Workers instead of separate processes.

That model has been attacked in public. Pydantic's first Hack Monty bounty, $5,000, lasted under 48 hours in April 2026: a use-after-free, caused by gaps in the garbage collector around unsafe Rust, let an attacker read the secret after almost 1.5 million requests from about 650 IP addresses. It was fixed in v0.0.16. A second round at $10,000, co-funded by Prefect and Hugging Face, ended with no escape, and a third at $20,000 ran through August 2026; we found no published result for it. A new interpreter in a memory-safe language still had a memory-safety hole, which is a fair reason to add an OS-level boundary when the stakes are high.

Against the alternatives it is a different trade. E2B, which we review under tools, gives you a Firecracker microVM with full CPython and any library, billed by the second on someone else's machines; Anthropic's sandbox-runtime and OpenSandbox fence off whole processes with OS or container isolation. Monty wins on start-up time, cost and keeping data in-process, and loses wherever you need numpy, a shell or a real filesystem. It fits the glue code between tool calls, which is why Pydantic AI and FastMCP adopted it, and fits data analysis, scraping or running test suites poorly.

Where it earns its place

  • A backend engineer adding Code Mode to a Pydantic AI support agent

    Let the model filter and join tool results without sending every intermediate value back through the context

    Pydantic AI runs the model's program in Monty by default, with each tool exposed as a host function, so only the final answer returns to the model. The sandbox costs nothing beyond the CPU it uses, where a hosted VM bills by the second.

  • A platform team at a SaaS company running thousands of agent sessions an hour

    Run untrusted model code next to the application without a sandbox service

    A pool of Monty workers hands out sessions in under a millisecond. The security docs advise setting worker reuse to 1 for tenants who do not trust each other, adding request_timeout and a duration limit, and discarding any session that hits a limit.

  • A FastMCP server author exposing a large tool catalogue

    Stop the model loading every tool schema into its context

    FastMCP 3.1's CodeMode uses Monty by default, so the agent discovers and chains tools in Python. Prefect, which makes FastMCP, names the trade-off itself: because Monty is embedded, a sandbox escape means a compromised host.

Before you commit

Setup
uv add pydantic-monty, npm install @pydantic/monty or cargo add monty; the package is about 4.5 MB and needs no Docker daemon or account. A first run is a few lines: open a pool, check out a session and call feed_run with your code, inputs and host functions.
Integrations
Default runtime for Code Mode in Pydantic AI and CodeMode in FastMCP 3.1; community bindings for Go and Dart; a WebAssembly build for browsers; hosted Agent Sandboxes in Pydantic Logfire; a gRPC server for design partners.
Data and privacy
Runs in-process or in local worker subprocesses, so code and inputs stay on your machine. Workers start with an empty environment. Snapshots are unauthenticated, so restore only bytes you trust or sign them first. The commercial gRPC server has no built-in authentication and speaks plain h2c, so it belongs behind TLS on a private network.
Cost at scale
The open-source package costs only CPU. Logfire's hosted Agent Sandboxes include 50,000 invocations a month on every plan; Pro is $49 a month plus $0.10 per 1,000 invocations, capped at 50 ms of CPU per invocation and 20 MiB of memory per session.
Limits
Memory limits count allocator requests, not resident memory; budgets reset on every feed, so capping a session's total cost is your job; CPU-time clocks work on Linux only; open bugs include a worker panic on a lambda inside nested comprehensions.

What’s good

  • New sandbox in under 1 ms from a warm pool, on Pydantic's figures
  • No filesystem, network or environment unless you pass them in
  • Interpreter state can be saved and resumed at each host call
  • MIT, with Python, JavaScript and Rust packages and no C dependencies

What’s not

  • Python subset only: no third-party packages, metaclasses or custom exceptions
  • First bounty round was won with a use-after-free escape in April 2026
  • Defaults need tightening: no local timeout, workers reused 1,000 times
  • Some unsupported behaviour fails silently, such as __bool__ being ignored

Best for

Teams building agents in Python or TypeScript who want models to write short programs that call their own tools, without running a container fleet.

Monty alternatives

Where it fits in the AI stack

Monty: common questions

Is Monty worth it?
Monty makes running model-written Python nearly free in time and infrastructure, as long as your agent can live inside a deliberately small Python and you treat the sandbox as young Rust code that has already been broken once. We rate it 4.3 out of 5.
How much does Monty cost?
Free under MIT. Hosted Agent Sandboxes in Pydantic Logfire (beta): 50,000 invocations a month on every plan; Pro $49/month plus $0.10 per 1,000 invocations. Commercial Support gRPC server: price not published.
What are the downsides of Monty?
Python subset only: no third-party packages, metaclasses or custom exceptions; first bounty round was won with a use-after-free escape in April 2026; defaults need tightening: no local timeout, workers reused 1,000 times; some unsupported behaviour fails silently, such as __bool__ being ignored.
Who is Monty best for?
Teams building agents in Python or TypeScript who want models to write short programs that call their own tools, without running a container fleet.
How much does Monty cost for a team or in production?
The open-source package costs only CPU. Logfire's hosted Agent Sandboxes include 50,000 invocations a month on every plan; Pro is $49 a month plus $0.10 per 1,000 invocations, capped at 50 ms of CPU per invocation and 20 MiB of memory per session.
Is Monty safe for company data?
Runs in-process or in local worker subprocesses, so code and inputs stay on your machine. Workers start with an empty environment. Snapshots are unauthenticated, so restore only bytes you trust or sign them first. The commercial gRPC server has no built-in authentication and speaks plain h2c, so it belongs behind TLS on a private network.
What are the best Monty alternatives?
The closest alternatives we have reviewed are Anthropic Sandbox Runtime (srt) and OpenSandbox.

Answers checked Nov 29, 2026.

Make Monty? Show this rating on your siteMonty rated 4.3 out of 5 on ReviewRamble