feat: code execution pipeline #27

Open
opened 2026-02-15 19:15:04 -05:00 by yindo · 3 comments
Owner

Originally created by @tjbck on GitHub (Jun 1, 2024).

Originally created by @tjbck on GitHub (Jun 1, 2024).
Author
Owner

@EtiennePerot commented on GitHub (Jul 7, 2024):

Adding a code generation pipeline to Open WebUI would be amazing, but it needs to be securely sandboxed. Even if the generated code is harmless, it's easy for it to accidentally pull in a dependency that executes remote code.

I work on gVisor, which is what ChatGPT uses for sandboxing code execution (as proof, try to make it run the dmesg command in its code execution environment). I use Open WebUI myself on my home server, and would love if it supported code execution. Let me know if I can help or assist here.

@EtiennePerot commented on GitHub (Jul 7, 2024): Adding a code generation pipeline to Open WebUI would be amazing, but it needs to be securely sandboxed. Even if the generated code is harmless, it's easy for it to accidentally pull in a dependency that executes remote code. I work on [gVisor](https://gvisor.dev), which is what ChatGPT uses for sandboxing code execution (as proof, try to [make it run the `dmesg` command in its code execution environment](https://drive.google.com/file/d/1jjqrV76-86rdEcmFNnxMs4lI-ncAookn/view?usp=sharing)). I use Open WebUI myself on my home server, and would love if it supported code execution. Let me know if I can help or assist here.
Author
Owner

@justinh-rahb commented on GitHub (Jul 7, 2024):

We have come to an internal agreement that we definitely need a sandbox of some kind. More ideas are always welcome, thanks @EtiennePerot

@justinh-rahb commented on GitHub (Jul 7, 2024): We have come to an internal agreement that we definitely need a sandbox of some kind. More ideas are always welcome, thanks @EtiennePerot
Author
Owner

@EtiennePerot commented on GitHub (Aug 26, 2024):

I have created a sandboxed code execution tool (Bash and Python both supported) and uploaded it to GitHub and to the Open WebUI portal. It uses gVisor to isolate the host system from the arbitrary code running in the sandbox. Network access can be selectively enabled. To avoid overloading the system, it supports limiting execution to a maximum number of seconds, and optionally limiting the memory the code is allowed to use. Let me know what you think.

Code execution tool

One thing I'm confused about is how this can be practically used in the context of Open WebUI pipelines. As far as I can tell, these don't have access to the tools (or at least not yet?).

For now, I can use the tool locally, and it runs inside the Open WebUI container itself. This is fine for my needs as I am the sole user of my own instance, but please let me know if there is a better way to integrate this.

@EtiennePerot commented on GitHub (Aug 26, 2024): I have created a sandboxed code execution tool (Bash and Python both supported) and [uploaded it to GitHub](https://github.com/EtiennePerot/open-webui-code-execution) and to [the Open WebUI portal](https://openwebui.com/t/etienneperot/run_code/). It uses [gVisor](https://gvisor.dev) to isolate the host system from the arbitrary code running in the sandbox. Network access can be selectively enabled. To avoid overloading the system, it supports limiting execution to a maximum number of seconds, and optionally limiting the memory the code is allowed to use. Let me know what you think. ![Code execution tool](https://github.com/EtiennePerot/open-webui-code-execution/blob/master/res/code-execution-tool.gif?raw=true) One thing I'm confused about is how this can be practically used in the context of Open WebUI pipelines. As far as I can tell, these don't have access to the tools ([or at least not yet?](https://github.com/open-webui/open-webui/issues/3718)). For now, I can use the tool locally, and it runs inside the Open WebUI container itself. This is fine for my needs as I am the sole user of my own instance, but please let me know if there is a better way to integrate this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/pipelines#27