Skip to content

[REQUEST] Add Local Code Sandbox support #1528

@phanisarman

Description

@phanisarman

Feature Request

Is your feature request related to a problem? Please describe.

Python and JavaScript with npm packages currently require E2B (external cloud service), making them unavailable in air-gapped/restricted environments. This blocks enterprise deployments with compliance requirements that prohibit outbound traffic.

Describe the solution you'd like

Implement a local sandbox environment similar to DifySandbox with these capabilities:

Core Features:

  1. Multi-language support: Python and JavaScript/Node.js
  2. Dependency management:
    • Python: requirements.txt or inline declarations
    • JavaScript: package.json or inline imports
  3. Security isolation:
    • Seccomp-based system call filtering (whitelist policy)
    • File system isolation
    • Network isolation via Docker network/proxy
  4. Pre-configured packages: Common libraries (numpy, pandas, requests)
  5. Custom dependencies: Users can add packages via config

Configuration:

LOCAL_SANDBOX_ENABLED=true
LOCAL_SANDBOX_PYTHON_PACKAGES=numpy,pandas,requests,beautifulsoup4

Implementation approach (following Dify's architecture):

  • Isolated Docker containers with Seccomp security profiles
  • Dependency caching to avoid repeated installations
  • Network proxy for controlled external access (optional)
  • Resource limits (CPU, memory, timeout)

Describe alternatives you've considered

  1. E2B only - Requires internet access, not viable for air-gapped
  2. Basic execution without packages - Too limited for real-world use
  3. Dify solves this with DifySandbox - a local, secure code execution environment that runs Python and Node.js with custom dependencies in self-hosted deployments.

Additional context

Reference Implementation:

  • Dify's DifySandbox: https://github.com/langgenius/dify-sandbox
    • Supports Python 3.10+ and Node.js locally
    • Pre-installed dependencies with custom additions
    • Battle-tested in production self-hosted deployments
    • Built on Seccomp for system-level security

Use cases this enables:

  • Data processing with pandas/numpy
  • API integrations with custom libraries
  • ML inference with scikit-learn/transformers
  • Web scraping with beautifulsoup4
  • All in fully air-gapped environments

Impact:

  • Enables government, healthcare, financial deployments
  • ~30-40% of enterprise self-hosted market has network restrictions
  • Feature parity with Dify, n8n etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions