Skip to main content
Monty is intentionally limited to support one specific use case: running code written by agents. This page documents what Python features are not available.
Monty is experimental and not ready for production use. The project is still in active development.

Major Language Limitations

These core Python features are currently not supported:

No Classes (Yet)

Monty does not currently support class definitions.
Class support is planned and should be added soon. Track progress on the Monty GitHub repository.
What works instead:

No Match Statements (Yet)

Pattern matching with match/case is not implemented.
Match statement support is planned and should be added soon.
What works instead:

Standard Library Limitations

Limited Module Support

Only these stdlib modules are available:
  • sys
  • os
  • typing
  • asyncio
  • re
  • pathlib
Coming soon: datetime, dataclasses, json
The rest of the Python standard library is not available and most modules will not be added. Monty is designed for agent code, not general-purpose Python execution.
What works instead:

No Third-Party Libraries

Monty cannot use third-party packages like Pydantic, requests, numpy, etc.
Support for third-party libraries is not a goal for Monty. The interpreter is designed exclusively for sandboxed agent code execution.
Design philosophy: Monty is built for a specific use case where the code is:
  • Written by an LLM/agent
  • Executed in a sandboxed environment
  • Using only built-in and stdlib features
  • Making external calls via host-provided functions

Security Restrictions

These restrictions exist to ensure safe execution of untrusted agent code.

No Direct Filesystem Access

All filesystem operations are sandboxed and controlled by the host.
The host environment must explicitly provide filesystem access through external functions:
The host controls:
  • Which files can be accessed
  • What operations are allowed
  • Path validation and sandboxing

No Environment Variables

Direct access to environment variables is blocked.
What works instead:

No Network Access

Sockets, HTTP requests, and all network operations are blocked.
What works instead:

No Subprocess Execution

Running external commands or spawning processes is blocked.

Resource Limits

Monty enforces strict resource limits to prevent abuse:

Memory Limits

Execution Time Limits

Allocation Limits

Resource limits are configurable by the host and are designed to prevent runaway agent code from consuming excessive resources.

Import System Limitations

No Dynamic Imports

The __import__() function and importlib are not available.

No Import Hooks

Custom import hooks and meta path finders are not supported.

Advanced Python Features

These advanced features are not supported:

No Metaclasses

Since classes aren’t supported yet, metaclasses are also unavailable.

No Decorators on Classes

Class decorators don’t work (no classes), but function decorators work fine:

No Generators (Some Limitations)

Basic generators work, but some advanced features may not be fully supported:

No Context Managers (Limited)

The with statement has limited support. Custom context managers may not work fully.

What Monty IS Designed For

Despite these limitations, Monty excels at its intended use case:
Perfect for running LLM-generated Python code:
Excellent for coordinating external function calls:
Great for processing and transforming data:
Ideal for agent decision-making logic:

Comparing to Alternatives

Why use Monty despite these limitations? When to use Monty:
  • Running LLM-generated code
  • Need microsecond startup times
  • Security is critical
  • Stdlib subset is sufficient
  • Building agentic systems
When NOT to use Monty:
  • Need full Python compatibility
  • Require third-party libraries
  • Need classes today (coming soon)
  • General-purpose scripting

Roadmap

Planned improvements:
  1. Class support - Coming soon
  2. Match statements - Coming soon
  3. More stdlib modules - datetime, dataclasses, json
  4. Enhanced async features - Better asyncio integration
Follow development on GitHub and join the Pydantic Slack for updates.

Next Steps

Python Subset

See what Python features ARE supported

Standard Library

Explore available stdlib modules