llm-sandbox
LLM Sandbox is a lightweight and portable sandbox environment designed to run large language model (LLM) generated code in a safe and isolated mode.
What it is and what it does
LLM Sandbox is a lightweight execution environment that runs code generated by large language models inside isolated containers, protecting the host system from untrusted or malicious code. It abstracts away container orchestration details and provides a unified Python API for spawning sandboxed sessions across multiple backends (Docker, Kubernetes, Podman) and programming languages (Python, JavaScript, Java, C++, Go, R).
The package is designed to integrate with LLM agent frameworks and Claude Desktop via the Model Context Protocol. It handles dependency installation, resource limits (CPU, memory, execution time), network isolation, and artifact extraction (plots, visualizations). Interactive sessions maintain state across multiple code runs, simulating notebook-style workflows. The single runtime dependency is pydantic, and it supports Python 3.10 through 3.13.
Use it for:
- Run code snippets generated by Claude, ChatGPT, or other LLMs without exposing your system to untrusted execution.
- Execute multi-language code (Python, JavaScript, Java, C++, Go, R) in a unified interface for polyglot AI agent workflows.
- Extract and save plots and visualizations generated by sandboxed Python or R code automatically.
- Deploy scalable code execution for AI agent frameworks (LangChain, CrewAI, Pydantic AI, etc.) with resource limits and security policies.
- Maintain state across multiple code executions in interactive Python sessions without manual serialization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Executes code generated by large language models in isolated container environments (Docker, Kubernetes, or Podman) with configurable security policies, resource limits, and support for Python, JavaScript, Java, C++, Go, and R.
Yes, with conditions. Install if you need to safely execute LLM-generated code and have a container backend (Docker, Kubernetes, or Podman) available. The package is actively maintained, has low install friction, and integrates well with popular LLM frameworks. However, verify the unclear license terms before use in proprietary contexts, and ensure your deployment environment supports containerization.
Install
llm-sandbox on PyPI
pip
pip install llm-sandboxuv
uv add llm-sandboxpoetry
poetry add llm-sandboxInstalling llm-sandbox
Before you install
Low friction installation with a single runtime dependency (pydantic). Active maintenance with recent releases; last commit 2026-08-14 and 1104 repository stars indicate ongoing development.
License in practice
License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms in the repository before adopting in proprietary or restricted-use contexts.
Quickstart
pip install llm-sandbox
from llm_sandbox import SandboxSession
with SandboxSession(lang="python") as session:
result = session.run('print("Hello from sandbox")')
print(result.stdout)
Requires a container backend (Docker, Kubernetes, or Podman) installed and running on the host system; Python 3.10 or later.
Verify before relying
- Whether the unclear license permits commercial or proprietary use without restrictions.
- Performance overhead and startup time for container initialization in production workflows.
- Security audit status and third-party validation of the isolation guarantees claimed.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pydantic |
| Maintenance | actively maintained — 11 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 661,557/month — #5,448 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: llm_sandbox-0.3.44-py3-none-any.whl
Keywords: python
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
cwsandboxA Python client library for running and…
permissive · top 15,000 on PyPI
e2b-code-interpreterRuns AI-generated or arbitrary Python code in…
permissive · top 5,000 on PyPI
e2bE2B provides a Python SDK to create and control…
permissive · top 5,000 on PyPI
hyperlight-sandboxHyperlight-sandbox provides a Python API for…
permissive · top 15,000 on PyPI
contree-sdkPython SDK for ConTree, a container runtime…
permissive · top 15,000 on PyPI
langchain-daytonaIntegrates Daytona sandboxes with LangChain's…
permissive · top 15,000 on PyPI
k8s-agent-sandboxA Python client library for creating and…
permissive · top 15,000 on PyPI
langchain-azure-dynamic-sessionsProvides LangChain integration tools to execute…
permissive · top 15,000 on PyPI
pydantic-ai-backendProvides sandboxed execution and file…
permissive · top 15,000 on PyPI
deepagents-codeA terminal-based AI coding agent that works…
permissive · top 15,000 on PyPI