<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/monty---python-in-rust-for-ai-zrxdj2qu8" -->

---
title: Monty - Python in Rust for AI | daily.dev
description: Monty is a Python interpreter written from scratch in Rust, purpose-built to safely execute LLM-generated code in agentic workflows. Unlike CPython or...
canonical: https://daily.dev/posts/monty---python-in-rust-for-ai-zrxdj2qu8
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Monty - Python in Rust for AI | daily.dev
og:description: Monty is a Python interpreter written from scratch in Rust, purpose-built to safely execute LLM-generated code in agentic workflows. Unlike CPython or...
og:url: https://daily.dev/posts/monty---python-in-rust-for-ai-zrxdj2qu8
og:image: https://api.daily.dev/og/posts/ZrXDJ2QU8.png
og:image:alt: Monty - Python in Rust for AI
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Monty - Python in Rust for AI

**[Planet Python](https://daily.dev/sources/planetpython)** · [@mkennedy](https://daily.dev/mkennedy) · 92 min read · 0 upvotes · 0 comments

## Summary

Monty is a Python interpreter written from scratch in Rust, purpose-built to safely execute LLM-generated code in agentic workflows. Unlike CPython or container-based sandboxes, Monty starts in microseconds (6µs cold), is completely sandboxed by design with no file/network/system access unless explicitly permitted by the host, and can serialize its entire interpreter state to a database for durable long-running workflows. Samuel Colvin, creator of Pydantic (10B downloads), built Monty largely with AI assistance. Key design choices include deliberate language incompleteness (no classes, no third-party packages), a suspend-and-resume model for tool calls, integration with Ruff's AST parser and the ty type checker, PGO builds for up to 50% performance gains, and WebAssembly support. The primary use case is 'code mode' — having LLMs write short Python programs that batch multiple tool calls, reducing agent costs from ~$2 to 4 cents per task. Monty also has broader applications for safe user-provided scripting wherever eval() is too risky and a full sandbox is too complex.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://talkpython.fm/episodes/show/541/monty-python-in-rust-for-ai>

## Similar posts on daily.dev

- [Running Pydantic’s Monty Rust sandboxed Python subset in WebAssembly](https://daily.dev/posts/running-pydantic-s-monty-rust-sandboxed-python-subset-in-webassembly-zurodrvzp) · Simon Willison · 1 upvotes · 0 comments
- [Combining Rust and Python for High-Performance AI Systems](https://daily.dev/posts/combining-rust-and-python-for-high-performance-ai-systems-ognelzoy3) · The New Stack · 0 upvotes · 0 comments
- [Ombredanne: An AI agent ported our codebase from Python to Rust](https://daily.dev/posts/ombredanne-an-ai-agent-ported-our-codebase-from-python-to-rust-cqwljumtd) · LWN.net · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#ai-agents](https://daily.dev/tags/ai-agents), [#rust](https://daily.dev/tags/rust), [#pydantic](https://daily.dev/tags/pydantic)

[View this post on daily.dev](https://daily.dev/posts/monty---python-in-rust-for-ai-zrxdj2qu8)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Monty - Python in Rust for AI","url":"https://daily.dev/posts/monty---python-in-rust-for-ai-zrxdj2qu8","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/monty---python-in-rust-for-ai-zrxdj2qu8"},"datePublished":"2026-03-19T19:48:42.600Z","dateModified":"2026-08-24T08:00:26.098Z","description":"Monty is a Python interpreter written from scratch in Rust, purpose-built to safely execute LLM-generated code in agentic workflows. Unlike CPython or...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b50d84684f087a48fc522b356686798c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b50d84684f087a48fc522b356686798c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet Python","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Michael Kennedy","url":"https://daily.dev/mkennedy","image":"https://media.daily.dev/image/upload/s--CAIUuwxP--/f_auto,q_auto/v1701901463/avatars/avatar_5Q1yteeM08cxesQG2actL","description":"Python enthusiast. Host of @talkpython and @pythonbytes podcasts, founder of Talk Python Training.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/monty---python-in-rust-for-ai-zrxdj2qu8","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,ai-agents,rust,pydantic","timeRequired":"PT92M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Python","item":"https://daily.dev/sources/planetpython"},{"@type":"ListItem","position":3,"name":"Monty - Python in Rust for AI"}]}
```

