Running Python code in a sandbox with MicroPython and WASM
28 points
3 hours ago
| 4 comments
| simonwillison.net
| HN
incognito124
45 minutes ago
[-]
If you're interested in not reinventing the sandbox for LLMs, consider Judge0: https://judge0.com/

I have absolutely no relation to the project except for the fact that I went to the same Uni as the creator.

reply
era86
36 minutes ago
[-]
I'm using judge0 for a Leetcode-clone I'm working on. Never thought of using it in the context of LLMs, though.
reply
hmokiguess
19 minutes ago
[-]
Super tangential comment but glad to see I'm not the only one that send typos to sessions and still get good results.

Was reading your https://chatgpt.com/share/6a1e2a5c-58b8-8328-ba1c-0e6aadb0a0... and noticed the "my on Python tools" instead of "my own Python tools" (apologies for the grammar police)

This stuff always gets me anxious for no reason because of the underlying tokenizer and prediction stochastic parrot that runs stuff, makes me wonder if I should rerun the prompt correcting the typo or accept the token tax on some interpreter that spent translating the intention.

reply
tmaly
1 hour ago
[-]
I am trying to think of a use case for this.

I was thinking the client side WASM version would be useful as a platform for beginners to practice a subset of Python in.

I can't really think of any good WASI use cases.

reply
andrewaylett
31 minutes ago
[-]
Running arbitrary untrusted code safely is pretty easy nowadays, so long as the code is written in Javascript and you want to run it in a browser. It's only a little harder if the code is written in another language but targets WASM and browser APIs, or if you want to run your WASM inside of NodeJS, and there's even good support for running Python in a browser or Node.

Once you get away from running in a JS environment or away from code that's written with the intention of running in a WASM sandbox, if you don't want to have to modify the code for your environment then you're going to start having problems. This looks like a good step for anyone wanting to run arbitrary Python outside of a browser environment.

reply
theanonymousone
59 minutes ago
[-]
For me it is a tool I avail to an LLM so that it can provide correct answers to a certain category of questions, instead of hallucinating nonsense.
reply
roywiggins
35 minutes ago
[-]
The idea is to expose it as a tool to your LLM agent so it can run calculations on its own initiative.
reply
theanonymousone
3 hours ago
[-]
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.
reply