Skip to main content

warmbox for Python

A synchronous, typed client for Python 3.11+. It uses the standard library and talks to the host daemon, with an API token from Settings → API tokens. Use the daemon's HTTPS address for a remote host, or its loopback address through an SSH tunnel. Certificate verification stays enabled.

Install from PyPI (or from a checkout with python -m pip install ./sdk/python):

python -m pip install warmbox

For agents

Set WARMBOX_TOKEN to your API token and WARMBOX_WORKSPACE_ID to your workspace ID. WARMBOX_URL defaults to http://127.0.0.1:7070 in this example.

import os
from warmbox import WarmboxClient

client = WarmboxClient(os.getenv("WARMBOX_URL", "http://127.0.0.1:7070"),
                       token=os.environ["WARMBOX_TOKEN"],
                       workspace_id=os.environ["WARMBOX_WORKSPACE_ID"])
desktop = client.create_desktop({"image": "headless"})
try:
    result = client.exec(desktop["id"], {"cmd": "uname -a"})
    print(result["stdout"])
finally:
    client.destroy_desktop(desktop["id"])

Commands, files and streams

Methods use the daemon's JSON field names. exec accepts cmd or argv, plus cwd, env, stdin and timeout_ms. A command's nonzero exit code is returned in the result; HTTP failures raise APIError with status and body.

from contextlib import closing

client.write_file(desktop_id, "/home/input.bin", b"\x00\xff")
data = client.read_file(desktop_id, "/home/input.bin")
run = client.start_run(desktop_id, {"cmd": "uname -a"})
with closing(client.stream_run(desktop_id, run["id"])) as events:
    for event in events:
        if "out" in event:
            print(event["out"], end="", flush=True)
        else:
            print("exit:", event["exit"].get("exit"))

Errors

The daemon returns a structured error envelope. APIError exposes it:

try:
    client.exec(desktop_id, {"cmd": "uname -a"})
except APIError as error:
    print(error.status)        # 409
    print(error.code)          # "desktop_not_ready"
    print(error.server_message)  # "the desktop is still booting"
    print(error.details)       # {"retryable": True}
    print(error.request_id)    # "req_1a2b3c4d"

code is a stable snake_case slug, details is optional and may carry retryable: True for transient failures, and request_id is echoed in the X-Request-Id response header. str(error) stays human-readable and error.retryable is a shortcut for details["retryable"].

Lifetimes, pagination and history

create_desktop accepts ttl_seconds (0 = never auto-stop) and an idempotency_key; repeating a key returns the same desktop.

desktop = client.create_desktop({"image": "headless", "ttl_seconds": 900, "idempotency_key": "job-42"})
client.extend_desktop(desktop["id"], 1800)
for entry in client.list_history(desktop["id"]):
    print(entry["command"], entry["exitCode"])
for process in client.list_processes(desktop["id"]):
    print(process["pid"], process["args"])

list_desktops_page, list_volumes and list_snapshots take limit (1-200) and cursor and return the daemon's pageInfo:

page = client.list_desktops_page(limit=50)
while page.get("pageInfo", {}).get("hasMore"):
    page = client.list_desktops_page(limit=50, cursor=page["pageInfo"]["nextCursor"])

stream_run and stream_session yield output events followed by an exit event. They accept from_offset to resume at a byte offset; reconnecting is explicit. A connection that ends without an exit event raises ConnectionError. Use closing when you may stop reading early. Closing a stream leaves the command running; kill_run or destroy_session stops it.

The client also provides list_desktops, get_desktop, pause_desktop, resume_desktop, list_files, delete_file, move_file, list_runs, get_run(tail=...), write_stdin, create_session, session_input and destroy_session. Sessions keep shell state between inputs; session_input sends a shell line, while write_stdin sends raw bytes. extend_desktop, list_history and list_processes cover a desktop's lifetime, command history and running processes.

timeout defaults to 120 seconds for socket operations, including idle stream reads. Use timeout=None for an unbounded wait. It is separate from the guest's timeout_ms. Requests are not retried and redirects are rejected, so a desktop creation is never replayed and credentials are not forwarded to another URL.

Development

cd sdk/python
python -m unittest discover -s tests -v
python -m pip install build mypy
python -m mypy --strict warmbox
python -m build

The tests use a local HTTP fixture; no VM is needed. The package version matches the current warmbox release (0.4.0); update it alongside the next release.

Metadata

Release files for warmbox 0.7.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 warmbox 0.7.0
File Size Uploaded Provenance Actions
warmbox-0.7.0.tar.gz 17.3 kB With provenance Details for warmbox-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for warmbox 0.7.0
File Interpreter ABI Platform Actions
warmbox-0.7.0-py3-none-any.whl Python 3 none any Details for warmbox-0.7.0-py3-none-any.whl

Total release size: 30.0 kB

Release files / warmbox-0.7.0.tar.gz

Download URL warmbox-0.7.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f589e3ddb25f95f8114fdd62d0dd9dfa9f00a876ba88bc5adced2a3d33cd286a
BLAKE2b-256 checksum
How to use checksums
9c6032444491bf343c102d25814f23241582aa5fdc964dcba66bc9d5be817bb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 7, 2026.

Transparency log

Release files / warmbox-0.7.0-py3-none-any.whl

Download URL warmbox-0.7.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b19d1d35f7c657d6afcf86add0b53fee9585a4ee71a62eaf12474436158f7129
BLAKE2b-256 checksum
How to use checksums
6252e34bd7ebdb9e0c83faab48a4072b4547a810033ab3625fac13186aa70bf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 7, 2026.

Transparency log

Security for warmbox 0.7.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for warmbox-0.7.0.tar.gz

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 Nov 7, 2026.

Transparency log

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.

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