pydantic/monty

A secure Python sandbox, written in Rust, for code written by AI.

What it solves

Monty provides a secure, low-latency environment for executing Python code generated by AI models. It eliminates the overhead, cost, and complexity associated with traditional container-based sandboxes, which often take seconds to start up.

How it works

Written in Rust, Monty creates a restricted Python 3.14 sandbox. It isolates the code from the host system by removing access to the filesystem, environment variables, and the network. The sandbox only interacts with the host through specific functions and mounts provided by the developer, ensuring that AI-generated code cannot perform unauthorized actions.

Who it’s for

Developers building AI agents or applications that need to run LLM-generated code safely and efficiently without the need for heavy infrastructure like Docker.

Highlights

  • Ultra-low latency: New sandboxes can start in under 1ms from a running pool.
  • Multi-language support: Available as a package for Python, JavaScript/TypeScript, and Rust.
  • ** uma own commercial server version** (Full Monty) for WebSocket-based service delivery.
  • Strict isolation: No native access to the filesystem, network, or environment variables.

Related

  • Project
  • Project
  • Project
  • Project
  • Project