{"name":"OpenSandbox: A Secure and Extensible Sandbox Runtime for AI Agents","description":"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","url":"https://osrepos.com/repo/alibaba-opensandbox","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/alibaba-opensandbox","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/alibaba-opensandbox.md","json":"https://osrepos.com/repo/alibaba-opensandbox.json","topics":["ai","ai-agent","ai-infra","kubernetes","sandbox","python","development-tools","security"],"keywords":["ai","ai-agent","ai-infra","kubernetes","sandbox","python","development-tools","security"],"stars":null,"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.","content":"## Introduction\n\nOpenSandbox 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.\n\nKey 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.\n\n## Installation\n\nGetting started with OpenSandbox involves installing its SDKs, CLI, and setting up the server.\n\n**Python SDK:**\n\nbash\npip install opensandbox\n\n\n**OpenSandbox CLI:**\n\nbash\npip install opensandbox-cli\n\n\n**Install and Configure the Sandbox Server:**\n\nbash\nuvx opensandbox-server init-config ~/.sandbox.toml --example docker\nuvx opensandbox-server\n\n\n## Examples\n\nOpenSandbox 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:\n\n**Code Interpreter Example (Python):**\n\npython\nimport asyncio\nfrom datetime import timedelta\n\nfrom code_interpreter import CodeInterpreter, SupportedLanguage\nfrom opensandbox import Sandbox\nfrom opensandbox.models import WriteEntry\n\nasync def main() -> None:\n    # 1. Create a sandbox\n    sandbox = await Sandbox.create(\n        \"opensandbox/code-interpreter:v1.1.0\",\n        entrypoint=[\"/opt/code-interpreter/code-interpreter.sh\"],\n        env={\"PYTHON_VERSION\": \"3.11\"},\n        timeout=timedelta(minutes=10),\n    )\n\n    async with sandbox:\n\n        # 2. Execute a shell command\n        execution = await sandbox.commands.run(\"echo 'Hello OpenSandbox!'\")\n        print(execution.logs.stdout[0].text)\n\n        # 3. Write a file\n        await sandbox.files.write_files([\n            WriteEntry(path=\"/tmp/hello.txt\", data=\"Hello World\", mode=644)\n        ])\n\n        # 4. Read a file\n        content = await sandbox.files.read_file(\"/tmp/hello.txt\")\n        print(f\"Content: {content}\") # Content: Hello World\n\n        # 5. Create a code interpreter\n        interpreter = await CodeInterpreter.create(sandbox)\n\n        # 6. Execute Python code (single-run, pass language directly)\n        result = await interpreter.codes.run(\n              \"\"\"\n                  import sys\n                  print(sys.version)\n                  result = 2 + 2\n                  result\n              \"\"\",\n              language=SupportedLanguage.PYTHON,\n        )\n\n        print(result.result[0].text) # 4\n        print(result.logs.stdout[0].text) # 3.11.14\n\n        # 7. Cleanup the sandbox\n        await sandbox.kill()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\n\nOpenSandbox 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.\n\n## Why Use OpenSandbox?\n\n*   **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.\n*   **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.\n*   **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.\n\n## Links\n\n*   **GitHub Repository**: [OpenSandbox GitHub](https://github.com/opensandbox-group/OpenSandbox \"OpenSandbox GitHub\")\n*   **Official Documentation**: [OpenSandbox Documentation](https://github.com/opensandbox-group/OpenSandbox/tree/main/docs \"OpenSandbox Documentation\")\n*   **Discord Community**: [Join OpenSandbox Discord](https://discord.gg/g7FuPs8YeD \"Join OpenSandbox Discord\")","metrics":{"detailViews":1,"githubClicks":0},"dates":{"published":null,"modified":"2026-08-12T19:21:20.000Z"}}