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.15.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.15-py3-none-any.whl (75.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: treadstone_sdk-0.3.15.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.15.tar.gz
Algorithm Hash digest
SHA256 87d14524d06360723e80433f0b1b0ad61301aa4710c93ee805c08f25508e03d6
MD5 eb675a154ade0e981d3bff0f9625265f
BLAKE2b-256 cc3565dc57e06f11b26cb53d693b8ea5076f520c17e55928af06cfcdc1b93e1b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treadstone_sdk-0.3.15-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.15-py3-none-any.whl
Algorithm Hash digest
SHA256 c43b1a7379b604f6fbf21a82a5bce92664e6b1d8098364dda8a42c44655cf0f4
MD5 a9304fab81d473e13f5caad7d7017e55
BLAKE2b-256 519d2facf5ae1ecd0ff716598a24b66f8576e4ab6b897c51d20f0732810a21b6

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