# OpenSandbox: A Secure and Extensible Sandbox Runtime for AI Agents

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/alibaba-opensandbox
Generated for open source discovery and AI-assisted research.

OpenSandbox is a powerful, general-purpose sandbox platform designed for AI applications. It provides secure, fast, and extensible runtime environments, supporting multi-language SDKs and Docker/Kubernetes deployments. This project is ideal for developing and evaluating AI agents in isolated, controlled settings.

GitHub: https://github.com/alibaba/OpenSandbox
OSRepos URL: https://osrepos.com/repo/alibaba-opensandbox

## Summary

OpenSandbox is a powerful, general-purpose sandbox platform designed for AI applications. It provides secure, fast, and extensible runtime environments, supporting multi-language SDKs and Docker/Kubernetes deployments. This project is ideal for developing and evaluating AI agents in isolated, controlled settings.

## Topics

- ai
- ai-agent
- ai-infra
- kubernetes
- sandbox
- python
- development-tools
- security

## Repository Information

Last analyzed by OSRepos: Wed Aug 12 2026 20:21:20 GMT+0100 (Western European Summer Time)
Detail views: 1
GitHub clicks: 0

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

OpenSandbox is a robust, general-purpose sandbox platform tailored for AI applications, offering secure, fast, and extensible runtime environments. It provides multi-language SDKs, unified sandbox APIs, and Docker/Kubernetes runtimes, making it suitable for diverse scenarios such as Coding Agents, GUI Agents, Agent Evaluation, AI Code Execution, and Reinforcement Learning (RL) Training.

Key features include strong isolation, comprehensive network policies, and a secure credential vault, ensuring a robust and protected environment for your AI workloads. Built with scalability in mind, OpenSandbox supports both local development and large-scale distributed scheduling.

## Installation

Getting started with OpenSandbox involves installing its SDKs, CLI, and setting up the server.

**Python SDK:**

bash
pip install opensandbox


**OpenSandbox CLI:**

bash
pip install opensandbox-cli


**Install and Configure the Sandbox Server:**

bash
uvx opensandbox-server init-config ~/.sandbox.toml --example docker
uvx opensandbox-server


## Examples

OpenSandbox provides a rich set of examples to help you get started, covering SDK usage, agent integrations, browser automation, and training workloads. Here's a quick look at using the Code Interpreter SDK:

**Code Interpreter Example (Python):**

python
import asyncio
from datetime import timedelta

from code_interpreter import CodeInterpreter, SupportedLanguage
from opensandbox import Sandbox
from opensandbox.models import WriteEntry

async def main() -> None:
    # 1. Create a sandbox
    sandbox = await Sandbox.create(
        "opensandbox/code-interpreter:v1.1.0",
        entrypoint=["/opt/code-interpreter/code-interpreter.sh"],
        env={"PYTHON_VERSION": "3.11"},
        timeout=timedelta(minutes=10),
    )

    async with sandbox:

        # 2. Execute a shell command
        execution = await sandbox.commands.run("echo 'Hello OpenSandbox!'")
        print(execution.logs.stdout[0].text)

        # 3. Write a file
        await sandbox.files.write_files([
            WriteEntry(path="/tmp/hello.txt", data="Hello World", mode=644)
        ])

        # 4. Read a file
        content = await sandbox.files.read_file("/tmp/hello.txt")
        print(f"Content: {content}") # Content: Hello World

        # 5. Create a code interpreter
        interpreter = await CodeInterpreter.create(sandbox)

        # 6. Execute Python code (single-run, pass language directly)
        result = await interpreter.codes.run(
              """
                  import sys
                  print(sys.version)
                  result = 2 + 2
                  result
              """,
              language=SupportedLanguage.PYTHON,
        )

        print(result.result[0].text) # 4
        print(result.logs.stdout[0].text) # 3.11.14

        # 7. Cleanup the sandbox
        await sandbox.kill()

if __name__ == "__main__":
    asyncio.run(main())


OpenSandbox also provides examples for browser automation (e.g., Chrome, Playwright), desktop environments (VNC, VS Code), and various coding agent integrations. You can explore these and more in the project's `examples/` directory.

## Why Use OpenSandbox?

*   **Enhanced Security**: OpenSandbox prioritizes security with strong isolation mechanisms, supporting secure container runtimes like gVisor, Kata Containers, and Firecracker microVMs. It also includes a Credential Vault for secure secret injection and comprehensive network policies, protecting your workloads from potential threats.
*   **Flexibility and Scalability**: With multi-language SDKs (Python, Java, JavaScript, C#, Go) and robust support for both Docker and Kubernetes runtimes, OpenSandbox is highly flexible. It scales seamlessly from local development to large-scale distributed deployments, making it ideal for diverse AI infrastructure needs.
*   **AI-Centric Design**: Specifically designed for AI applications, OpenSandbox streamlines the development, testing, and evaluation of AI agents. It provides built-in environments for code interpretation, file operations, and command execution, which are essential for modern AI workflows and agent development.

## Links

*   **GitHub Repository**: [OpenSandbox GitHub](https://github.com/opensandbox-group/OpenSandbox "OpenSandbox GitHub")
*   **Official Documentation**: [OpenSandbox Documentation](https://github.com/opensandbox-group/OpenSandbox/tree/main/docs "OpenSandbox Documentation")
*   **Discord Community**: [Join OpenSandbox Discord](https://discord.gg/g7FuPs8YeD "Join OpenSandbox Discord")