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() # or create(template_id=..., sandbox_id=...)
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.
createandcreate_streamboth 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_url ↔ mcpUrl).
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, tagspyclient-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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dwsandbox_client-0.1.0.tar.gz.
File metadata
- Download URL: dwsandbox_client-0.1.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
437ad137a5e07117cefc0d8ffebba1c65b79e6e1422b6ee5caa8c92b12e6bfcd
|
|
| MD5 |
2c799010ebd715daba6ce65c6f6a701b
|
|
| BLAKE2b-256 |
2ed1bff6ff01d356db20e10bef5667bda4584e5b6adbba6fc032b0f865ea3212
|
Provenance
The following attestation bundles were made for dwsandbox_client-0.1.0.tar.gz:
Publisher:
pyclient-publish.yml on andyjmorgan/DonkeyWork-Sandbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dwsandbox_client-0.1.0.tar.gz -
Subject digest:
437ad137a5e07117cefc0d8ffebba1c65b79e6e1422b6ee5caa8c92b12e6bfcd - Sigstore transparency entry: 2529413750
- Sigstore integration time:
-
Permalink:
andyjmorgan/DonkeyWork-Sandbox@47340a5468edc3a38dd7dda8d84ec973ffe601ef -
Branch / Tag:
refs/tags/pyclient-v0.1.0 - Owner: https://github.com/andyjmorgan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pyclient-publish.yml@47340a5468edc3a38dd7dda8d84ec973ffe601ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file dwsandbox_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dwsandbox_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a141dea31554d8672d76d9a65cf34e330688333e65fa1cd1795ce97a649926f
|
|
| MD5 |
cc195334fe9a47a054dcee82796100d9
|
|
| BLAKE2b-256 |
c6e7f3fb855fab5ee7436262845f2776a5725b4a73019da693a126a2e87559b6
|
Provenance
The following attestation bundles were made for dwsandbox_client-0.1.0-py3-none-any.whl:
Publisher:
pyclient-publish.yml on andyjmorgan/DonkeyWork-Sandbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dwsandbox_client-0.1.0-py3-none-any.whl -
Subject digest:
1a141dea31554d8672d76d9a65cf34e330688333e65fa1cd1795ce97a649926f - Sigstore transparency entry: 2529413956
- Sigstore integration time:
-
Permalink:
andyjmorgan/DonkeyWork-Sandbox@47340a5468edc3a38dd7dda8d84ec973ffe601ef -
Branch / Tag:
refs/tags/pyclient-v0.1.0 - Owner: https://github.com/andyjmorgan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pyclient-publish.yml@47340a5468edc3a38dd7dda8d84ec973ffe601ef -
Trigger Event:
push
-
Statement type: