Skip to main content

Official Python SDK for the Spine API.

Project description

spine-sdk

Official Python SDK for the Spine API.

PyPI version Python versions License: MIT

Create async canvas runs, poll them to completion, and introspect the resulting canvas graph and task tree — with full type hints, sync and async clients, and a built-in polling helper.

Installation

pip install spine-sdk

The package installs as spine, so you import it as:

from spine import SpineClient

Python 3.9+ is required.

Quickstart

from spine import SpineClient, Template

with SpineClient(api_key="sk_spine_...") as client:
    handle = client.runs.create(
        prompt="Research the Q4 2025 AI chip market and write a memo",
        template=Template.DEEP_RESEARCH,
    )
    result = handle.wait(timeout=600)
    print(result.final_output)
    for artifact in result.artifacts:
        print(artifact.name, artifact.download_url)

The same code in async:

import asyncio
from spine import AsyncSpineClient

async def main() -> None:
    async with AsyncSpineClient() as client:  # reads SPINE_API_KEY from env
        handle = await client.runs.create(prompt="Hello")
        result = await handle.wait()
        print(result.final_output)

asyncio.run(main())

What's in the SDK

  • SpineClient and AsyncSpineClient — fully typed, context-managed HTTP clients.
  • client.runs — create runs, poll them, wait for completion with exponential backoff, or stream progress snapshots.
  • client.canvas — inspect the canvas block DAG and task tree for any run.
  • client.webhooks — verify inbound webhook signatures and parse the event with construct_event(payload, sig_header, secret).
  • Typed Pydantic models for every request and response.
  • Typed exceptions (AuthenticationError, NotFoundError, BadRequestError, ServerError, SpineTimeoutError) so you can branch on the exact failure.
  • Automatic retry on transient 5xx and 429 responses (honours Retry-After).

Documentation

Full reference and guides: https://docs.getspine.ai/api-reference/sdks/python

License

MIT — see LICENSE.

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

spine_sdk-0.2.0.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

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

spine_sdk-0.2.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file spine_sdk-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for spine_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9f743b39826f0ebb398a92ac88ed7c1244130d4270d0f8405b2074089df9325a
MD5 c4459fb25587543d3226384e6ebde5d6
BLAKE2b-256 5696d56b7aca5cd5d3bf148d56b3b008257945fb73110652ec27f45d8066d74f

See more details on using hashes here.

Provenance

The following attestation bundles were made for spine_sdk-0.2.0.tar.gz:

Publisher: release.yml on Spine-AI/spine-py

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

File details

Details for the file spine_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: spine_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spine_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cbf26c473cbf31c670071aa099c88872ec2a3970904b59d7b4c5200eece14de
MD5 a21ba37b891226ab59a0e3364f415454
BLAKE2b-256 5e84c51bdd469aeee59592d3d52610e988e961b09c968f6e14f87ca49209ca0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spine_sdk-0.2.0-py3-none-any.whl:

Publisher: release.yml on Spine-AI/spine-py

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