pydantic

    pydantic/monty

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

    8.8K stars
    487 forks
    41 GitHub watchers
    Updated Nov 6, 2026
    View on GitHub

    Build with Backblaze B2

    SDKs, agent skills, IDE extensions, and reference pipelines from Backblaze Labs. All open source.

    Explore Backblaze Labs

    Loading star history...

    Where it stands

    Rank, growth pace and release cadence relative to everything GStars tracks.

    5 releases in the last 90 days, the latest today, with 71 contributors on GitHub.

    Peaked at #5 in the weekly ranking the week of Feb 8, its best in the past year.

    Use Cases & Benefits

    • Implements a minimal, secure Python interpreter in Rust designed to safely run AI-generated Python code with controlled host interaction.
    • Offers microsecond startup latency and strict sandboxing without container overhead, enabling fast, secure execution of limited Python code.
    • Use for embedding safe Python code execution within AI agents to run dynamically generated scripts without risking host environment access.
    • Use for iterative execution and snapshotting of Python code state to pause, resume, or cache interpreter sessions across processes or time.
    • Use for integrating with Rust, Python, or JavaScript applications requiring fast, resource-limited Python code evaluation with external function control.

    Should you depend on it?

    License terms, project hygiene and risks, from GitHub metadata and GStars' snapshots.

    License

    MIT

    Permissive: commercial use, modification and redistribution are allowed with attribution.

    Community files

    • README: present

    Watch-outs

    No watch-outs from GStars' checks.

    General guidance from repository metadata, not legal advice. How we score

    From the README

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

    Experimental - This project is still in development, and not ready for the prime time.

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

    Monty avoids the cost, latency, complexity and general faff of using a full container based sandbox for running LLM generated code.

    Instead, it lets you safely run Python code written by an LLM embedded in your agent, with startup times measured in single digit microseconds not hundreds of milliseconds.

    In short, Monty is extremely limited and designed for one use case:

    To run code written by agents.

    For motivation on why you might want to do this, see:

    In very simple terms, the idea of all the above is that LLMs can work faster, cheaper and more reliably if they're asked to write Python (or Javascript) code, instead of relying on traditional tool calling. Monty makes that possible without the complexity of a sandbox or risk of running code directly on the host.

    Note: Monty will (soon) be used to implement codemode in Pydantic AI

    Monty can be called from Python, JavaScript/TypeScript or Rust.

    (Or pip install pydantic-monty for the boomers)

    Excerpt from the pydantic/monty README on GitHub (MIT license). © its authors.Read the full README on GitHub

    Daily snapshots

    Stars gained per day, and how forks and open issues moved, from GStars' daily snapshots

    Sep 25: +6Sep 26: +55Sep 27: +30Oct 2: +10Oct 3: +18Oct 4: +12Oct 5: +16Oct 6: +12Oct 7: +8Oct 23: +9Oct 24: +6Oct 25: +8Oct 28: +10

    +788 stars over 83 days across 23 snapshot days; best day +55 on Sep 26.

    Forks

    487+83

    Open issues

    212+97

    Compared with peers in Backend

    Fastest-growing repositories GStars tracks in this cohort for the week of Nov 8, by 7-day star growth

    pydantic/monty compared with Backend repositories by stars, 7-day star growth, health score and last release
    RepositoryStars+7dHealthLast release
    anthropics/skills192.3K+5.2K75—
    zed-industries/zed94.7K+2.3K756 days ago
    google/skills23.8K+2.0K75—
    NationalSecurityAgency/ghidra99.4K+1.8K7519 days ago
    DuarteSantos8/openGym20.8K+1.7K757 days ago
    pydantic/monty8.8K—35today
    Category median94.7K+2.0K75—

    Also by pydantic

    Other repositories from this maintainer that GStars tracks

    Discover Repositories

    Search across tracked repositories by name or description