Skip to main content
Monty supports a carefully selected subset of Python 3.14 designed for agent code execution. This page documents the supported language features.

Supported Features

Monty can run a reasonable subset of Python code - enough for your agent to express what it wants to do.

Core Language Features

Monty supports standard Python function definitions including:
  • Function definitions with def
  • Async functions with async def
  • Positional and keyword arguments
  • Default parameter values
  • Return statements
  • Nested functions
Full support for Python control flow statements:
  • if, elif, else conditionals
  • while loops
  • for loops with iterators
  • break and continue statements
  • return statements
Monty supports common Python built-in types:
  • Primitives: int, float, bool, None
  • Strings: str with full Unicode support
  • Collections: list, tuple, dict, set
  • Functions: Function objects and lambdas
First-class support for asynchronous programming:
  • async def function definitions
  • await expressions
  • Coroutines and async generators
  • Integration with host event loop
Full support for modern Python type hints:
  • Function parameter and return type annotations
  • Variable type annotations
  • Generic types from typing module
  • Built-in type checking with ty
Standard Python operators are supported:
  • Arithmetic: +, -, *, /, //, %, **
  • Comparison: ==, !=, <, >, <=, >=
  • Logical: and, or, not
  • Membership: in, not in
  • Identity: is, is not
All Python comprehension types:
  • List comprehensions
  • Dict comprehensions
  • Set comprehensions
  • Generator expressions
Full exception handling support:
  • try/except/finally blocks
  • raise statements
  • Built-in exception types
  • Custom exception messages
Multiple string formatting options:
  • f-strings with expressions
  • .format() method
  • % formatting
  • String concatenation

Built-in Functions

Monty provides access to essential Python built-in functions:
  • Type conversions: int(), str(), float(), bool(), list(), dict(), set(), tuple()
  • Iteration: len(), range(), enumerate(), zip(), iter(), next()
  • Functional: map(), filter(), sorted(), sum(), min(), max(), any(), all()
  • I/O: print() (output captured by host)
  • Inspection: type(), isinstance(), hasattr(), getattr(), setattr()
  • Other: abs(), round(), repr(), id()
Monty’s print() function captures output and returns it to the host via callbacks, rather than writing directly to stdout.

Performance Characteristics

Monty provides excellent performance for agent workloads:
  • Startup time: <1μs from code to execution result
  • Runtime performance: Generally between 5x faster and 5x slower than CPython
  • Memory efficiency: Manual reference counting and controlled allocation
  • Resource limits: Built-in tracking of memory, allocations, and execution time

Next Steps

Standard Library

Explore supported stdlib modules like sys, os, typing, and asyncio

Limitations

Understand what Python features are not supported