Vibeleaderboard
Index / tool
Visit onyx.app
Category
AI Tools
Rank
No. 1492Tools index
Pricing
Open Source
Type
TOOL
GitHub
28 stars
Date

About

Secure and lightweight Python code execution environment for LLMs.

What it does

Onyx runs submitted Python inside disposable containers, then returns output, errors, status, timing, and created files through a REST service. It supports uploaded inputs, streamed results, notebook-like display of a final expression, and longer-lived sessions for related commands.

Why it's ranked here

This is a strong, practical interpreter service because isolation is visible in the implementation, not merely promised. Container processes lose most capabilities, run without privilege escalation, receive memory and process limits, and default to no network access. Docker and Kubernetes backends broaden its operational fit, while end-to-end tests cover execution and file artifacts.

What's good

Resource controls cover wall-clock timeout, CPU time, memory, process count, and output size. Relative-path validation rejects traversal, workspaces use temporary storage, and generated files return through managed identifiers. The API offers synchronous and streamed execution, health reporting, file exchange, and expiring sessions. Network access is disabled by default.

Tradeoffs

The recommended Docker setup mounts the host daemon socket and runs the service as root, so it belongs only in a trusted environment. The alternative requires a privileged container. Kubernetes network lockdown uses a privileged initialization step with network administration capability unless operators disable it. File storage is local, UUID-based disk storage rather than an external durable store.

How to use it well

Use it when an agent needs local Python analysis, plots, file transformations, or several commands within an expiring workspace. Choose Docker for simpler trusted deployments and Kubernetes for pod-based operation. Set conservative resource limits and preserve the default network block. It does not provide hosted execution, so you must operate the service and container infrastructure.

Technical notes+

code-interpreter/app/main.py builds the FastAPI service, exposes health and version metadata, pulls the Docker executor image during startup, and runs a 30-second expired-session reaper. code-interpreter/app/api/routes.py implements synchronous execution, Server-Sent Events streaming, file operations, sessions, and session Bash execution. code-interpreter/app/services/executor_factory.py selects Docker or Kubernetes. code-interpreter/app/services/executor_docker.py applies a 64-process limit, no-new-privileges, dropped capabilities with CHOWN restored, tmpfs workspaces, optional CPU and memory limits, and a default network selected in code-interpreter/app/app_configs.py as none. code-interpreter/app/services/executor_kubernetes.py runs as UID 65532, drops capabilities, uses bounded emptyDir volumes, and defaults to an init container that blocks IPv4 and IPv6 egress with NET_ADMIN. Its exit-code parser uses eval on an exec error-channel string, which deserves security scrutiny. code-interpreter/app/services/file_storage.py stores file bytes and JSON metadata on local disk. code-interpreter/tests/e2e/test_basic_flow.py exercises health, basic execution, edited inputs, generated plots, and multiple output files.

Observed

License
MIT License
Primary language
Python
Interface
FastAPI REST API with OpenAPI documentation and Server-Sent Events streaming
Packaging and install surface
Published Docker image with Docker-out-of-Docker and Docker-in-Docker launch options
Platform support
Docker and Kubernetes executor backends; Helm and Kubernetes deployment instructions are referenced
Execution model
Disposable isolated containers plus expiring long-lived sessions
Tests
Repository includes end-to-end tests for execution, uploaded files, generated PNG output, and multiple output files

Read from README.md, code-interpreter/app/main.py, code-interpreter/app/image_ref.py, code-interpreter/app/app_configs.py, code-interpreter/app/logging_config.py, code-interpreter/app/api/routes.py, code-interpreter/app/models/schemas.py, code-interpreter/app/services/file_storage.py, code-interpreter/app/services/executor_base.py, code-interpreter/app/services/executor_docker.py, code-interpreter/app/services/executor_factory.py, code-interpreter/app/services/executor_kubernetes.py, code-interpreter/tests/e2e/test_basic_flow.py, code-interpreter/tests/integration_tests/conftest.py.

What it can do

  • Execute Python code safely

    Python code or scriptExecution results and output

  • Validate Python syntax

    Python code stringSyntax validation results

  • Isolate code execution

    Potentially unsafe Python codeSandboxed execution environment

  • Process LLM-generated Python code

    Python code from language modelsSafe execution results

  • Run Python scripts with resource limits

    Python scriptControlled execution with safety constraints

Tags

sandboxcode-executionpythonllm

Tech Stack

DockerfileGo TemplatePythonShell

Media

Onyx Python Sandbox

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.