M
M

Monty - Python Interpreter

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

Cost / License

  • Free
  • Open Source (MIT)

Platforms

  • Python
  • Rust
  • Linux
  • Mac
  • Windows
  • BSD
-
No reviews
0likes
0comments
0news articles

Features

Suggest and vote on features

Properties

  1.  Minimalistic

Features

  1.  Run file in a Sandbox
  2.  Interpreter
  3.  Asynchronous
  4.  Supports Python
  5.  Run code
  6.  Run from python interpreter

 Tags

  • rust-based
  • security-sandbox
  • python-interpreter
  • async
  • digital-sandbox-environment

Monty - Python Interpreter News & Activities

Highlights All activities

Recent activities

Monty - Python Interpreter information

  • Developed by

    GB flagPydantic
  • Licensing

    Open Source (MIT) and Free product.
  • Written in

  • Alternatives

    3 alternatives listed
  • Supported Languages

    • English

GitHub repository

  •  4,817 Stars
  •  174 Forks
  •  21 Open Issues
  •   Updated  
View on GitHub

Popular alternatives

View all
Monty - Python Interpreter was added to AlternativeTo by Paul on and this page was last updated .
No comments or reviews, maybe you want to be first?

What is Monty - Python Interpreter?

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.

What Monty can do:

  • Run a reasonable subset of Python code - enough for your agent to express what it wants to do
  • Completely block access to the host environment: filesystem, env variables and network access are all implemented via external function calls the developer can control
  • Call functions on the host - only functions you give it access to
  • Run typechecking - monty supports full modern python type hints and comes with ty included in a single binary to run typechecking
  • Be snapshotted to bytes at external function calls, meaning you can store the interpreter state in a file or database, and resume later
  • Startup extremely fast (<1µs to go from code to execution result), and has runtime performance that is similar to CPython (generally between 5x faster and 5x slower)
  • Be called from Rust, Python, or JavaScript - because Monty has no dependencies on cpython, you can use it anywhere you can run Rust
  • Control resource usage - Monty can track memory usage, allocations, stack depth, and execution time and cancel execution if it exceeds preset limits
  • Collect stdout and stderr and return it to the caller
  • Run async or sync code on the host via async or sync code on the host

What Monty cannot do:

  • Use the standard library (except a few select modules: sys, typing, asyncio, dataclasses (soon), json (soon))
  • Use third party libraries (like Pydantic), support for external python library is not a goal
  • define classes (support should come soon)
  • use match statements (again, support should come soon)

In short, Monty is extremely limited and designed for one use case: To run code written by agents.