Skip to content
Skillpedia
● Free and open sourceπŸ’» LocalπŸ”“ No API keyProgramming

LLM Sandbox

Lets your AI agent run code it wrote inside an isolated container or local sandbox, in several languages.

1.1k stars on GitHubby vndeeLicense MITUpdated 18 days ago

How to install

This MCP is local: it runs on your computer.

It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Code…). Choose your app:

Paste in the terminal:

claude mcp add llm-sandbox -- uvx --from "llm-sandbox[mcp-docker]" llm-sandbox

What to fill in

NameWhat it isRequired
BACKENDContainer backend to use. Must match the installed extra: mcp-docker, mcp-podman, or mcp-k8s.No
DOCKER_HOSTDocker or Podman socket URL, e.g. unix:///var/run/docker.sockNo
KUBECONFIGPath to kubeconfig file when BACKEND=kubernetes.No
NAMESPACEKubernetes namespace used for sandbox pods when BACKEND=kubernetes.No
COMMIT_CONTAINERCommit the container after a run so installed libraries persist between sessions.No
KEEP_TEMPLATEKeep the base image after the session ends to avoid re-pulling it on the next run.No
SANDBOX_NETWORK_MODENetwork mode for the sandbox container. Set to 'none' for hardened isolation. Docker and Podman backends only.No
SANDBOX_READ_ONLYMount the sandbox root filesystem read-only. Recommended: true. Docker and Podman backends only.No
SANDBOX_CAP_DROPComma-separated Linux capabilities to drop. Recommended: ALL. Docker and Podman backends only.No
SANDBOX_SECURITY_OPTComma-separated container security options, e.g. no-new-privileges. Docker and Podman backends only.No
SANDBOX_MEMORYMemory limit for the sandbox container, e.g. 4g. Docker and Podman backends only.No
SANDBOX_CPUSFractional CPU allocation for the sandbox container, e.g. 1.5. Docker and Podman backends only.No

Ready! Now test it

Restart the app and paste one of these requests in the chat:

Run this Python script in a sandbox and show me the output.
Install pandas in the sandbox and summarize this data.

What it is

LLM Sandbox runs code generated by an AI model in an isolated environment, so it cannot freely touch your computer. It supports container backends such as Docker, Kubernetes and Podman, and local backends such as Bubblewrap and NsJail. The project also includes an MCP server so clients like Claude Desktop can run code safely.

What it can do

  • Run code in a sandbox in Python, JavaScript, Java, C++, Go or R
  • Install libraries on the fly before running code
  • Copy files into and out of the sandbox
  • Capture plots and charts as files
  • Keep an interactive Python session between runs
  • Set CPU, memory and time limits, and control network access

When to use

  • β€ΊWhen you want an AI to run the code it wrote without trusting it on your machine
  • β€ΊWhen you want charts or data analysis produced in a throwaway environment
  • β€ΊWhen you want to try small programs in several languages safely

What you need

You need Python and an isolation backend, such as Docker, Podman, Kubernetes, or on Linux Bubblewrap or NsJail. Install it with pip install llm-sandbox, with an extra like docker for container support.

Skills that pair well

⭐ Skillpedia MCP Β· freeYour agent finds the right skill on its ownInstall our MCP and your agent searches 15,000+ skills whenever it needs one.Install for free β†’

Frequently asked questions

Is it free and open source?

It is a Python library on PyPI with a documentation site. The readme does not mention a price.

Which backends are supported?

Docker, Kubernetes, Podman, Bubblewrap and NsJail. There are also experimental Windows adapters (Windows MXC and WSL2 Bubblewrap).

Is it as strong as a virtual machine?

No for the local Linux backends. The readme says they share the host kernel and are not a VM boundary.

Is the network open inside the sandbox?

You control it. The local backends disable network access by default, and the Windows adapters default to disabled networking.

Which languages can run?

The readme lists Python, JavaScript or Node.js, Java, C++, Go and R.

Can it work with agent frameworks?

The repository has runnable examples for eleven agent frameworks, including LangChain, CrewAI and the Claude Agent SDK.

If it does not work

  • β€ΊCheck that Docker, Podman or your chosen backend is installed and running before starting a session.
  • β€ΊFor Bubblewrap on Linux, make sure the version is 0.8.0 or newer and that your host allows unprivileged user namespaces.
  • β€ΊOn Windows without Docker, check the prerequisites in the backend setup guide, since the Windows adapters do not install an OS runtime.

5 new skills a week. 1 minute to read.