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.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pydantic/monty/llms.txt
Use this file to discover all available pages before exploring further.
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
sys.version
sys.version
Python version string identifying Monty.
sys.version_info
sys.version_info
Named tuple containing version information.
sys.platform
sys.platform
Platform identifier (always
"monty" for Monty).sys.stdout / sys.stderr
sys.stdout / sys.stderr
Markers for standard output and error streams.
os Module
Provides operating system functionality in a sandboxed environment.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
Generic Types
Generic Types
Standard generic types for annotations.
Type Aliases
Type Aliases
Create type aliases for complex types.
Callable Types
Callable Types
Type hints for callable objects.
Advanced Types
Advanced Types
Literal, TypeVar, Protocol, and more.
Type Checking
Monty includes ty for runtime type checking:asyncio Module
Asynchronous programming support for agent workflows.Functions
asyncio.run()
asyncio.run()
Run a coroutine to completion.
asyncio.gather()
asyncio.gather()
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
re Module
Regular expression matching operations powered by fancy-regex.Pattern Matching
Basic Matching
Basic Matching
Find patterns in strings.
Finding All Matches
Finding All Matches
Extract all occurrences of a pattern.
Substitution
Substitution
Replace pattern matches.
Splitting
Splitting
Split strings by pattern.
Compiled Patterns
Compiled Patterns
Compile patterns for reuse.
Flags
Supported regex flags:pathlib Module
Object-oriented filesystem path manipulation.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
