skillfed

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.

llm-sandbox v0.3.44 661.6K downloads/30d#5,448 on PyPI1,104
License unclear Active released

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-sandbox

uv

uv add llm-sandbox

poetry

poetry add llm-sandbox

Installing 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

Intended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Libraries :: Python Modules

Tags

llm code execution sandboxsecure container code runnerai-generated code isolationmulti-language code sandboxdocker-based code execution
llm-integrationcode-executioncontainerization

More Python Modules packages

Further reading