Skip to main content

Async Python client for Litterbox.

Project description

litterbox-python-sdk

Async Python client for the Litterbox host API.

The SDK provisions sandbox VMs, reads host state, deletes hosts, and returns the SSH connection details a caller needs. It speaks HTTP only: SSH sessions, file transfer, command execution, and retry orchestration belong in the caller.

Install

pip install litterbox-python-sdk
uv add litterbox-python-sdk

Usage

from litterbox_sdk import SandboxAPI

sandbox = SandboxAPI(
    base_url="https://sandbox.internal.ts.net",
    token="...",
    timeout=30.0,
)

try:
    host = await sandbox.create_host(
        image="ghcr.io/litterbox/sandbox:abc123",
        env={"FOO": "bar"},
        idempotency_key="agent-run-42",
    )
    # Use host.ssh_host, host.ssh_port, and host.known_hosts with
    # asyncssh or another SSH client.
finally:
    await sandbox.delete_host(host.id)
    await sandbox.aclose()

SandboxAPI.from_env(prefix="SANDBOX_") reads SANDBOX_SERVICE_URL, SANDBOX_SERVICE_TOKEN, and optional SANDBOX_SERVICE_TIMEOUT.

Contract

Public exports live in litterbox_sdk:

  • SandboxAPI
  • SandboxHost
  • SandboxAPIError and typed subclasses for auth, not found, conflict, unavailable, and unclassified response errors

Supported host operations:

  • create_host
  • get_host
  • attach
  • list_hosts
  • delete_host
  • aclose

create_host supports the service's optional image, env, expires_at, and Idempotency-Key inputs.

The SDK does not mint Tailscale auth keys, manage ACLs, establish SSH, provision Linux users, transfer files, or run remote commands.

Development

uv sync
uv run ruff check
uv run ruff format --check
uv run pyright
uv run pytest

Tests use respx to fake the Litterbox HTTP API. They do not need a real network, VM provider, or Litterbox service.

Project details


Download files

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

Source Distribution

litterbox_python_sdk-0.0.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

litterbox_python_sdk-0.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file litterbox_python_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: litterbox_python_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for litterbox_python_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c4959af3486f16885f88e3bf0bff8679eb1103a5fdfd459ef12dc4c9d339b406
MD5 0d9aafdc6fd800b3c8e4c6655f95e8a1
BLAKE2b-256 6de989d8da0c16118b5df206ff2d2577f9ad480ec90dfed7d29b7f67bd415955

See more details on using hashes here.

Provenance

The following attestation bundles were made for litterbox_python_sdk-0.0.1.tar.gz:

Publisher: release.yml on clawhaven/litterbox-python-sdk

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

File details

Details for the file litterbox_python_sdk-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for litterbox_python_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc05293a7963fa0c2bebbc6f77f098ef432a8ebcbac73f4f6933dad71b8cb9f5
MD5 af1400ebfb232a566d8832e6a79fe4e8
BLAKE2b-256 11f28d8b01d01fd10f2a82a274bf50be0aee697a1e36224e6f802e7b68423c06

See more details on using hashes here.

Provenance

The following attestation bundles were made for litterbox_python_sdk-0.0.1-py3-none-any.whl:

Publisher: release.yml on clawhaven/litterbox-python-sdk

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page