What is Monty?
Monty is an open-source Python sandbox written in Rust for executing code written by AI. Monty serves developers who need model-generated Python to run with controlled access to application resources. The project is part of the Pydantic Stack and runs Code Mode in Pydantic AI.
Monty separates its package-based offering, OSS Monty, from its commercial server offering, Full Monty. OSS Monty is an MIT-licensed Python 3.14 sandbox installed as a package. Full Monty runs the same sandbox behind a gRPC stream, providing a server-based way to access the execution environment.
What Monty can do
Monty executes generated Python while leaving control over host access with the surrounding application. Monty does not provide an ambient filesystem, environment variables or network inside the sandbox. Instead, the application supplies the functions and mounts that sandboxed code may use, keeping those connections explicit.
- Monty runs AI-generated Python in a sandbox written in Rust.
- Monty accepts input values when starting code execution.
- Monty connects generated code to explicitly supplied host functions.
- Monty allows host access through supplied mounts.
- Monty provides packages for Python, JavaScript / TypeScript and Rust.
- Monty supports server-based execution through Full Monty's gRPC stream.
How Monty works
Monty is installed through the package ecosystem used by the host application. The repository lists uv add pydantic-monty for Python, npm install @pydantic/monty for JavaScript or TypeScript, and cargo add monty for Rust. Community bindings named gomonty and dart_monty cover Go and Dart / Flutter respectively.
Monty demonstrates execution through a pool, a checked-out session and a feed_run call. The application passes a generated code string, input values and an external_lookup mapping. In the example, a nutrition function executes on the host, while the sandbox receives only the function's return value for its calculation.
Who Monty is for
Monty is for developers integrating generated-code execution into AI applications and agent workflows. Monty's documented example shows a model-written calculation that combines an application-supplied input with information returned by a host function. Monty's use in Pydantic AI Code Mode provides a concrete agent-framework use case.
- Monty lets application developers run model-written Python calculations.
- Monty lets agent developers expose selected host functions to generated code.
- Monty lets Python, JavaScript, TypeScript and Rust developers embed sandbox execution.
- Monty gives service-based deployments a commercial gRPC server option.
Monty pricing and plans
Monty offers OSS Monty under the MIT license and Full Monty as a commercial server. The repository provides package installation commands for the open-source option and states that the commercial offering runs the same workers as a container image. The supplied product text does not list a price for Full Monty.
Monty strengths and limitations
Monty combines an open-source package, several language interfaces and an explicit host-access boundary. Monty's package-based sandbox avoids requiring a container-based sandbox for local execution, while Full Monty provides a server alternative. The documentation links cover the security model, resource limits, snapshots and the supported Python subset.
- Monty implements a Python subset, so unrestricted Python compatibility should not be assumed.
- Monty requires supplied functions or mounts to reach host resources.
- Monty separates the commercial Full Monty server from its MIT-licensed package offering.
Monty FAQ
What is Monty?
Monty is an open-source Python sandbox written in Rust for running AI-generated code. Monty restricts host access to explicitly supplied functions and mounts, and Monty runs Code Mode in Pydantic AI.
Is Monty free?
Monty is available as OSS Monty, an MIT-licensed open-source package. Monty also has a commercial server offering called Full Monty, which runs the same sandbox behind a gRPC stream. The supplied text does not state Full Monty's price.
Which programming languages can use Monty?
Monty provides installation commands for Python, JavaScript / TypeScript and Rust packages. Monty also lists community bindings called gomonty for Go and dart_monty for Dart / Flutter. The code executed inside the sandbox is a Python subset.
Can Monty access the filesystem or network?
Monty does not provide an ambient filesystem, environment variables or network inside the sandbox. Monty reaches the host only through functions and mounts explicitly passed into the sandbox by the surrounding application.
How does Monty run host functions?
Monty accepts an external_lookup mapping when code is executed through a session. Monty's example maps a nutrition function to a host-side callable; the function runs on the host, and the sandbox receives only its return value.
Does Monty integrate with Pydantic AI?
Monty runs Code Mode in Pydantic AI and is part of the Pydantic Stack. Monty supplies the Python sandbox used for generated-code execution, with host access restricted to explicitly provided functions and mounts.
From the community
No reviews yet
Be the first to review this tool. What you write helps the next person choose.




