Skip to main content

dwsandbox-client

A typed Python client for the DonkeyWork Sandbox control plane. The models are generated from the service's OpenAPI spec; the clients wrap them with a base URL and an API key.

pip install dwsandbox-client

Usage

Give it your sandbox access key (dws_...) and it exposes two provisioning methods. Both a synchronous and an asynchronous client ship in the box.

create — provision and wait

Returns the ready sandbox in one call (blocks ~15s while it provisions), including the absolute MCP URL:

from dwsandbox_client import SandboxClient

with SandboxClient("dws_your_key") as sandbox:
    ready = sandbox.create()                      # template_id=, sandbox_id=, environment=, secret_environment=
    print(ready.status, ready.mcp_url)

create_stream — provision with live progress

Yields each provisioning event as it happens:

from dwsandbox_client import SandboxClient, SandboxStatus

with SandboxClient("dws_your_key") as sandbox:
    for event in sandbox.create_stream():
        print(f"[{event.stage}] {event.message}")
        if event.is_terminal:
            assert event.status is SandboxStatus.ready

Async

Same surface, await / async for:

import asyncio
from dwsandbox_client import AsyncSandboxClient

async def main():
    async with AsyncSandboxClient("dws_your_key") as sandbox:
        ready = await sandbox.create()
        print(ready.mcp_url)
        async for event in sandbox.create_stream():
            print(event.stage, event.status)

asyncio.run(main())

The access key may also be sent by your own httpx client — pass http_client= to either constructor to reuse a configured client (proxies, custom timeouts, etc.). The base URL defaults to https://sandbox.donkeywork.dev; override with base_url=.

Note on transport. create and create_stream both go over REST/SSE, which is the transport that works reliably through the public edge. (Native gRPC provisioning exists for in-cluster/LAN callers but the edge does not proxy its long-lived stream.)

Types

dwsandbox_client.models contains the full set of shapes generated from the OpenAPI spec. The commonly used ones are re-exported at the top level: CreateSandboxRequest, CreateSandboxResponse, ProvisioningEvent, SandboxStatus. Fields are snake_case with camelCase wire aliases (e.g. ready.mcp_urlmcpUrl).

Development

Regenerate the models after the API's OpenAPI spec changes:

./scripts/generate.sh        # regenerates src/dwsandbox_client/models.py from openapi.json

scripts/generate.sh documents how to refresh openapi.json from the running API.

Releasing (PyPI, via GitHub Actions)

Publishing is automated through .github/workflows/pyclient-publish.yml, which uploads to PyPI using Trusted Publishing (OIDC, no stored token). Two ways to cut a release:

  • Auto minor bump (normal path): GitHub → Actions → Publish dwsandbox-client → Run workflow. It bumps the minor version in pyproject.toml, commits it, tags pyclient-v<version>, and publishes — no version to pick by hand.

  • Specific version: push the tag yourself (used for the first release):

    git tag pyclient-v0.1.0 && git push origin pyclient-v0.1.0
    

Either way the workflow verifies the tag matches pyproject.toml, builds the sdist + wheel, and publishes.

One-time PyPI setup (only the project owner can do this): on pypi.org create the dwsandbox-client project (or a pending publisher before the first release) and add a Trusted Publisher pointing at this GitHub repo, workflow pyclient-publish.yml, and environment pypi. No API token or GitHub secret is needed after that.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dwsandbox_client-0.3.0.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dwsandbox_client-0.3.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file dwsandbox_client-0.3.0.tar.gz.

File metadata

  • Download URL: dwsandbox_client-0.3.0.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dwsandbox_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e809849ba087d9e239b50f78cdcee2fb263df620ace01a1055d550ea5f7e168b
MD5 50b9d2d3de3c3e4ce80493d1602ee3bc
BLAKE2b-256 9c29a18f2af05a84e824629eda94a9a9fdb08292e8a9213c8cac553b7f81dfb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwsandbox_client-0.3.0.tar.gz:

Publisher: pyclient-publish.yml on andyjmorgan/DonkeyWork-Sandbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dwsandbox_client-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dwsandbox_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 102abf32a2817be79bac02faadc49c2d3d971ccddd9e6d2252145b6cfbcd6d16
MD5 47f89dd135e82e351d265df0c8d7bf3d
BLAKE2b-256 fcb4528563c44d31ea747c199a16cc3c602653a2c3e1c72ec562df89d7d58faa

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwsandbox_client-0.3.0-py3-none-any.whl:

Publisher: pyclient-publish.yml on andyjmorgan/DonkeyWork-Sandbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

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