When LLMs write code to accomplish a task, that code has to actually run somewhere.
And right now, the options aren't great.
You can spin up a sandbox container and you're paying the full second of cold start overhead, plus the complexity of another service.
Let the LLM loose on your actual machine and, well, you better keep an eye on it.
On this episode, I sit down with Samuel Colvin, the creator of Pydantic, now at 10 billion downloads, to explore Monty, a Python interpreter written from scratch in Rust, purpose-built to run LLM-generated code.
It starts in microseconds, is completely sandboxed by design, and can even serialize its entire state to a database and resume later.
We dig into why this deliberately limited interpreter might be exactly what the AI agent error needs.
This is Talk Python To Me, episode 541, recorded February 17, 2026.
Welcome to Talk Python To Me, the number one Python podcast for developers and data scientists.
This is your host, Michael Kennedy. I'm a PSF fellow who's been coding for over 25 years.
Let's connect on social media.
You'll find me and Talk Python on Mastodon, Bluesky, and X.
The social links are all in your show notes.
You can find over 10 years of past episodes at talkpython.fm.
And if you want to be part of the show, you can join our recording live streams.
That's right. We live stream the raw, uncut version of each episode on YouTube.
Just visit talkpython.fm/youtube to see the schedule of upcoming events.
Be sure to subscribe there and press the bell so you'll get notified anytime we're recording.
This episode is brought to you by our Agentic AI Programming for Python course.
Learn to work with AI that actually understands your code base and build real features.
Visit talkpython.fm/Agentic-AI.
Samuel, welcome back to Talk Python To Me.
Great to have you here, as always.
Thank you so much for having me back. Yeah, it's good to be here.
I saw your project and I immediately sent you a message.
You need to come on the show and talk about this.
What is going on? What is Monty?
Hat tip to the name. I want to hear the origin of the name.
You might be able to guess it.
I think I can guess it. I think I can guess it.
It's awesome to be here talking about this.
You've been on a bunch of times, but there's a bunch of new listeners or they don't listen to every show.
Give us your background.
So I'm Samuel and I'm probably best known as creating Pydantic validation library way back in the annals of time in 2017.
That is kind of an infrastructural bit of Python today.
We just crossed 10 billion downloads in total.
We're at like 580 million downloads a month.
So that gets a lot of usage.
Very lucky that Sequoia Capital came along and invested in Pydantic to start a company at the beginning of 2023.
So now we have a kind of stable of different things we do, what we call the Pydantic stack.
So there's Pydantic validation.
We talked about Pydantic AI, which is an agent framework where Monty kind of fits in best.
And then there's Pydantic Logfire, the observability platform for AI and general observability, which is the commercial bit of what we do.
So I suppose I'm supposed to be being CEOing most of the time.
I actually spend far too much of my time clauding.
I seem to be in good company.
I keep seeing people on Twitter, lots of CEOs of much bigger companies and writing lots of code.
So apparently I'm allowed to again.
It is an insanely exciting time with just the agentic AI in general.
And Claude, you know, Claude Opus, Claude Sonnet in particular, they are so good.
I don't know about you.
I'm sure at least half the people, at least half of the people listening are like, they've got a backlog of ideas they want to try.
Things they've always wanted to build and not the time.
Or maybe it's a bit of a stretch.
Like, I don't really know mobile.
I can't really build a mobile app.
But if I could, I would build this.
And now you kind of can, right?
Yeah.
I mean, I think it's got scary bits of it too.
I mean, maybe we're experiencing the like bonfire of the thing.
We all, you know, I was speaking to Zach Hatfield Dodds just before Christmas.
And he was like, we have had this weird time period when the thing I love doing happens to be incredibly financially lucrative.
I mean, he's anthropic.
So it's probably more financially lucrative for him than the rest of us.
But hey, and maybe that time is going to come to an end.
But I still feel very privileged to have had that time.
I don't know exactly what's going to go.
I mean, and definitely the jobs of software developers are changing.
And some of that is scary.
But as you say, it's also super exciting projects from Go Build a Mobile App, which you didn't know how to do.
But there were others who did through to building Monty, which I think we were relatively well placed to do it as a team of people.
But we would never have had the resources or the time to do it if it wasn't for LLMs being especially good at tasks like that.
Interesting.
Okay.
I do want to dive into that later.
But we haven't even introduced what Monty is yet.
So let's hold off on that deep dive.
But when I saw this, I'm like, I wonder what role that agentic coding sort of made this possible for a small team.
You know, like that was certainly one of the thoughts I had.
Yeah.
I mean, I can dive into it.
But yeah, I mean, I've got a bit of help now from David Hewitt, who is a great deal better Rust developer and knows more of the Python internals than many people.
Well, definitely more than me.
But for the most of it was just me in my spare time building it, which I'll talk in a bit about like why I think this is such an eligible project for LLM acceleration.
Yeah.
So you're playing both sides of the fence here.
It sounds like both maybe using a little AI, but also building for AI, which I think is quite interesting.
Yeah, I think we're I mean, yeah, we're doing we're building Pydantic AI as a way for LLMs to power applications or be part of applications.
We're also using AI to build that more and more.
I think of people's usage of Logfire is through their coding agent, as in sure, people can log into Logfire.
We love our tracing view, et cetera.
But I acknowledge there's a lot of people who are just going to point and clawed code at it and ask it to go and work out what's wrong and fix their bug.
So, yeah, we contact contact with what's going on in LLMs all over the place.
How did you facilitate that?
Like, how can the AI get that information?
We make this weird, esoteric, odd decision back when we first started Logfire not to allow users to write arbitrary SQL against their data.
We did that really because we thought it was too much hard work to build a build a query builder.
And like SQL seemed like the thing we would want.
And it seemed like a pretty esoteric, odd decision back when we started it in 2023.
Now it is like the most powerful, most defensible thing we have because we've spent two years learning how to build effectively an analytical database that anyone can go and query and run any query against and dealing with all of the side effects of that.
But everyone has an MCP server.
Fine.
But what's powerful about Logfires is LLMs are very, very, very good at writing SQL when they have a schema.
And so, you know, you ask it something that no one's ever asked it before, say, find me the five slowest endpoints by P95.
Now that's a reasonable one, but you can imagine some incredibly complex question that no one's ever answered before that no other kind of query builder dialect could do.
But because you have full SQL, you can go and write this.
LLM will write the SQL to give you back the answer.
I want the P95 worst top five there.
For this app, at this endpoint, for the people in Southeast Asia on Tuesday.
Right?
Something like you're like, we've run out of filters, but like SQL just keeps going.
And by the way, group that by hour or group that by every 15 minutes.
And like, you know, it gets arbitrarily more complex.
That just just works.
Yeah.
How very interesting.
I just wrote an article about how I think working in the native query language, if you're using agentic programming.
I saw you write it.
I was like, yeah, yeah, yeah.
Yeah.
And I mean, Pydantic is a perfect fit for that style.
It's like, if you could write your actual queries in native syntax and then transform it to a rich class, like a Pydantic or a data class or something like that.
These AIs, they are so trained on SQL or MongoDB native query syntax or, you know, whatever vanilla lowest level thing.
They see more of that than anything because it's across all the technologies.
I think that's going to be a thing.
And it's interesting how you sort of set the stage so that was already present for you and your product, right?
Yeah.
But even when we started building the Logfire platform, I remember saying, everyone was like, you know, which ORM are we going to use?
We're building a FastAPI.
So there was some debate about how we do it.
And I was like, let's just write SQL.
And everyone, you know, it seemed like an odd thing to do because, sure, it's like six lines of SQL to do a simple, like, what would be a like get in Django ORM.
But, I mean, I think even before LLMs, people were compelled enough because they were like, yeah, the like autocomplete kind of LLM will do a lot of the work for me.
And now I have complete control.
Now, I think where the majority of code is being written by AIs, having full control, full SQL is incredibly useful.
And you can optimize it, right?
You can only get the particular column that you want.
You can be very careful about which indexes are being used.
You can copy paste the SQL into whatever and work out the plan.
That's much harder when you're using an ORM.
So, yeah.
Yeah.
And you could just star star the dictionary that comes back right into a Pydantic class.
And then you put that behind a function.
You don't mess with it.
It's safe.
Exactly.
Yeah.
You kind of get the programmer benefits of programming against typed classes and the AI benefits of it can just talk like vanilla and the performance as well.
All right.
Don't necessarily want to go too far down that rat hole.
We got a different one to go down.
Let's talk about Python interpreters.
So, you built Monty, a specialized Python interpreter written in Rust.
And I just want to just do a little historical journey to show, like, for people who don't know, like, this is not the first one of these.
Actually, I'm happy to riff on this, but I'll let you take the lead.
I heard a conversation from two programmers in interchange, exchange between those two, talking about CPython.
They're like, what is CPython?
Is it like Python that compiles to C?
Or, you know?
So, maybe just a little bit of a chat about what the heck is an interpreter?
Yeah, go ahead.
I remember being confused about that, too.
And, you know, in Cython, which I don't think we hear about so much anymore, but that confused me as well.
I remember, yeah.
So, it's interesting that even from as far back as CPython's origination, there was an acknowledgement that there might be other Pythons, and that Python is a language, not an implementation.
But, yeah.
Go ahead.
Yeah.
So, well, we've got the Python interpreter, and we've got Python code we write.
Often, we write, well, Python, the language, but when it executes, it doesn't actually execute in Python.
It might execute because C understands it, and a C compiled thing runs.
Or, in your case, Rust understands the bytecode, right?
So, the interpreter parses our Python into Python bytecodes, which you can get through with the disk module.
You can disassemble it and look at the actual bytecodes you got back.
And then those are sent off to, like, a giant loop that interprets them, hence the term interpreter.
So, we've got CPython.
We have the defunct IronPython for .NET, which made it all the way to 3.4.
We've got the defunct Gython, which made it all the way to 2.7.
And we've got the much more exciting and modern Pyodide.
Well, Pyodide is still CPython, so.
Yes.
But compiled for WebAssembly, which I feel, I don't know, I feel like Rust and WebAssembly have this kinship.
So, it's like, I don't know, it feels closer to Rust than the others.
I agree.
There's also Rust Python, which is in active development.
I don't know what that's currently pointing at.
There's also Grail, which is another Python interpreter.
And the second biggest, really, is PyPy, probably the best-known one of all.
So, without meaning to cause offense to those that are still active, there's also Unladen Swallow was another attempt.
And there's a whole, but look, without meaning to cause offense to any of those that are still alive, there was a kind of graveyard of other Python implementations.
And so, I went into this knowing that it's a space where lots of people have tried to build things, put in, bluntly, a great deal more effort than we have.
And for the most part, I wouldn't say they failed, but they haven't got the same kind of adoption that CPython has.
I mean, I think...
Oh, 100%.
CPython is 99.9s of usage of Python.
And my take is that the reason for that is you need almost complete, perfect consistency with CPython to use something else.
Again, you need 99.59s of perfection, of identical behavior before you would go and switch in any real application.
I remember trying to use PyPy, and even if I could get it to run, well, it turns out its foreign function interfaces are not with, like, asyncpg were slower than CPython's, and so actually it didn't perform as well.
And so, the threshold to switch from CPython to something else or to choose something else was incredibly high.
And so, we are not trying to build another Python interpreter that you might credibly move your application across.
We're using Python as a syntax for a very specific thing where LLMs write code.
And the fact that we have a different goal is one of the reasons that we thought this was a credible project to take on.
This portion of Talk Python To Me is brought to you by us.
I want to tell you about a course I put together that I'm really proud of, Agentic AI Programming for Python Developers.
I know a lot of you have tried AI coding tools and come away thinking, well, this is more hassle than it's worth.
And honestly, all the vibe coding hype isn't helping.
It's a smokescreen that hides what these tools can actually do.
This course is about agentic engineering, applying real software engineering practices with AI that understands your entire code base, runs your tests, and builds complete features under your direction.
I've used these techniques to ship real production code across Talk Python, Python Bytes, and completely new projects.
I migrated an entire CSS framework on a production site with thousands of lines of HTML in a few hours, twice.
I shipped a new search feature with caching and async in under an hour.
I built a complete CLI tool for Talk Python from scratch, tested, documented, and published to PyPI in an afternoon.
Real projects, real production code, both Greenfield and Legacy.
No toy demos, no fluff.
I'll show you the guardrails, the planning techniques, and the workflows that turn AI into a genuine engineering partner.
Check it out at talkpython.fm/agentic dash engineering.
That's talkpython.fm/agentic dash engineering.
The link is in your podcast player's show notes.
You know, the real challenge, I think, that I saw with all of those is there are so many different use cases, and it's both a big benefit of all the Python packages and stuff,
but, you know, this package pulls in this compiled thing, and this other one pulls in another compiled thing, and it assumes that the gil works exactly in this way.
And so there's all these implied behaviors that have to be carried across.
And a lot of these, I think, we're trying to say, let's put those to the side and see if we could build something neater that's more native to Java or .NET or whatever people were after, you know, with those different ones.
But then the compatibility just hit them in the face, right?
We've like, I haven't actually counted PyPI lately, but how many were almost just short of three-quarter million, two packages short of three-quarters of a million packages.
We've got to reload this page at the end of the pod.
I'm just going to say, yes, we're going to leave it open.
We're absolutely leaving that open.
But trying to be compatible with that many projects?
We're actually 5,002 short of.
Oh, yeah, yeah, okay.
Sorry to be a pedant, but it comes with a gun.
Oh, yeah, yeah, no, you're right.
We're at 744, not 7.
Or 9, yeah.
There's going to be some kind of milestone reach, but it's not the one I was hoping for.
Anyway, the point is there's so many edge cases and so many specializations.
Yeah.
I think that's really where it hit them.
And, you know, maybe this is a good segue to just, you know, if not that, then what are you actually building?
What is this Monty?
So Monty tries to solve this problem where we want to allow, LLMs are very, very good at writing code.
We were talking about them writing SQL earlier.
They're very good at writing Python and JavaScript.
I think, honestly, it wouldn't really matter to the implementation whether we were implementing Python or JavaScript.
It just turns out for a bunch of reasons.
Python is easier and it's also like where we come from.
The simplest use case of Monty is what people call programmatic tool calling or code mode, where instead of my LLM calling tools in a loop,
sometimes using the return value from one tool straight into the next tool, the LLM can just go and write code and thereby be more reliable and much more performant and much lower cost.
So we've seen examples of like, if you, for example, connect Pydantic AI with code mode enabled to GitHub's MCP and you say, go and find the five latest pull requests.
And I forget what the question was, right?
But the point was we have to go jump through their API via MCP and calculate some value.
We've seen tasks go from kind of $2 down to $0.04 as a result of using code mode.
Because one of the big reasons for that is that those MCP responses are vast.
And so the LLM has to put loads of tokens into context to go and pull out, well, actually, this is just like the ID of the thing I need to make the next request.
I just added an MPC server to Talk Python a few weeks ago so people could ask questions about it and stuff.
And what really surprised me is the actual return type that MCP servers recommend is markdown, not structured data.
So you basically send a giant blob of markdown back as the response.
And then, like you're saying, a bunch of tokens get consumed just trying to understand the response rather than, here's a JSON document.
I know it's called this.
Boom, answer.
So I think in the case of GitHub's one, they do return JSON, which is useful for us because we can then go parse that JSON.
But also, if you don't need the whole of that response, you can search through it and extract a particular thing you need.
So the conservative threshold for what Monty can do is allow us to implement this code mode use case.
And I think it works for that for the most part now.
We're working hard on some improvements.
The biggest difference of it versus all of the other Python implementations is it is completely sandboxed.
It is isolated from your machine.
So you can't open a file or read an environment variable unless you very specifically say, here are the environment variables you're passing into this context.
Or here are the pseudo files or indeed real files that I specifically want to expose to this runtime.
That means that obviously reading a file is going to be way less performant than in CPython where we can go and make some syscall to read a file.
We're not doing that.
You're calling back from the Monty runtime to the host runtime, which might be Python or might be JavaScript or Rust, to say, read me this particular file, and then it can choose what to do.
But that is obviously what you want in this scenario where the LLM is writing the code.
So that is the regard in which we are completely different from all of the other Python implementations.
And then there's a few other projects doing similar things, but we're different in that regard from all of the established programming languages, which would all have ways to read files.
Very interesting take.
You know, it might be worth just a quick mention.
There's plenty of people out there listening who have not done agentic tool using coding.
So I think understanding just that the flow of that is kind of important to understanding the value of this, right?
And you did definitely touch on it, but if you go and ask Claude Code to do something, or Cursor, or whatever, it's constantly like, let me run this GitHub command.
Let me run this Git command.
Let me run this LS command.
Let me run this find.
And periodically it'll just exec Python, like little strings of Python and stuff.
So one of your core ideas is, what if we could give it a better Python that it's encouraged to use for this kind of behavior, right?
Let me describe it in a slightly different way.
Okay, so we have a continuum of how much control and how much flexibility LLMs have.
At one end of the spectrum, we have pure tool calling, where they can basically return JSON with the name of a tool that you're going to call.
And there are agent frameworks like PyLance AI that allow you to hook that up to functions.
But ultimately, you're just getting JSON back and you're deciding what to do with that.
And you may call the LLM again with some return value.
At the full other end of the spectrum, we have complete computer use.
Some LLM has some vision model and is moving my cursor around on screen to do everything I want.
Type onto our keyboard.
In the middle, we have a bunch of options.
We have Monty, which is kind of on the near the tool calling end of the spectrum.
Then we have sandboxes like Daytona and E2B and modal.
And then we have the kind of Claude code or codex style of like complete control of your terminal.
And along that spectrum, you go more and more power in terms of like capacity of what the LLM might be able to do and more and more security concerns.
And generally that comes with more and more of having an adult watching what it's going to go and do and controlling it and uncrashing it when it crashes, when it goes and does the wrong thing.
And so for the most part today, when we're using something in the cloud that uses an LLM, it's doing the tool calling end of the spectrum.
That's what the kind of LangChain, Langgraph, Pydantic AI, Crew AI, all those guys are doing.
The LLM is doing very similar things when Claude code basically decides to go and run LS or run RM-RF.
It's calling the tool like bash command, which the Claude application running on your machine chooses to go and execute.
The point is, for the most part, when we're building applications that are going to go and run in the cloud, we don't have a software developer who understands what's going on, sitting, watching every command.
And so we need to be much more constrained in what we're going to allow the LLM to do.
But we want to have a little bit more expressiveness than we do with pure tool calling.
And at the moment, there is basically nothing in the spectrum between tool calling and go and run a sandboxing service and have access to a full sandbox.
And that's powerful.
You can do a bunch of things with it, but often we don't need that stuff.
And that's where Monty's, that's the kind of sweet spot.
Okay.
There's interesting incentives or something that align with this undertaking as well.
For example, if you don't give it a networking stack, it can't do bad things on the network.
Yeah.
Because it just doesn't exist, right?
So it helps you, it inspires to create like a more minimal version of the standard library and so on.
Yeah.
And you can imagine like we, we will soon have a, some version of HTTP request that you can make, but you will be required to go and enable that explicitly.
And even better, because you're calling through the host, you're going to have a perfect point where you can go and read the URL and go, no, you can't make a request to local host and go and like start snooping on what's going on here.
You have to be making a request to an external URL or whatever else it might be.
Or even I'm going to go and use some third party service to proxy all HTTP requests.
So it is never an untrusted HTTP request inside my network.
But the point is, this is the single biggest difference of Monty is every single place where you can, where the code could interact with the real world, it must call an external function.
So call back through the host.
And then the other regard in which it is, I think somewhat innovative is we are not using traditional callbacks for that.
So we're not giving the runtime a list of pointers to functions it can call on the host.
Instead, the Monty runtime is effectively suspending and returning control to the host whenever you're doing a tool call.
So you're basically getting a response, which is like call the function, read file with the arguments file name on whatever else it might be.
And that allows a few things, but in particular, it allows us if that tool we're going to go and run, or that function we're going to go and run is going to take two days to run, we can serialize the Monty runtime, go put that in a database, and shut down our process
and wait for the tool to come back.
And that's something that CPython doesn't offer, understandably, but we are able to build because we built Monty from scratch.
You can serialize the entire interpreter state, go put it into a database and retrieve it later when you want to resume.
That's pretty wild.
So it's got this durability aspect, right?
Yeah, which I think is in these scenarios where often the code execution part of this is going to take milliseconds, but our tools might take minutes or hours or whatever else,
both for durability and to build an application that's both more durable and easier to maintain.
You don't have to have that interpreter state hanging around in memory as you would with CPython.
And all the other things like timeout and just other weird oddities, right?
Like I was working on something on my laptop just yesterday and my wife's like, you ready to go?
I'm like, hold on, I got to wait.
I got to wait for this chat to complete before it's been going for five minutes.
It's almost done.
Just hold on.
And then I can close my laptop and roll, you know, because it would have, who knows what it would have done to it, right?
Yeah.
And talking of timeouts, the other thing that we're able to do in Monty is we're able to, look, it's not perfect yet because it's early, but we basically allow you to set resource limits.
So total execution time and memory limit in particular and recursion depth.
And therefore you can run this Monty thing in some small image in the cloud and you can say it's got 10 megabytes and it, you know, once it's hardened, you know, it's early, we have that support now, but I'm not saying there are no ways around it.
It can't go and kill your machine out of memory.
Can't oom your container.
You're just going to get back a resources error saying too much memory can suit.
Yeah. Very powerful.
So I see on the GitHub page here, a couple of things.
First of all, it supports Python 3, 10, 11, 12, 13, 14, presumably 15 will take the place of 10 in a year or something.
So that is the support for the, so we have, so the Monty runtime is written entirely in Rust.
It has no dependency on CPython or PyO3 or anything else.
It is a pure Rust library.
We're very lucky.
We have the AST parser from Ruff, from the Astral team that we're able to, gives us, allows us to go from Python code to some basically structured objects.
We don't have to go and do that, like parsing the Python code ourselves.
Right.
Because Ruff is already written in Rust.
Like that's, I feel like the Astral team is kind of a peer of yours for sure.
You guys must look at each other, what you all are doing.
Yeah. Yeah.
And, and, and, you know, we use that a lot.
And also we have ty built in.
So the ty type checker from Astral is again written in Rust.
And so it is compiled into Monty when you use it.
And so before you run your code, you can go and run type checking at the same time.
And again, that, that feedback is incredibly useful for LLMs to get them to, to write reasonably reliable run like workflows.
But, but to, to come back to your, your question.
So we have Monty itself, which is just Rust, pure Rust, no other C dependencies, just in Rust.
And then we have, and that you can use that as a Rust library directly in your Rust application, if you so wish.
And there are people already doing that, but we then have libraries for Python and for JavaScript, which use in the case of Python, PyO3, which is amazing.
In the case of JavaScript, a thing called NAPI, or maybe you're supposed to pronounce it NAPI.
I don't know.
Which allow, which basically means we can go and have JavaScript and Python packages where you can call Monty.
And so slightly confusingly, that Python 310, Python 3.3.14 is referring to the Python package that you're installing.
The actual Monty is targeting Python 3.14 syntax only.
I see.
But those are the different language features that you support basically for parsing, right?
Something like that.
Yes.
No, no, no.
So that's just like, we only support, so Monty itself will run as if it was 3.14 or, you know, some subset of it.
We don't support all the syntax yet, but like 3.14 type stuff.
But yeah, if you're, when you're installing it, when you're uv add Pydantic Monty, you can do that in 3.10 through 3.14.
And obviously, because we maintain a bunch of Rust stuff, we've worked hard to have binaries for basically every environment, Python, Linux, macOS, Windows, bunch of different architectures.
And we have PGO builds, which no one else has.
So that should improve performance again.
Yeah.
PGO is process.
I did.
Yeah.
So, so we did this first in, in, in Pydantic itself, which obviously the core is written in Rust.
And it was in fact, David, David Hewitt on our team, who's the PyO3 maintainer, who identified this, this great technique.
So basically it's, it's part of Rust.
You basically compile the library, and then you run as many different bits of code against it as you can, in our case, all of the unit tests.
And then you basically recompile it with pointers as to which paths in the code, which branches are most common.
And you can get up to like 50% performance improvement.
But the thing is, if you're building your own library, that's a real pet.
If you're building your own application, that's a pain.
If you just uv add Pydantic Monty, you get that stuff for free.
Yeah.
Super cool.
Yeah.
I'm reoriented in my acronyms now, profiler guided optimizations, right?
Yes.
So basically compilers as, as Python people, we don't necessarily think about them a lot, but compilers have all sorts of optimizations.
And I remember in the late nineties, when I was working with things like GCC and stuff, you could actually break your program by asking for too many optimizations.
You know, you could, it had these levels.
And if you put it on the top level, there's a chance your program like literally might not run, which is a really bizarre thing for compilers to do, but they can, they make like decisions.
Like maybe we should inline this so we can avoid a stack jump and setting up the stack and all that.
with the PGO, it actually looks at how the code runs and uses that as input for its optimization, which is a super cool idea.
So it's awesome.
You're doing that.
Yeah.
And I honestly don't know what the difference is here.
I think when I tried it, it was relatively minor, but in Pydantic, it's, it's a, it makes for a big improvement.
Yeah.
going back a bit, I don't know if people remember depending on where they were in their journey, but from Pydantic one to two, I've got 50 X performance increases.
And yeah, the Pydantic of today is not the Pydantic of 2017, right?
It sure is not.
It's sure it's not.
And that was, you know, that was an enormous piece of work, the rewrite, because we didn't have LLMs.
I think it would have been a job that would have been a heck of a lot easier if we'd been able to point Opus 4.6 at Pydantic and be like, do this, but in Rust, but Hey, we got it done.
And I learned a lot along the way.
That's a challenge that we're going to have to, I don't know how you see it, but I think as an industry and individually, each of us is going to struggle with like, how much rust did you learn and how, how much experience and ideas did you get spending that year evolving
Pydantic versus if you just got it knocked out?
Like where's the trade-off?
It's a big double end thought.
Like I don't, I know there were those people who were like, now it's impossible to enter as a software engineer.
I've spoken to some people, some really amazing product people who were like, I'm writing code suddenly because I have the right technical mindset.
I just have never had the time to go and learn all this stuff.
And now the LLM can do the like rote for me and I can do the innovative product stuff on top.
So I get to build.
So we have new people entering, but you're right.
There are, there are going to be big challenges because just as I don't have a clue about assembly and I'm not good at writing it.
And that probably makes me a worse engineer than if I spent the first decade of my career hand writing out assembly.
So as we add layers of abstraction, the layer of abstraction beneath becomes kind of in the shade to, to most of us.
And we never, we never look at it.
Yeah.
It's very interesting.
I sort of think of this whole agentic coding thing as the change when design patterns became popular.
Instead of talking about, here's how we're going to do the loop or here's how we're going to construct the class.
You just think singleton flyweight.
And like you're building with these bigger conceptual building blocks.
And now it's kind of like make a login page.
Okay.
We've got the law.
Now what, now what else am I building?
Like you can think almost in components rather than like very small pieces.
Yeah.
I don't know what PyPI does, but like at the next level up.
Yeah.
Kind of.
Yeah.
I do think there's still room for people to come into the industry.
I think it's super exciting.
You still just, I think it's really going to come down to like problem solving and breaking down things into the way you want them to work.
And that's a programmer skill.
I also think what we haven't seen yet is the things that LLMs are bad at.
Because one, if an LL, if I tried to do something with an LLM and it doesn't work, that is not proof that I cannot do it with an LLM.
It's proof it didn't work that particular time.
Whereas if I go and try and do something with an LLM and it does work, well, hey, that's proof it can be done.
And two, no one wants to talk about this is the thing that failed, right?
So Anthropic announced we built a C compiler in two weeks by giving Opus loads of access.
What they didn't say is we tried to build an eBay clone and it was a complete unmitigated failure.
Cost us what would have been a hundred thousand dollars of inference.
I'm not saying that's happened and no criticism.
Yeah.
We don't hear about the failures both because they're less attractive to state and because they are not clear identifiers as it were in the way that like successes are.
And I think one of the things we will learn over the next few years is like, here are the things LLMs are really, really good at.
And here are the things that no one succeeded with them yet.
And that's probably meaningful.
I don't want to go too deep in this because I want to stay focused on money, but I'm also a believer of Jevon's paradox.
I think that this is going to create more demand for software.
Now that people see what is possible rather than just like, well, we're going to build exactly the same amount of software with fewer people.
So I think there's a lot there.
So codspeed.
So you have, have that on.
That's the, this is a pretty interesting tool.
I just recently learned about this.
You have this as a badge on your GitHub.
Tell us a quick bit about this.
I'm good friends with Arthur who, who was the founder.
I'm a big fan of codspeed when you're building performance critical code.
This is a nice few, but the real powerful thing is if you go in on a, on a pull request, you can see if you're getting performance regressions.
So, and even better.
So if, if you go to, so these are the particular benchmarks we have.
So if, yeah, maybe you go to branches, it's a, or if you go to a pull request in, in our GitHub.
Oh, if I compare all these, I've compared main against main.
That's not super interesting.
If you go back to our, if you go back to, to the, like go to PR that you guys have to, to PRs.
And if you go, for example, to that data class one, the third one down.
Gotcha.
All right.
Let's check that out.
You'll see, we have a comment from codspeed saying one benchmark has got more performance.
more importantly, I had performance regression.
Now Monty, now, now codspeed would be failing and I'd be like, I need to go fix that before I merge it.
So we can't, as long as we have enough benchmarks, we can't have like silent regressions in performance.
And even more powerful.
If I go click on that, on that particular one, if you kick on the pair tuples, or go just, perhaps.
Yeah.
What you will see is we can now go and see, the flame chart, the flame graph of exactly what's taken, what time and where the performance changes have come from.
This, this change is very minor.
So it's not very interesting, but you can imagine if you accidentally do something slow in your code, this is rust, but that'll work on Python as well.
You would have this like flame chart showing you where the performance has changed.
yeah.
If people who are listening, they just go to the Monty, get up repo, go to any pull requests, pull it down.
And there's just a comment from the cod speed bot.
And it says the improvement changed from 97.7 milliseconds to 88.1 milliseconds.
That's a 10.95% increase in performance.
So, Hey, this thing doesn't hurt performance, right?
By adding it.
Yeah.
What's even cooler is under the hood.
They're using, Oh, I'm having a blank on the name, but they're, they're not even measuring, they're measuring like CPU and CPU instructions.
Okay.
Yeah.
So it can run in, in a like noisy environment, like you have actions and you can still get like pretty good accuracy on detecting performance changes.
Valgrind.
There we are.
Valgrind is the underlying tool that like at the compiler level is looking at number of CPU instructions.
See what this pulls up.
Well, cool.
I don't know what that's about, but there's a, a polygonal polygon.
No, well, I don't know what this is a cartoon, but there's also the app.
Yeah.
The, the, the, the, Oh, that's its logo.
Okay.
I got it.
That's it's like, at least it's like hero image or something.
yeah.
Yeah.
So, so we, it's maybe a good segue then into performance where like the aim of Monty is not to build something faster than CPython.
The aim, the aim I suppose is to build something that is not like heinously slower.
we performance seems to vary from about five times better to five times worse.
In most cases, I'm sure that there are, there are edge cases we need to go and improve where it's worse than that, but like, that's what I seem to see.
I mean, in my impression of the kind of LLM written code that we're mostly talking about, performance is not critical.
Execution is going to be in the matter of single digit milliseconds.
And that's not going to matter when you add a LLM requests are taking seconds.
The thing where Monty really excels.
So if you scroll down a bit and I can talk you through the table, it's like near the bottom of the, of the read me.
but yeah, there we are.
So like the startup time here measured for Monty to go from basically code to a result.
I think the code here is like one plus one is, 0.06 milliseconds.
So that's six, microseconds.
So, and actually in the hot, hot loop in benchmarks, we see one plus one, going from codes to result in Monty taking about 900 nanoseconds.
So under a microsecond, again, that's, that's microsecond, not millisecond or second.
when you compare that to like running something in Docker, which is taking in, in my example here, 195 milliseconds, Pyodide, Pyodide is awesome project.
Big fan of, of the team, allowing you to run Python in the browser, but wasn't designed for this use case, running, going from zero to like getting a result in Pyodide is, 2.8 seconds.
Starlark's a special case of another project, a bit like Monty, but a bit more limited.
but sandboxing, I was talking earlier about that being one of the main options, like go run a, basically spin up a new container somewhere.
There's a bunch of services that will do that.
They're very popular at a moment from, from scratch to creating a new container and getting a result.
Here's taking over a second.
So where Monty really excels is where you have relatively small amount of Python code to call.
And that this, the overhead of running it is, is basically in the realistic term zero.
It's, it's the cold start over and over and over again.
The, cause these are all one shot commands, like the LLM asks for this thing and it shuts down when it gets the answer.
Right.
Yeah.
And, and I'm sure that if you ask the sandbox providers, they would be like, yeah, but it's not about cold start.
It's about reusing an existing container.
And that is way faster.
I agree that, you know, and then there, there are impressive pieces of technology, but there are also lots of cases where I do want, where I do want cold start.
I've spoken to the big LLM providers who are interested in Monty, because if you go and ask, ChatGPT, like effectively some, some arithmetic or like how many days between these two dates in the background, they're running Python code.
do that calculation.
They're obviously very security conscious.
They can't just go run that Python code YOLO on, on whatever host.
So they're actually using external, sandboxing services often.
And that one, they're paying the second of overhead for that, where they do need a new container, but also that, you know, they're paying the organizational complexity of another, another provider.
They're paying the fee of running that.
Whereas Monty would allow you to do that kind of thing right there in the process.
That is something that's really interesting about how these LLMs are like bad at math, you know, just add up these numbers and it might not get it right.
And so, like you said, they've, they've started to go, okay, I'm going to write some bit of code that I know how to write really well and can verify.
And then I'll just apply this data set to it.
Right.
Like you'll see it doing, you know, CSV types of things with Python and all sorts of stuff.
And so that's a really good place where that Monty could be the foundation of it.
Right.
Yeah, exactly.
And, you know, the other nice thing about that is if you have the Python code and something does go wrong, you're not having to like kind of guess at what's going on inside the black box of the LLM.
Well, I suppose you are at some level, but you have the code, which is kind of the intermediate step where you can go and verify.
Yep.
That code makes sense.
I mean, not saying everyone will do that, but as a developer debugging it, or as a data scientist trying to work out whether or not it is likely to have got the right result, I have the kind of intermediate representation of the logic that I can go and review.
And so it's that much easier to, to debug.
So let's talk about some of the columns, partial language completeness.
I'm not saying it needs to be completely complete, but you know, like what, what does it, what does it need?
You know, for example, do you need really dynamic metaclass programming for your tool use?
Probably not.
Right.
So probably not.
So at the moment, the two, what does it need?
Yeah.
So the things we miss right now, I'll start with, with the downside.
The things we miss right now are, classes, context managers.
So, so with expressions, and match expressions, which are obviously relatively new.
I think classes are by far the most complex of those.
We will support them at some point.
They're somewhat complex to, to get right.
I have been amazed by how much LLMs just don't need classes to do most of the stuff they're doing.
Like, so you could pass a data class into Monty and you will have some object where you can access attributes.
And access as of later today methods on that, on that data class.
But what you can't do is like define a class or a data class in, in the Monty code itself.
I'm amazed at how often that that's just not necessary.
Context managers will mostly be nice because we can allow the LLM to write the kind of code it might want to.
So let's say we allow the open, at the moment the open built in is not, it's not provided at all for opening a file.
We have like the, we have basic support for path lib via our way of, allowing use like very controlled access to the outside world.
But if we have add open, very often LLMs want to write with open, yada, yada.
And we want to be able to support that match expressions are, are, are neat.
And I think will be more and more common in Python.
And I think we can, you know, full support will be hard, but getting most of it there is hard.
What we will never.
And then, then the other big part of partial is we don't have the full standard library.
So we have a very, very limited standard library today of some bits of typing, some bits of the SIS, module, OS dot environment, as a PR up from someone to add re, regexes date, date time.
And I think we'll add Jason.
and so those will all be, be supported.
And to be clear, they will all be implemented in rust.
So like Jason dot loads will be rust level performance of loading that thing.
I mean, we're a bit of overhead to creating the Monty object, but, but very, very fast.
but we're never going to go and support the whole standard library.
It'll be on a case by case to LLMs actually need this thing, that we can go and go and add them.
I will say, and I know we're going to talk about this at some point, but like, it is amazing what this project is only made possible by LLMs and not, not that we're ever aiming to full standard library, but adding support for certain, certain modules of the standard library is a heck of a lot easier when you can, again,
we have a perfect record of what it's supposed to do.
So we can go and ask the LLM to, to build that.
and then the last test for like CPython has a ton of tests.
You can extract out the bits that apply to that maybe.
And just, well, does it run here?
I'll come on to like, so I have three reasons why I think it's, this is possible with LLM.
Let me just, the last point that's going to make is what we will never support is, or I think never support is third party libraries.
So you'll never be able to pip install Pydantic or FastAPI or requests inside, inside Monty.
And because the reason, the reason for that is we would need to support the CPython ABI and basically support full CPython.
And if you're going to do that, you're basically back to CPython.
and so sure there are ways of sandboxing CPython, most of which are demonstrated here.
That's not the aim of this project.
However, what we can allow you to do is basically have a shim where you expose, let's say HTTPX, get and post methods and patch and whatever you need through to Monty.
And we're, we're currently working out whether or not we basically add those, provide those shims as, as part of the library.
So you don't need to go and think about that.
You can be like, yes, give it HTTP access or yes, give it access to DuckDB's SQL, engine or give it access to beautiful soup.
And that shim comes and you don't need to go and implement it.
so you can whitelist in like super critical libraries that people are like, we, if I had this, I could really do.
So one of the questions we have now, that we need to probably go run evals on to find out is if we come up with a very Pythonic type safe, example of let's say an HTTP library, and we give those types to the LLM,
does it do better or worse with that than just being told you can use requests?
And I don't know the answer.
There are, there are genuine arguments in both cases.
Some people seem to be very sure one or the other is right.
I just, I just don't know.
And that's the kind of thing where we need to go and run evals and work out what an LLM will find easiest.
but yeah, we can either kind of attempt to fake the existing libraries, API, warts and all, or we can go.
And in many cases just say, Oh, we've got this new fetch library that has a fetch method and here's its, signature.
And I suspect the LLM will do, do a pretty good job of it.
So what are the weird new, not quite typo squatting, but kind of typo squatting supply chain type of issues has, at least in the earlier days of LLMs, they, when you would ask it to write code, sometimes it would say,
we're going to import some library and that library didn't exist.
And then it imagined a bunch of code series that happened after it.
So people would go and find popular ones of those and then register malicious packages that the LLMs had hallucinated.
Right.
but I guess you probably kind of, you kind of got to do a similar analysis, but not for evil where you say like, well, if I just ask Claude or, or, codex or whatever to do a thing, what is it?
What does it try to do?
If you see it always asking for a question, like maybe it's just better that we, we lie to it and say, okay, whenever it says import requests, we give it our special way to just get stuff off the internet.
And it only really needs to get put in like a couple of, it doesn't need all of requests.
It just needs a very basic behaviors.
Yeah.
Is that the kind of stuff you're thinking?
Yeah, exactly that.
And that's one of the reasons we didn't start with Starlark, which is a, I think originally a meta Facebook project to have a, like basically isolated Python runtime was because Starlark has a very
disciplined and principled approach to what it supports and what it doesn't.
We have to be not principled.
We have to be like, well, if the LLM wants to write this thing, we're going to go and implement the CSV module, but not the Toml lib module.
Cause that's just what they need to go and use.
And we're going to be like, our principle is give the LLM what it wants, not here's our rule.
so yes, exactly.
And yeah, I mean, I think Boris, Boris, the, code code creator talked about this.
So I saw him speaking, he was saying like, you know, one of the reasons they gave the LLM bash early on was like, you can tell it to use the make dark, tool to make directories, but half the time it'll just go and call make dark --P and make the directory that way.
And like, are we going to fight it and always return an error being like, you should do this other thing, or are we just going to make that thing work?
And often you have to just make nothing work.
so, so yeah, go ahead.
Yeah.
Is this useful outside of this for AI story?
You know, like if I'm creating something that has really high security, I want to add some, some mechanism for people to write scripting, but not full on programming language.
So in other places.
Yeah.
We've actually thought about this internally inside log fire already.
Like we want to be able to give people a way of basically entering config config that can do things.
There's no easy way of doing that right now.
Right.
As it's sure I can go and use as again, one of these sandboxing services to run that code, all the complexity of setting up, we offer self-hosted log fire.
So they're not going to work, et cetera, et cetera.
Or once Monty is a bit more mature, we can just go and use Monty to let them like define the expression that, that it might be as simple as like, what field do we use from your profile to display as your net?
Right.
And we can, we can let you bet in or an AI can write the, like one line of code that does that.
And then we can call it lots of times.
They're like, it's feasible now to have the, like a few lines of Python code to define this.
That's generally, generally been hard until now.
but of course, you know, the best tools are the ones where you, people use the tool for not what it was originally designed for.
So someone invents the hammer and I think it's going to be used for nails.
And then someone else realizes that you can like change the, like knockout, like mistakes in your bumper of your car with a hammer.
Right.
And like, of course, what's amazing about Pydantic, why I'm so proud of it is people gone and used it as a general purpose tool for a bunch of things I'd never thought of.
So my like dream for Monty is that people come along with things to do with it that I had never heard of.
And like, RLM is a really good example of that.
So recursive language models of this way in which you use almost always a Python REPL as a way of implementing effectively agentic loop.
And there were some people who have an example of doing that and like getting better results in the RKGI 2 benchmarks by using RLM.
I didn't even know about RLMs when I announced Monty.
There are now at least four different libraries that are using Monty for RLM with, with DSPY because DSPY because people are super excited about that space.
So that's, that's agentic, but it's definitely something I hadn't thought of when I announced it.
Yeah.
I was even thinking just like, I have a medical device, like a CT scanner.
I want to let people script it, but we can't break it and like zap somebody.
Do you know what I mean?
It needs to be really very, very controlled.
this could be a really interesting, thing.
So does it compile to WebAssembly?
Can I in browser it?
Yep.
And in fact, Simon Willison, the day it came out or Simon Willison, Claude prompted by Simon Willison set one up.
So I think if you go to Simon's blog somewhere, there's actually an example of Monty running somewhere, somewhere in a browser that you can, you can go and go and try it.
Probably an earlier version.
yeah, somewhere here, I think he'll have a link to, to his, his version of it.
so as he pointed out that you can do the really crazy thing, which is you can, you can compile the Python package for, yeah, so this is, this is his example, which is, I think like, WebAssembly running directly in the browser, but he did something even more crazy, which is he took the Python library,
compiled that to, to Wasm and then called that from inside Pyodide, which is like crazy worlds within worlds.
definitely not the original plan, but, but interesting.
Yeah.
Wow.
Okay.
So yes.
And here's your example to do it, right?
Yeah.
And I think the other, the other thing we really need to add to this table, in terms of, of latency and complexity is calling back to the host.
So one of the reasons a number of people have reached out to me and excited about this is sure that they're happy to have a sandboxing service.
They don't even mind the second of, of start time, but like if they want to, for example, build an agent that can go and basically, run SQL against a bunch of CSV files, how do I get those CSV files into the sandbox?
Well, that is painful and often slow because we have to make a full network round trip back to the host to get those files.
The, the network latent, the, sorry, the overhead of calling a function on the host in Monty is a single digit milliseconds or maybe even less.
And so if you're making, if you're reading 50 different files from the, from, from the local, yeah, from within the sandbox, but effectively they're registered locally, that's super easy and performance because it's running right there and the same process.
Very neat.
So a couple of questions.
Bonita says we have agents running on AWS strands.
Here's the crazy thing about AWS.
There's like so many services.
I don't even know what strands is.
Yeah.
But amazing.
I think strands is their agent framework is my, my, my guess.
Yeah.
Will the use of Monty help us improve performance there?
Could they use Monty?
Yes, it should be able to.
I'm again, again, apologies if I don't know exactly what strands is.
If strands is their agent framework.
Yes.
In principle, Pynastic AI, our agent framework will have support for Monty as a code execution environment later this week.
And so you'll be able to basically, instead of running, yes, open source agents SDK.
So I don't know whether AWS intend to add specific support for Monty, but I know our agent framework will support it later this week.
My guess from, from what we've built in the past is others will pick up on it and also integrate it into, into their things.
And of course, the nice thing is here because all the only real requirement is rust.
We already have the Python package and JavaScript package, but if you wanted to call it from, from any other language base where you can call rust, that should be possible.
And data science, you mentioned DuckDB already.
Sort of.
Yeah.
NumPy would be, would be great to have, I think full, I mean, I think when like, this is where we need to be a bit careful about what we add.
Like, sure.
If there are particular bits of, of NumPy that are useful, can we go and add shims for that?
Or can we even go and implement that in rust?
So you can do a like NumPy matrix transformation that happens effectively in rust, but we need to work out what people want and where, what we can't do, unfortunately, I'd love to be able to, but we can't do is just be like, yep, click this button.
And then now we have the full NumPy API available.
That is the, you know, that's the big, I'm not going to say Achilles heel because I'm super optimistic about Monty, but that's the, you know, the biggest challenge of Monty is, is that we don't just get to use all the libraries.
Okay.
Let me propose a slightly different path.
Yep.
Polars.
Yep.
Plus Narwhals.
What's Narwhals?
Narwhals is a, a facade API, a facade across NumPy, Polars, and a few other things that gives you, like you can program in either, and it'll talk to one or the other.
So basically you could use Narwhals to talk NumPy, but it translates all the calls over to Polars.
Yeah.
I mean, given that, you know, there's a paradigm shift happening here.
We, what we, what we're not trying to do is let your existing Python code run in this runtime.
We're trying to give it a context for LLMs to be able to write code.
And so why not?
I mean, Polars is written in Rust.
And exactly.
That's why I said that.
Yeah.
Go and like compile Polars into Monty.
And now you have a full, like very performant data frame library or, you know, analytical database effectively built into it.
And you can, and we have the full Polars API available in, in Monty.
That would be, that would be one option.
Again, I'm going to be a bit restrictive and, you know, any color, as long as it's black about what we add, because I don't think, you know, we don't need, I don't care about your taste of whether you prefer Polars to Pandas or anything else.
I care about what are the LLMs find easy to do.
I think the biggest point of proof of that, Samuel, is that it doesn't do Pydantic yet.
Yeah.
If it doesn't do Pydantic, like, okay, you, you're, you're walking the walk.
Yeah.
And, and I, to be clear, I don't think, yeah, am I going to vibe code a whole new Pydantic in Monty?
I don't know whether I'm keen for that yet.
Yeah.
Yes, indeed.
So how do I go about making my AI, like, let's say I'm doing cloud code, Opus 4.6, some project.
I'm actually not a huge fan of the terminal cloud code.
I feel like it takes me too far away from the code.
Just, I prefer to kind of have it in to kind of editor, like the extension for say cursor or VS Code, where I can sort of like watch the code as it's going and sort of, no, no, no, you're going the wrong way.
Anyway, it doesn't matter really which, how you run it.
Suppose I'm running it somehow.
How do I tell it about Monty?
How does it know what Monty can and can't do?
How do I make it use Monty?
You know what I mean?
You wait a few weeks for us to have skills for Monty and the rest of our stack, and then you install those skills.
It's something we need to do.
And I think that's the number.
We will have proper documentation for Monty as well.
And that will, that will be an important part of it.
That's, yeah, there's a lot to do here.
LLMs can help with some of it, but not, not by any means do all of it.
I mean, at the moment, read the read me and read the issues.
And I'm, I am like impressed, surprised, scared by how much people are using Monty already.
how much is he picked up?
It's already, what are you doing?
You know what I saw?
I saw your announcement of this on X actually is where I saw it.
And I believe, it's been a little while since I saw it, but it said something to the effect of like, this is way too early, but what the heck, here we go.
Posted the GitHub link, right?
Something to that effect.
And that was, what's that last week?
Here we are with 5,000 stars.
Yeah.
yeah, exactly.
And it shows how many people are, you know, are looking, are interested in this space.
I mean, look, a lot of people would have started thinking, Oh, there's going to be a new Python.
That's just faster.
Cause it's in Rust and it's going to do everything better in a way that like, you might argue, you know, rough is like wholly better than what one before.
That is not, that's not the aim for Monty.
This is not going to supplant or replace in any way.
See Python.
It's a, it's a completely separate thing.
But I think there's also a lot of people who have started this because they're running, they're having a headache running stuff in a, you know, with existing options for sandboxing and something like this is, is interesting.
There's also, there's another project that's worth calling out from Vasell called Just Bash, which is very similar conceptually.
It's a bash environment written entirely in TypeScript by, by a team.
I've said, I met them when I was in San Francisco a few weeks ago and the plan, when I get around to finishing the JavaScript API is that they will in fact use, Monty as the way of calling Python code.
Cause they have some way of calling Python code within this, which I think uses Pyodide at the moment.
And it has some, some overheads and some, some, challenges around, security.
but yeah, this is very similar in the sense of like, it's basically vibe coding, all of the terminal methods that you might want, and using a bunch of existing unit tests to, to check that they're correct.
interesting that obviously Vasell is a much, much bigger name than we are.
And it hasn't got as much, like traction early on as at least in terms of GitHub stars, the, you know, the worst of all vanity metrics.
they've been out like two or three times as long as you have, they've 1000 stars.
That is, I mean, that's noteworthy, honestly.
Yeah.
And there's another project like this, which has about 20 stars, which I was looking at earlier today, which is this, but in rust completely, which already has support for Monty, which I can't remember the name of right now, but maybe I should find it quickly and call it out.
Cause I feel like it deserves it given that it's a really cool project.
It has, as I say about, 30 stars.
let me very quickly, excuse me for one minute.
It was one of the replies to my initial announcement.
sorry.
I will not be very long.
it's called bash, bash kit.
I put the, put the link here.
this already actually has optional support for using Monty as the, as a Python, runtime.
well, if I was logged into GitHub on my streaming machine, I would have one more star, but I'll do it later.
Fair enough.
But, but I think what's interesting is all of these three projects and I've heard of a few others, you know, these are only possible really, or they're only really challenges anyone would take on with the advantage of, of an AI.
And so, so I was mentioning this earlier.
I think there were three reasons why these things have, why I'll talk about Monty in particular, why it is possible now when it wasn't before and why it is something where the like speed up from an LLM is even greater than in most, most coding tasks.
One, the LLM, knows in its soul, in its weights, the internal implementation, how to go about implementing a bytecode interpreter or how to implement it.
If I asked most even experienced Python engineers or Rust engineers, how do I write a bytecode interpreter?
They would scratch their head and be like, yeah, I sort of know about this.
I'll put my head up and say, I didn't know what a bytecode interpreter was or how they worked until I and Claude built one together.
But like, they know exactly how to do it because they've read 15 different, well, well-trodden implementations.
And it's got a great example.
You can say, not just any, here's the Python, CPython one, just help me do that.
Whatever that does.
And the second thing is they know what the public interface is again, in their soul, as in they know what, what Python should be like.
They know the signature of the filter function without you having to go and describe it.
Thirdly, you have an amazing set of unit tests, which is basically just, does it match CPython?
So in our case, we basically vibe generate tests whenever we're, whenever we're adding a feature and then we run them with CPython and Monty.
And we confirm that they are identical output down to the byte.
You know, the exceptions have to be identical to the, you know, to the byte.
But in the case of just bash, they, they have the existing set of like some bash tests somewhere for like any shared environment that they're able to leverage.
And I think one thing we might do at some point is basically go steal a bunch of CPython tests and run them with both.
I haven't got there yet, but that would be an interesting way ahead.
And then the last thing is you don't have to bike shed or have any human debate about what should the, what should the function, what should the error message be when you try and add an int to a string?
There's no, there's no debate about that.
You're just doing whatever CPython does.
And so there's a whole, whole range of bike shedding debates that we just don't have to go and have because we're just like trying to target CPython.
Now, of course, around the edge of that, there's a bunch of places where we do have to think about it.
Like how do we do these external function calling things?
And that's, that is obviously, that is honestly much, much slower because we don't have this, like the LLM knows already the answer.
approach, but I think these are the kinds of tasks where LLMs are massively faster or one, one set of cases where LLMs are massively faster than without.
So I was speaking to big public company in New York who was saying that one of their team had vibe coded a Redis, clone in rust, put it into production after 72 hours and it was 30% faster than Redis.
Why is that probably worked fine, right?
Yeah.
And why is that possible?
Well, the same things are all true.
The unit test is super easy.
It's just, is it the same as Redis?
There's no debate about what the API is, et cetera, et cetera.
And so there are these tasks, which historically we would have thought was super hard.
So I think often we fall into the trap of thinking that what LLMs are good at is what humans are good at.
And what LLMs are bad at is what humans are bad at.
I think more and more, we're seeing there are things that LLMs are much better at than we are.
And there are things that they are, that they're less good at.
And we're still very early in learning what those things are, but it is not good enough just to be, just to use the like naive, simplistic approach of like what humans are good at, they're good at.
The simplest example of that is like, ask a NLM to generate you a B-tree implementation in C.
And with that prompt alone, it will write you 500 lines of C that work as a B-tree implementation.
It takes you 20 minutes to study it, to be sure.
And it's like, you're not, I think it works this way, right?
Yeah.
I honestly think the little, the bits of weird math and a little, the little hallucinations and stuff have shaken a lot of people's trust in these things.
And it's just like, well, I'm, I mean, how easy is it to add five numbers?
Come on.
Obviously these things are junk because they can't do that.
And it's just like, well, maybe that's not the tool to use for that situation.
Right.
Yeah.
But, but what you're using here is incredible.
Yeah.
But again, we have the guardrails of you must write unit tests all the time that match the two.
I mean, well, or we have fuzzing going on.
The fuzzing is another amazing technique.
So we use, so we have a Jason parser called jitter, which is about the fastest Jason parser in rust that we also is built into, Pydantic core, but it's also actually independently a package in, in PyPI that's used an awful lot.
You'll see it in the dependencies of open AI, for example.
but jitter was where we, I discovered about fuzzing really.
No, I found out about it through, the hypothesis project project of, my friends, Zach Hatfield Dodds in Python, but then fuzzing in rust because the performance is so much better is, is, is really powerful.
So basically it's generating random strings and using them as an input something, but then it's using very clever stochastic techniques to work out where to try more things.
And so you can basically fuzz, Monty, you can just give it arbitrary strings for hour after hour.
And periodically it'll find something where there's an error where like the memory usage is too high.
If you do the following sequence of multiplying integers together.
I don't think it will find a like true read the file system vulnerability, but it'll definitely find like odd memory uses or it has found, stack overflows and panics and things like that.
Well, I think people are excited about it.
It's definitely got a lot of people talking, a lot of attention, a lot of, a lot of comments in the live stream.
So congrats.
And yeah, keep us posted on where it goes.
And we'll do.
Thank you very much.
Yeah.
Thanks so much for having me.
You bet.
Bye.
This has been another episode of talk Python to me.
Thank you to our sponsors.
Be sure to check out what they're offering.
It really helps support the show.
This episode is brought to you by our agentic AI programming for Python course.
Learn to work with AI that actually understands your code base and build real features.
Visit talkpython.fm/agentic dash AI.
If you or your team needs to learn Python, we have over 270 hours of beginner and advanced courses on topics ranging from complete beginners to async code, flask, Django, HTMX, and even LLMs.
Best of all, there's no subscription in sight.
Browse the catalog at talkpython.fm.
And if you're not already subscribed to the show on your favorite podcast player, what are you waiting for?
Just search for Python in your podcast player.
We should be right at the top.
If you enjoy that geeky rap song, you can download the full track.
The link is actually in your podcast blur show notes.
This is your host, Michael Kennedy.
Thank you so much for listening.
I really appreciate it.
I'll see you next time.
I thought of me.
Get we ready to roll.
Upgrade the code.
No fear of getting old.
We tapped into that modern vibe.
Overcame each storm.
Talk Python To Me.
I sync is the norm.