deepagents-opensandbox
OpenSandbox backend for the DeepAgents framework. This package enables DeepAgents to launch and control isolated sandbox environments using OpenSandbox.
Key Features
- Sandbox Provider: Manages the lifecycle of OpenSandbox instances (create, connect, delete) via the
SandboxProviderinterface fromdeepagents-cli. - Sandbox Backend: Provides a standard interface for command execution and file operations within a sandbox using the synchronous OpenSandbox SDK (
SandboxSync). - DeepAgents Integration: Fully compatible with
BaseSandboxandSandboxProviderinterfaces.
Installation
pip install deepagents-opensandbox
Usage
from deepagents_opensandbox import OpensandboxProvider
# Initialize the provider (uses OPEN_SANDBOX_API_KEY and OPEN_SANDBOX_DOMAIN env vars)
provider = OpensandboxProvider()
# Create a new sandbox
sandbox = provider.get_or_create(image="python:3.11")
# Execute a command
result = sandbox.execute("echo 'Hello World'")
print(result.output)
# Clean up
provider.delete(sandbox_id=sandbox.id)
Using the backend directly
from opensandbox.sync.sandbox import SandboxSync
from deepagents_opensandbox import OpensandboxBackend
sandbox = SandboxSync.create("python:3.11")
backend = OpensandboxBackend(sandbox=sandbox)
result = backend.execute("python --version")
print(result.output)
sandbox.kill()
sandbox.close()
Configuration
| Environment Variable | Description | Default |
|---|---|---|
OPEN_SANDBOX_API_KEY |
API key for authentication | (none) |
OPEN_SANDBOX_DOMAIN |
OpenSandbox server domain | localhost:8080 |
Server proxy mode
By default, the SDK connects directly to sandbox container IPs. This works when the client and sandbox containers share the same network (e.g. both on the host, or in the same Docker/Kubernetes network).
When the OpenSandbox server runs inside Docker and the client runs on the host machine, container IPs (like host.docker.internal) are not reachable from the host. In this case, enable server proxy mode so that all execd requests are routed through the server:
provider = OpensandboxProvider(use_server_proxy=True)
| Deployment | use_server_proxy |
|---|---|
| Server native on host, client on host | False (default) |
| Server in Docker, client on host | True |
| Server in Docker, client in same network | False |
| Kubernetes with proper networking | False |
Note: OpenSandbox server
v0.1.4and earlier have a bug where the proxy handler drops query parameters on GET requests, causing file downloads to fail with400 MISSING_QUERY. The fix is merged intomainbut not yet released. If you hit this issue, build the server image from source (server/directory).
Development
This project uses uv for dependency management.
Prerequisites
- uv installed.
- Python 3.11 or higher.
Setup
Install dependencies:
uv sync
Testing
Tests are split into unit tests (mocked) and integration tests (requiring a real server).
Run Unit Tests (Mocked)
These tests mock the OpenSandbox SDK calls and do not require a running server.
uv run python -m pytest deepagents_opensandbox/ -v
Run Integration Tests
These tests verify behavior against a real OpenSandbox server. They use use_server_proxy=True since the test runner is on the host while the server is in Docker.
OPEN_SANDBOX_DOMAIN=localhost:8090 uv run python -m pytest deepagents_opensandbox/ -v -k integration
Linting
uv run ruff check deepagents_opensandbox/
uv run ruff format --check deepagents_opensandbox/
Metadata
Release files for deepagents-opensandbox 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deepagents_opensandbox-1.0.2.tar.gz | 204.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deepagents_opensandbox-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 212.9 kB
Release files / deepagents_opensandbox-1.0.2.tar.gz
| Download URL | deepagents_opensandbox-1.0.2.tar.gz |
|---|---|
| Size | 204.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbb14afd0d7d76434ab90f6df412be008b58445c848334a9ae494ac81a4ea010
|
|
BLAKE2b-256 checksum How to use checksums |
afd62517608d17ed0bca75611c42f2b92d1c9d6ae0582f30e65936a84b14350a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.
Transparency logRelease files / deepagents_opensandbox-1.0.2-py3-none-any.whl
| Download URL | deepagents_opensandbox-1.0.2-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68d5dbcfb6ff687789240a71fd6e9700501bbc79d9f92c93cbb866ffd42ce164
|
|
BLAKE2b-256 checksum How to use checksums |
e8d7448167f6a25e763a36a729956e7b95b1863d6a566ae1440b4d4e0fbd72f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.
Transparency log