Skip to main content

opensandbox-deepagents

OpenSandbox sandbox backend and provider for Deep Agents and Deep Agents Code (dcode).

Run Deep Agents file and shell tooling inside a self-hosted OpenSandbox deployment: the OpenSandboxSandbox backend implements the BaseSandbox contract on top of the official OpenSandbox Python SDK, and OpenSandboxProvider plugs into dcode through its deepagents_code.sandbox_providers entry-point group — no upstream changes required.

Install

pip install opensandbox-deepagents

# with the dcode provider integration (deepagents-code requires Python >= 3.14):
pip install "opensandbox-deepagents[dcode]"

Environment configuration follows the OpenSandbox SDK: OPEN_SANDBOX_API_KEY / OPEN_SANDBOX_DOMAIN (or a ConnectionConfigSync passed to create/connect), same as any opensandbox SDK program.

Use with the Deep Agents SDK

from opensandbox import SandboxSync

from opensandbox_deepagents import OpenSandboxSandbox

# Create (or connect with SandboxSync.connect(sandbox_id=...))
sandbox = SandboxSync.create("python:3.12-slim", timeout=None)

backend = OpenSandboxSandbox(sandbox=sandbox)

# use as any other Deep Agents backend, e.g.
#   agent = create_deep_agent(model=model, backend=backend)
result = backend.execute("python3 -c 'print(1 + 1)'")
print(result.output, result.exit_code)

# destroy when done (caller-owned lifecycle)
sandbox.destroy()

Use with Deep Agents Code

After pip install "opensandbox-deepagents[dcode]" the provider is discovered through the deepagents_code.sandbox_providers entry-point group:

dcode --sandbox opensandbox

# connect to an existing sandbox
dcode --sandbox opensandbox --sandbox-id <id>

# restore a named snapshot (built from the image on first use)
dcode --sandbox opensandbox --snapshot-name my-snapshot

Config-level parameters (~/.deepagents/config.toml) are forwarded to the provider:

[sandboxes.providers.opensandbox.params]
image = "python:3.12-slim"
lifetime_seconds = 3600   # 0 = live until explicitly deleted

Interface mapping

Deep Agents contract OpenSandbox SDK
execute(command, timeout) SandboxSync.commands.run(command, opts=RunCommandOpts(timeout=...))
upload_files([(path, bytes)]) parent mkdir -p via commands.run, then per-file files.write_file(path, data)
download_files([paths]) files.get_file_info(paths) for error classification, then per-file files.read_bytes(path)
id SandboxSync.id
timeout None provider default (30 min per command)
timeout 0 no deadline (RunCommandOpts.timeout=None)
stdout/stderr merge log messages interleaved chronologically by sandbox timestamp, line boundaries preserved
provider.get_or_create(sandbox_id=...) SandboxSync.connect(sandbox_id)
provider.get_or_create(image=...) SandboxSync.create(image, timeout=...)
provider.get_or_create(snapshot=name) SandboxManagerSync.list_snapshots(SnapshotFilter(name=...)) → reuse, else build: SandboxSync.create(image) + create_snapshot(name) + destroy(), then restore via SandboxSync.create(snapshot_id=...)
provider.delete(sandbox_id) SandboxManagerSync.kill_sandbox(sandbox_id)

All other file operations (read, write, edit, ls, glob, grep, delete) are derived by BaseSandbox from execute() and require a POSIX shell plus python3 in the sandbox image (python:3.12-slim works as-is).

Tests

uv sync --group test
uv run pytest

Unit tests run fully offline against fakes. To run the official Deep Agents conformance suite against a live deployment:

# tests/integration_tests/test_live.py
from langchain_tests.integration_tests import SandboxIntegrationTests
from opensandbox import SandboxSync

from opensandbox_deepagents import OpenSandboxSandbox


class TestOpenSandboxStandard(SandboxIntegrationTests):
    @pytest.fixture(scope="class")
    def sandbox(self):
        sandbox = SandboxSync.create("python:3.12-slim", timeout=None)
        try:
            yield OpenSandboxSandbox(sandbox=sandbox)
        finally:
            sandbox.destroy()

Status

  • Backend: command execution, upload/download with per-file partial success, parent directory creation, and the shared error vocabulary (invalid_path, file_not_found, permission_denied, is_directory).
  • Provider: connect by id, create from image, snapshot-name resolution with build-on-miss, delete.
  • Snapshot states: the lifecycle state vocabulary is deployment-specific; the provider treats states containing fail/error/delet/abort as terminal and defers restore readiness to SandboxSync.create's own health checks.

License

MIT. Depends on deepagents (MIT) and the OpenSandbox Python SDK (Apache-2.0).

Metadata

Release files for opensandbox-deepagents 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opensandbox-deepagents 0.1.0
File Size Uploaded Provenance Actions
opensandbox_deepagents-0.1.0.tar.gz 13.7 kB Without provenance Details for opensandbox_deepagents-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opensandbox-deepagents 0.1.0
File Interpreter ABI Platform Actions
opensandbox_deepagents-0.1.0-py3-none-any.whl Python 3 none any Details for opensandbox_deepagents-0.1.0-py3-none-any.whl

Total release size: 25.4 kB

Release files / opensandbox_deepagents-0.1.0.tar.gz

Download URL opensandbox_deepagents-0.1.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a018943ba94a6a352bcea0638510aada6447f569d9c23c262d2ce8ca096edb61
BLAKE2b-256 checksum
How to use checksums
712b675f881bfdbb0acb676ff7dcd595c235aa0a3fb2af6fee65d92a727ad004
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0

Release files / opensandbox_deepagents-0.1.0-py3-none-any.whl

Download URL opensandbox_deepagents-0.1.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7c2125ee4fde04c75e36f3a2e77508430c031f10e53207be070ee6c7ae2d0b3
BLAKE2b-256 checksum
How to use checksums
bc730ece4f3d325ae88b41101282fdbeafd31ee407f267dfc37f6278918a6917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0

Security for opensandbox-deepagents 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page