LLM Sandbox
A self-hosted code interpreter Python library that runs AI-generated code in Docker, Podman or Kubernetes and captures generated plots.

LLM Sandbox is a Python library for developers whose AI agents or applications need to execute generated code. It puts execution in containers on infrastructure you control, with support for local deployments and Kubernetes clusters.
- Execution controls: Isolate code in containers, limit CPU, memory and execution time, and control its network access.
- Multiple languages: Run Python, JavaScript, Java, C++ and Go code, with dependency management for generated programs.
- Files and visualizations: Capture generated plots automatically and transfer files into and out of the sandbox for analysis and other code tasks.
- Persistent Python sessions: Keep interpreter state between calls for notebook-style work, while container pooling reuses prepared environments to reduce startup overhead for frequent execution.
- Assistant integration: Give MCP clients such as Claude Desktop access to sandboxed code execution and generated visualizations, or connect applications built with LangChain, LangGraph and LlamaIndex.
The project is open source under the MIT license. It supports Docker, Podman and Kubernetes; Podman can run containers without root privileges. Custom container images let applications supply their own execution environments. Persistent interactive sessions target Python and work across all three backends.
The project also provides integration examples for the OpenAI Agents SDK and Claude Agent SDK.