Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pydantic Monty Examples

A collection of examples showing how to use Pydantic's Monty - from basic expression evaluation to wrapping it as a tool inside the OpenAI Agents SDK.

Monty lets you safely run Python code without containers and with blazingly fast startup times. It supports typed inputs, external function calls, type checking via ty, and serializable interpreter snapshots.

Usage

Requires Python ≥ 3.12 and uv.

# Clone the repo
git clone https://github.com/maximilianzuern/monty-examples && cd monty-examples

# Install dependencies
uv sync

# Run first example
uv run examples/basic.py

Examples

Example Description
basic.py Runs a hardcoded simple expression (4242 * 4242). Basically a "hello world".
useParams.py Passes typed input parameters (x, y) into the interpreter and runs an async multiply function.
useExternalFunc.py Defines a host-side multiply function and calls it from inside the sandboxed interpreter.
openAIagentSDK.py Wraps Monty as a tool inside an OpenAI Agents SDK agent that can multiply numbers on demand.

About

Examples for Pydantic's Monty

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors