Code Execution
Safe, multi-language code execution in isolated containers
Modbox is an excellent foundation for platforms that need to execute user-submitted or LLM-generated code safely. Each execution runs in a completely isolated container — no shared filesystem, no shared network, no shared processes.
Use cases
- 🎓 Education platforms — Let students run code exercises safely
- 🧑💻 Online IDEs / REPLs — Persistent environments per user session
- 🤖 LLM tool calls — Give your LLM a
run_codetool backed by a real sandbox - 🔬 Data science notebooks — Isolated Python/R kernels per user
Single execution (stateless)
For simple, one-shot code execution, provision a sandbox, run the code, and destroy:
Session-based execution (stateful)
For online IDEs or multi-step notebooks, keep a sandbox alive per user session so state persists between executions:
LLM tool call integration
Give your LLM a run_code tool backed by a Modbox sandbox:
Supported languages
Languages available depend on your image. The default Modbox code execution image includes:
Bring your own Docker image to support any language or runtime. See the Images guide.