LLM Sandbox
NormalDescription
Lightweight and portable LLM sandbox runtime Python library — provides a code interpreter for safely executing AI agent-generated code in isolated environments.
Key Features
- Secure Isolated Execution: Code runs in isolated containers with no host system access, supports custom security policies and resource limits
- Multiple Container Backends: Supports Docker, Kubernetes, and Podman container backends for different deployment environments
- Multi-Language Support: Supports Python, JavaScript/Node.js, Java, C++, Go, R with automatic dependency management
- LLM Framework Integration: Seamless integration with LangChain, LangGraph, LlamaIndex, OpenAI and other major frameworks
- MCP Protocol Support: Runs as an MCP server, allowing clients like Claude Desktop to execute code in the sandbox
- Advanced Features: Supports chart capture, dynamic library installation, file operations, container pooling, and interactive sessions
Use Cases
Categories
Quick Start
1. Install: pip install 'llm-sandbox[docker]'
2. Basic usage: from llm_sandbox import SandboxSession
3. Create session and run code: with SandboxSession(lang="python") as session: result = session.run("print('Hello')")
4. Install libraries: session.run(code, libraries=["numpy"])