If you're interested in not reinventing the sandbox for LLMs, consider Judge0: <a href="https://judge0.com/" rel="nofollow">https://judge0.com/</a><p>I have absolutely no relation to the project except for the fact that I went to the same Uni as the creator.
Hey simonw, if you're reading this, you should check out <a href="https://github.com/dbohdan/starlark-python" rel="nofollow">https://github.com/dbohdan/starlark-python</a>. It's an AI port of starlark/java to pure Python inspired by your work. theanonymousone might want to give it a look, too.<p>The project was inspired by <a href="https://github.com/simonw/micro-javascript" rel="nofollow">https://github.com/simonw/micro-javascript</a> (a C-to-Python port of MicroQuickJS) and Simon Willison's quest for sandboxed Python. Not only that, but I used the Claude Code transcript he published to generate a playbook the porting agent then followed. I wrote up the port at <a href="https://dbohdan.com/starlark-python" rel="nofollow">https://dbohdan.com/starlark-python</a>.<p>I considered whether to port MicroPython, PocketPy, or a Starlark implementation to Python. I ultimately stuck with Starlark because it was designed for untrusted code and had a conformance test suite. This looked about as optimized for agentic coding as a problem could get. While Starlark is more restrictive than MicroPython or PocketPy, I consider my needs for configuration and safe scripting currently satisfied (see #users in the README).
I am trying to think of a use case for this.<p>I was thinking the client side WASM version would be useful as a platform for beginners to practice a subset of Python in.<p>I can't really think of any good WASI use cases.
P.S. I was casually searching for "sandboxed Python" for an experiment I'm working on, and reached this article that was published "today". Very nice coincidence! Thanks.