Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

monty

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

What problem it solves

Running LLM-generated code requires isolation from the host environment while still allowing controlled access to selected functionality. A sandbox must provide this boundary without requiring users to manage a separate container-based environment.

Key features

  • Isolated Python execution — The Rust-based sandbox runs Python code with no filesystem, environment variables, or network unless access is explicitly provided.

    Source: README

  • Controlled host access — Code can call explicitly supplied functions and use explicitly supplied mounts while remaining isolated from the rest of the host.

    Source: README

  • Bindings for multiple languages — The project provides installable packages for Python, JavaScript and TypeScript, and Rust.

    Source: README, packages, crates

Quick start

Copied verbatim from the project's README.

uv add pydantic-monty        # Python
npm install @pydantic/monty  # JavaScript / TypeScript
cargo add monty              # Rust
from pydantic_monty import Monty

code = """
kcal = nutrition('chocolate bar')['kcal']
hours = kcal * 4184 / (bulb_watts * 3600)
print(f'a chocolate bar powers a {bulb_watts} W bulb for {hours:.1f} hours')
"""

with Monty() as pool:
    with pool.checkout() as session:
        session.feed_run(
            code,
            inputs={'bulb_watts': 10},
            external_lookup={'nutrition': lambda food: {'kcal': 230}},
        )
        #> a chocolate bar powers a 10 W bulb for 26.7 hours

Who it may suit

This may suit developers building applications that execute model-generated Python, especially those needing controlled host interactions without granting direct filesystem, environment variable, or network access.

Topics to discuss

  • Which host capabilities should be exposed to model-generated code, and how should those permissions be designed?

  • How should the sandbox explain access boundaries and failures to code-generation systems?

  • Which additional Python behaviors and host integrations should receive focused testing and documentation?


Written by ReadmeX AI from the project's README, source and public GitHub data; it may contain mistakes.

Read the original README https://github.com/pydantic/monty#readme

ReadmeX opened this community for a trending project; it is not run by the project. Maintainers can claim it from the community page.

github.comhttps://github.com/pydantic/monty

Comments

…