The security argument makes sense in theory, but in practice the moment your agent needs to do anything interesting you're back to running real Python with real syscalls. seccomp + namespaces already solve this on Linux without rewriting the interpreter.
Monty: A minimal, secure Python interpreter written in Rust for use by AI
171–179 of 179 posts
Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#172Earlier quoted context omitted.
> Doesn't the agent already have bash though? You don't have to give it bash, depending on your tools at least. > So it can blow itself up and... I think that's about it? And exfiltrate data via the Internet, fill up disk space...
It can already exfiltrate stuff in a VM though right? Like people will run this thing in a sandboxed environment in docker in a VM but then hook it up to GMail and also feed it random web content (web search tool, Twitter integration etc.). I saw at least some interest in a better security model where for example instead of giving it the API keys, there's a broker that rewrites the curl requests and injects keys so t…
This seems like the right way to do it, but you still have to worry about what information the agent wants to send out. Especially if it could get prompt-injected. Email sounds to me like a complete no-go.
Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#173Earlier quoted context omitted.
It was better because it had no silent errors, like 1+”1”. Far from perfect, the fact it raised exceptions and enforced the philosophy of “don’t ask for permission but forgiveness” makes the difference. IMHO It’s irrelevant it has a slightly better typesystem and runtime but that’s totally irrelevant nowadays. With AI doing mostly everything we should forget these past riddles. Now we all should be looking towards fa…
Conflating types in binary operations hasn't been an issue for me since I started using TS in 2016. Even before that, it was just the result of domain modeling done badly, and I think software engineers got burned enough for using dynamic type systems at scale... but that's a discussion to be had 10 years ago. We all moved on from that, or at least I hope we did. > Now we all should be looking towards fail-safe syste…
> Is there any formal language that is usable as general-purpose programming language I don't know of?
That’s sort of my point, the closest thing to a rich type system yet pragmatic enough is to me F# and it’s still falls short as formal verification and ecosystem integration.
I think eventually, we should invest into this direction so LLM production can be trusted, or even ideally, producing or helping with the specific specifications of models. This is yet to be done.
I don’t want to make a prophecy, but the day, ergonomics and verification meet in an LLM automated framework, this new development environment should take over everything previous.
Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#174Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#175Earlier quoted context omitted.
Can we please make as little js as possible? Why would one drag this god forsaken abomination on server-side is beyond me. Even effing C# nowdays can be run in script-like manner from a single file. — Even the latest Codex UI app is Electron. The one that is supposed to write itself with AI wonders but couldn’t manage native swiftui, winui, and qt or whatever is on linux this days.
My favourite languages are F# and OCaml, and from my perspective, TypeScript is a far better language than C#. Typescript’s types are far more adaptable and malleable, even with the latest C# 15 which is belatedly adding Sum Types. If I set TypeScript to its most strict settings, I can even make it mimic a poor man’s Haskell and write existential types or monoids. And JS/TS have by far the best libraries and utilitie…
.NET’s LINQ to XML is unrivaled. String manipulation can be contested given the introduction of Spans.
Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#176Earlier quoted context omitted.
Not sure if this is what you are looking for, but here is Python compiled to WASM: https://pyodide.org/en/stable/ Web demo: https://pyodide.org/en/stable/console.html
No it's not. It's an "interpreter": The whole interpreter binary (in wasm) as well as the Python source is transferred to the client to be executed.
You'd have to compile every function for every possible combination of types, since the types of the function arguments can not be known at compile time without solving the halting problem. Even worse, new types could be created at runtime.
You can either type everything (like Cython, which arguably is not really Python anymore) or include a compiler to compile types that were not known at compile time, but that is just a JIT compiler with extra steps.
Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#177Earlier quoted context omitted.
No it's not. It's an "interpreter": The whole interpreter binary (in wasm) as well as the Python source is transferred to the client to be executed.
Oh, so you are looking for a real compiler. I do not think that it is possible to compile Python, since the language is just too dynamic. You'd have to compile every function for every possible combination of types, since the types of the function arguments can not be known at compile time without solving the halting problem. Even worse, new types could be created at runtime. You can either type everything (like Cyth…
Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#178This is a really interesting take on the sandboxing problem. This reminds me of an experiment I worked on a while back ( https://github.com/imfing/jsrun ), which embedded V8 into Python to allow running JavaScript with tightly controlled access to the host environment. Similar in goal to run untrusted code in Python. I’m especially curious about where the Pydantic team wants to take Monty. The minimal-interpreter app…
Can't be sure where this might end, but the primary goal is to enable codemode/programmatic tool calling, using the external function call mechanism for anything more complicated. I think in the near term we'll add support for classes, dataclasses, datetime, json. I think that should be enough for many use cases.
Re: Monty: A minimal, secure Python interpreter written in Rust for use by AI
#179Earlier quoted context omitted.
Oh, so you are looking for a real compiler. I do not think that it is possible to compile Python, since the language is just too dynamic. You'd have to compile every function for every possible combination of types, since the types of the function arguments can not be known at compile time without solving the halting problem. Even worse, new types could be created at runtime. You can either type everything (like Cyth…
But Python compilers exist, nuitka being a more famous one: https://en.wikipedia.org/wiki/Nuitka
> Standalone binaries built using the --standalone command line option include an embedded CPython interpreter to handle aspects of the language that are not determined when the program is compiled and must be interpreted at runtime, such as duck typing, exception handling, and dynamic code execution (the eval function and exec function or statement), along with those Python and native libraries that are needed for execution, leading to rather large file sizes.