Dify Sandbox

Active
GitHub Go Apache-2.0

Description

A lightweight, fast, and secure code execution environment supporting multiple programming languages — provides sandboxed code execution for the Dify platform.

Key Features

  • Secure code execution sandbox — runs untrusted user code with restricted resources and system calls
  • Multi-tenant support — multiple users can submit code concurrently in isolated environments
  • Lightweight and fast — minimal overhead design optimized for container-based deployments
  • Docker-native architecture — built for Linux container environments with Go-based implementation
  • Resource isolation — enforces strict limits on CPU, memory, and filesystem access per execution
  • Dify platform integration — provides the code execution backbone for Dify's AI workflow engine

Use Cases

💡 AI-generated code execution — safely run code produced by LLMs in a constrained environment
💡 Dify workflow code nodes — execute custom code blocks within Dify AI application workflows
💡 Multi-tenant code playground — provide a safe code execution environment for platform users
💡 Educational coding platforms — run student-submitted code securely without host system risk
💡 Automated testing pipelines — execute untrusted test scripts in isolated containers

Quick Start

Clone the repo, run `./install.sh` to install dependencies (libseccomp, pkg-config, gcc, golang 1.20.6), then `./build/build_amd64.sh` (or arm64) to build the binary. Run `./main` to start the server.

Related Projects

Related Articles