Skip to main content
Monty includes a small, focused subset of the Python standard library optimized for agent code execution. This page documents all supported modules and their features.

Available Modules

Monty currently supports these standard library modules:
  • sys - System-specific parameters and functions
  • os - Operating system interface (sandboxed)
  • typing - Type hints and annotations
  • asyncio - Asynchronous programming support
  • re - Regular expression operations
  • pathlib - Object-oriented filesystem paths
More modules are planned: datetime, dataclasses, and json are coming soon.

sys Module

Provides system-specific parameters and functions.

Attributes

Python version string identifying Monty.
Named tuple containing version information.
Platform identifier (always "monty" for Monty).
Markers for standard output and error streams.
These are marker objects only and don’t provide full file I/O functionality.

os Module

Provides operating system functionality in a sandboxed environment.
All filesystem operations in Monty are sandboxed and must be explicitly enabled by the host. Direct filesystem access is blocked for security.

Path Operations

The os module in Monty focuses on path operations. File I/O operations like os.open(), os.read(), and os.write() are controlled by the host environment.

typing Module

Full support for Python’s type hint system.

Available Types

Standard generic types for annotations.
Create type aliases for complex types.
Type hints for callable objects.
Literal, TypeVar, Protocol, and more.

Type Checking

Monty includes ty for runtime type checking:

asyncio Module

Asynchronous programming support for agent workflows.

Functions

Run a coroutine to completion.
Run multiple coroutines concurrently.
The host acts as the event loop. Monty yields control when tasks are blocked, allowing efficient concurrent execution.

What’s NOT Included

These asyncio features are not implemented as they require additional scheduler features:
  • asyncio.create_task()
  • asyncio.sleep()
  • asyncio.wait()
  • asyncio.wait_for()
  • Event loops and task scheduling APIs
The host environment acts as the event loop. Task scheduling is managed externally, not by Monty.

re Module

Regular expression matching operations powered by fancy-regex.

Pattern Matching

Find patterns in strings.
Extract all occurrences of a pattern.
Replace pattern matches.
Split strings by pattern.
Compile patterns for reuse.

Flags

Supported regex flags:

pathlib Module

Object-oriented filesystem path manipulation.
Like os, pathlib operations that access the filesystem are sandboxed. Path manipulation is safe, but file operations are controlled by the host.

Coming Soon

These modules are planned for future releases:
  • datetime - Date and time handling
  • dataclasses - Data class decorators
  • json - JSON encoding and decoding
Third-party libraries are not supported and are not a goal for Monty. The interpreter is designed specifically for agent-written code using only the stdlib.

Next Steps

Python Subset

Learn about supported Python language features

Limitations

Understand what’s not supported in Monty