llm-sandbox  by vndee

LLM code execution sandbox using Docker containers

Created 1 year ago
1,009 stars

Top 36.7% on SourcePulse

GitHubView on GitHub
Project Summary

This library provides a lightweight and portable sandbox runtime for executing LLM-generated code securely using Docker containers. It's designed for developers and researchers who need to safely run code snippets from LLMs in isolated environments, supporting multiple programming languages and offering flexibility through custom Dockerfiles and integrations with AI frameworks like Langchain and LlamaIndex.

How It Works

The core of the library is the SandboxSession class, which manages the lifecycle of Docker containers for code execution. It leverages Docker to create isolated environments, allowing for the execution of code in various languages (Python, Java, JavaScript, C++, Go, Ruby) within a controlled setup. The approach emphasizes ease of use, portability via predefined or custom Docker images, and scalability with support for Kubernetes and remote Docker hosts.

Quick Start & Requirements

  • Install via pip: pip install llm-sandbox or with extras: pip install llm-sandbox[kubernetes], pip install llm-sandbox[podman], pip install llm-sandbox[docker].
  • Requires Docker or Podman to be installed and running.
  • Kubernetes support requires kubernetes Python package and a configured Kubernetes cluster.
  • See examples for detailed usage: README examples

Highlighted Details

  • Supports Python, Java, JavaScript, C++, Go, and Ruby.
  • Integrates with Langchain and LlamaIndex for AI agent code execution.
  • Offers Kubernetes and remote Docker host support.
  • Allows file copying between host and sandbox.

Maintenance & Community

  • Contributions are welcomed, with areas for improvement including more languages, security enhancements, and AI framework integrations.
  • Changelog available at CHANGELOG.md.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The project is actively seeking contributions for enhancements such as improved resource monitoring accuracy and container pooling for performance. Specific security scanning patterns and distributed execution capabilities are listed as areas for future development.

Health Check
Last Commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
2
Star History
89 stars in the last 30 days

Explore Similar Projects

Starred by Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), Tim J. Baek Tim J. Baek(Founder of Open WebUI), and
1 more.

harbor by av

4.1%
3k
CLI tool for local LLM stack orchestration
Created 1 year ago
Updated 2 days ago
Starred by Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm) and Tom Moor Tom Moor(Head of Engineering at Linear; Founder of Outline).

chatgpt-telegram by m1guelpf

0%
4k
Telegram bot CLI tool for ChatGPT interaction
Created 3 years ago
Updated 3 years ago
Starred by Junyang Lin Junyang Lin(Core Maintainer at Alibaba Qwen), Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research), and
2 more.

OpenSandbox by alibaba

1.9%
10k
Sandbox platform for AI and LLM applications
Created 3 months ago
Updated 21 hours ago
Feedback? Help us improve.