monty
by
pydantic

Description: A minimal, secure Python interpreter written in Rust for use by AI

View on GitHub ↗

Summary Information

Updated 16 minutes ago
Added to GitGenius on February 16th, 2026
Created on May 28th, 2023
Open Issues & Pull Requests: 77 (-1)
Number of forks: 384
Total Stargazers: 7,848 (+0)
Total Subscribers: 41 (+0)

Issue Activity (beta)

Open issues: 57
New in 7 days: 3
Closed in 7 days: 0
Avg open age: 13 days
Stale 30+ days: 51
Stale 90+ days: 20

Recent activity

Opened in 7 days: 2
Closed in 7 days: 0
Comments in 7 days: 3
Events in 7 days: 10

Top labels

  • bug (1)

Repository Insights (GitGenius)

Median issue/PR response: 6.9 hours
Mean response time: 4.6 days
90th percentile: 19.3 days
Tracked items: 101

Most active contributors

Detailed Description

Monty is a minimal Python interpreter written in Rust designed specifically for safely executing code generated by large language models and AI agents. The project addresses a critical need in AI systems where LLMs can express their intentions through Python code rather than traditional tool calling, enabling faster and more reliable agent execution without the overhead and complexity of containerized sandboxes.

The interpreter prioritizes security and performance as its core design principles. It completely blocks access to the host environment by implementing filesystem, environment variable, and network access through external function calls that developers can control. This means untrusted code cannot escape the sandbox or access sensitive system resources. Monty supports a reasonable subset of Python functionality including type hints with full modern Python typing support, async and sync code execution, and a limited standard library covering sys, os, typing, asyncio, re, datetime, json, and dataclasses. The interpreter can call functions on the host but only those explicitly granted access by the developer.

Performance is a defining characteristic of Monty. It achieves startup times measured in single-digit microseconds rather than the hundreds of milliseconds required by container-based approaches, making it practical for high-frequency code execution in agent loops. Runtime performance is generally comparable to CPython, typically between five times faster and five times slower depending on the workload. The interpreter can be snapshotted to bytes at external function call boundaries, allowing developers to store interpreter state in files or databases and resume execution later, enabling sophisticated execution patterns like pause-and-resume workflows.

The project is implemented in Rust with no dependencies on CPython, making it callable from Rust, Python, or JavaScript. The Python package is distributed via PyPI as pydantic-monty and executes code in a pool of worker subprocesses, ensuring that even adversarial code causing memory errors or stack overflows cannot crash the host process. JavaScript bindings are available as native NAPI bindings for Node.js and as WebAssembly for browser environments. Monty also provides resource control capabilities, tracking memory usage, allocations, stack depth, and execution time with the ability to cancel execution if preset limits are exceeded.

According to GitGenius activity tracking, the repository has maintained steady development with samuelcolvin as the most active contributor at 101 tracked events, followed by davidhewitt with 51 events. The project shows median issue and pull request response latency of 11 hours with a mean of 113.4 hours across 99 items. Recent activity shows a slight decrease in open issues from 71 to 70 as of July 2026. The repository overlaps with major projects including microsoft/vscode, python/cpython, and rust-lang/rust through shared contributors.

Monty explicitly cannot support the full Python standard library, third-party libraries like Pydantic, class definitions yet, or match statements, though class support is planned. The project is intentionally limited and designed for one specific use case: running code written by agents. The README notes the project is experimental and still in development. Monty will power code-mode functionality in Pydantic AI, allowing LLMs to write Python code that calls tools as functions rather than making sequential tool calls. Community bindings exist for Go and Dart/Flutter, extending the interpreter's accessibility beyond its native language support.

monty
by
pydanticpydantic/monty

Repository Details

Fetching additional details & charts...