Skip to main content

A client library for accessing treadstone

Project description

treadstone-sdk

Typed Python SDK for the Treadstone sandbox service.

Install

pip install treadstone-sdk

Client types

Use Client for unauthenticated endpoints such as health checks:

from treadstone_sdk import Client
from treadstone_sdk.api.system import system_health

client = Client(base_url="https://api.example.com")
health = system_health.sync(client=client)
print(health.status)

Use AuthenticatedClient for protected endpoints. For AI agents and automation, an API key is the preferred credential:

from treadstone_sdk import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://api.example.com",
    token="sk_your_api_key",
)

Common sandbox workflow

from treadstone_sdk import AuthenticatedClient
from treadstone_sdk.api.sandbox_templates import sandbox_templates_list_sandbox_templates
from treadstone_sdk.api.sandboxes import (
    sandboxes_create_sandbox,
    sandboxes_create_sandbox_web_link,
    sandboxes_get_sandbox,
)
from treadstone_sdk.models.create_sandbox_request import CreateSandboxRequest

client = AuthenticatedClient(base_url="https://api.example.com", token="sk_your_api_key")

templates = sandbox_templates_list_sandbox_templates.sync(client=client)
template_name = templates.items[0].name

sandbox = sandboxes_create_sandbox.sync(
    client=client,
    body=CreateSandboxRequest(
        template=template_name,
        name="demo",
    ),
)

sandbox_id = sandbox.id
detail = sandboxes_get_sandbox.sync(sandbox_id=sandbox_id, client=client)
web_link = sandboxes_create_sandbox_web_link.sync(sandbox_id=sandbox_id, client=client)

print(sandbox_id)
print(detail.urls.proxy)
print(web_link.open_link)

Async example

from treadstone_sdk import AuthenticatedClient
from treadstone_sdk.api.sandboxes import sandboxes_get_sandbox

client = AuthenticatedClient(base_url="https://api.example.com", token="sk_your_api_key")

async with client:
    sandbox = await sandboxes_get_sandbox.asyncio("sbabc123def456", client=client)
    print(sandbox.status)

Important identifier rules

  • sandbox.name is a human-readable label scoped to the current user.
  • Follow-up sandbox operations use sandbox.id.
  • Browser entry URLs are based on sandbox_id under the hood.
  • Do not construct Web UI URLs from sandbox names. Read sandbox.urls.web, web_url, or open_link from API responses.

Generated module layout

The SDK is generated from the OpenAPI spec:

  • API functions live under treadstone_sdk.api.<tag>
  • Request and response models live under treadstone_sdk.models
  • Each endpoint exposes sync, sync_detailed, asyncio, and asyncio_detailed

Example imports:

from treadstone_sdk.api.sandboxes import sandboxes_create_sandbox
from treadstone_sdk.models.create_sandbox_request import CreateSandboxRequest

Transport customization

You can customize the underlying httpx clients if needed:

import httpx

from treadstone_sdk import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://api.example.com",
    token="sk_your_api_key",
    httpx_args={"timeout": 60.0},
)

client.set_httpx_client(
    httpx.Client(
        base_url="https://api.example.com",
        headers={"Authorization": "Bearer sk_your_api_key"},
        timeout=60.0,
    )
)

For internal environments with a custom CA bundle:

client = AuthenticatedClient(
    base_url="https://internal-api.example.com",
    token="sk_your_api_key",
    verify_ssl="/path/to/certificate_bundle.pem",
)

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

treadstone_sdk-0.3.11.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

treadstone_sdk-0.3.11-py3-none-any.whl (75.7 kB view details)

Uploaded Python 3

File details

Details for the file treadstone_sdk-0.3.11.tar.gz.

File metadata

  • Download URL: treadstone_sdk-0.3.11.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for treadstone_sdk-0.3.11.tar.gz
Algorithm Hash digest
SHA256 4e34129c26a3fcea1003d503b4d5d624cb0def844547c8d73b3b60162117ed51
MD5 0bec0133df457516a40f82552b719167
BLAKE2b-256 181e73535c21c536921ec81b43e9ffc998f5d96f1e142bdbc78293bc9bc03421

See more details on using hashes here.

File details

Details for the file treadstone_sdk-0.3.11-py3-none-any.whl.

File metadata

  • Download URL: treadstone_sdk-0.3.11-py3-none-any.whl
  • Upload date:
  • Size: 75.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for treadstone_sdk-0.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 02db998758ad1a0cb668803f6acbe1f5b028a1d9404bee8af8301651bf86f28a
MD5 e2abbef7500cf25f4718ffdbaced48ef
BLAKE2b-256 aa90f3b9346347d71490036057fc9afefff54ae5ad3ffad0f280862e62f5d86b

See more details on using hashes here.

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