Which Jupyter Kernels Are Supported by OpenSandbox for Multi-Language Code Execution

OpenSandbox supports five Jupyter kernels: Python (ipykernel), Java (IJava), TypeScript/JavaScript (tslab), Go (gonb), and Bash (bash_kernel), enabling secure, multi-language code execution through a unified Jupyter server backend.

OpenSandbox is an open-source sandbox environment developed by Alibaba that enables safe execution of arbitrary code across multiple programming languages. At the core of its polyglot execution capability lies a Jupyter server that orchestrates language-specific kernels within containerized sandboxes. Understanding which Jupyter kernels are supported by OpenSandbox helps developers leverage the correct runtime for their specific use cases, from data science with Python to systems scripting with Bash.

Supported Jupyter Kernels

OpenSandbox ships with a pre-configured set of Jupyter kernels that map programming languages to concrete kernel implementations. These kernels are installed in the sandboxes/code-interpreter Docker image and registered during container startup, as documented in sandboxes/code-interpreter/README.md.

Python (ipykernel)

Python execution relies on the standard ipykernel package. The sandbox supports multiple Python versions, with each version registering its own kernel instance. According to the sandboxes/code-interpreter/README.md, the Python kernel provides full access to the scientific Python stack installed in the container.

Java (IJava)

Java code runs through the IJava kernel, which compiles and executes Java snippets via the JDK installed in the sandbox. This kernel supports standard Java syntax and library imports, making it suitable for algorithmic challenges and object-oriented code execution.

TypeScript and JavaScript (tslab)

TypeScript and JavaScript execution uses the tslab kernel, which requires Node.js. This kernel transpiles TypeScript to JavaScript on-the-fly and executes both languages within the same runtime environment, enabling modern web development workflows inside the sandbox.

Go (gonb)

Go programs execute via the gonb kernel, which provides a notebook interface for the Go programming language. This kernel compiles Go source files using the Go toolchain installed in the container and streams compilation errors or execution output back to the caller.

Bash (bash_kernel)

Bash scripting is supported through bash_kernel, allowing execution of shell commands and scripts. This kernel enables system administration tasks, file manipulation, and command-line utility testing within the isolated sandbox environment.

Kernel Integration Architecture

The integration of these Jupyter kernels follows a structured pipeline from image build to API exposure. Each component in the alibaba/OpenSandbox repository plays a specific role in kernel lifecycle management.

Docker Image Build Process

The sandboxes/code-interpreter/Dockerfile installs all five kernel implementations during image construction. The build process explicitly installs ipykernel for Python, IJava for Java, tslab for Node.js-based languages, gonb for Go, and bash_kernel for shell scripting. This ensures that every OpenSandbox container instance contains the complete multi-language runtime environment.

Jupyter Server Startup

The sandboxes/code-interpreter/scripts/code-interpreter.sh script launches the Jupyter server during container initialization. This startup script registers all installed kernels with the Jupyter environment and exposes the Jupyter HTTP API on a configurable host, port, and authentication token. The server acts as the central dispatcher for all code execution requests.

Runtime Kernel Discovery

The Go component components/execd/pkg/runtime/jupyter.go handles kernel selection and session management. When a code execution request arrives, the searchKernel function discovers the appropriate kernel name for the requested language (e.g., mapping "python" to the ipykernel instance). This component creates isolated Jupyter sessions and streams execution results, including stdout, stderr, and return codes, back to the calling process.

API and SDK Integration

The OpenSandbox REST API defined in specs/execd-api.yaml (specifically around line 221) accepts a language field in execution requests. The Python SDK implementation in sdks/sandbox/python/src/opensandbox/api/execd/api/code_interpreting/run_code.py wraps this API, allowing developers to specify the target language programmatically. The API forwards requests to the Execd controller, which delegates to the Jupyter runtime for actual execution.

Multi-Language Execution Examples

Developers interact with these kernels through SDKs or direct HTTP calls, specifying the target language in each request. The following examples demonstrate how to invoke specific kernels using the OpenSandbox Python SDK and raw HTTP requests.

Running Python Code via SDK

Use the run_code method from the ExecdClient class to send Python code to the ipykernel:

from opensandbox.api.execd import ExecdClient

client = ExecdClient(base_url="http://localhost:8000")
resp = client.run_code(
    language="python",
    code="print('Hello from Python')"
)
print(resp.output)

Running Java Code via SDK

The same run_code method accepts Java source code when you specify language="java":

java_code = """
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello from Java");
    }
}
"""
resp = client.run_code(language="java", code=java_code)
print(resp.output)

Direct HTTP API Requests

Send a POST request to the /execd/v1/code endpoint with the target language and code payload:

curl -X POST http://localhost:8000/v1/code \
     -H "Content-Type: application/json" \
     -d '{"language":"typescript","code":"console.log(`Hello from TS`);"}'

The server routes this request to the tslab kernel, executes the TypeScript snippet, and streams the output back to the client.

Configuring Runtime Versions

Override default language versions by passing environment variables to the container runtime:

docker run -it --rm \
  -e PYTHON_VERSION=3.12 \
  -e JAVA_VERSION=21 \
  -e NODE_VERSION=22 \
  -e GO_VERSION=1.25 \
  opensandbox/code-interpreter:latest

The container’s entrypoint installs the requested versions and registers the corresponding Jupyter kernels before starting the server.

Summary

OpenSandbox provides a unified execution environment through these key architectural components:

Frequently Asked Questions

Which programming languages can I execute in OpenSandbox?

OpenSandbox supports Python, Java, TypeScript, JavaScript, Go, and Bash. Each language maps to a specific Jupyter kernel—ipykernel for Python, IJava for Java, tslab for TypeScript/JavaScript, gonb for Go, and bash_kernel for Bash scripts. This multi-kernel architecture enables polyglot code execution within a single sandbox instance.

How does OpenSandbox select the correct Jupyter kernel for a request?

The searchKernel function in components/execd/pkg/runtime/jupyter.go maps the requested language identifier (e.g., "python" or "java") to the corresponding kernel name. This discovery mechanism ensures that code sent to the /execd/v1/code endpoint executes in the appropriate runtime environment. The mapping logic handles kernel lifecycle management and session isolation automatically.

Can I customize the versions of languages available in OpenSandbox?

Yes. When launching the Docker container, set environment variables such as PYTHON_VERSION, JAVA_VERSION, NODE_VERSION, or GO_VERSION. The container's entrypoint installs the specified versions and registers them as Jupyter kernels before starting the server. This allows precise control over the runtime environment for each programming language.

What Jupyter-specific features are available during code execution?

OpenSandbox leverages the full Jupyter protocol, enabling streaming output for real-time logs, interrupt handling for terminating long-running processes, and multi-session reuse for maintaining state across multiple execution requests within the same sandbox instance. These capabilities provide a robust interactive computing environment comparable to native Jupyter notebooks.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →