Skip to main content

Python SDK for the to11.ai platform

Project description

to11ai-sdk

Python SDK for to11.ai — the AI engineering platform for prompt management, tracing, and evals.

Installation

pip install to11ai-sdk
# or with uv
uv add to11ai-sdk

Getting started

from to11ai_sdk import create_client

client = create_client(
    base_url="https://api.to11.ai",
    api_key="...",
)

result = client.prompts.resolve(
    project_id="proj_abc123",
    slug="chat-system-prompt",
    labels=["production"],
    variables={"user_name": "Alice"},
)

print(result.rendered.text)  # "Hello, Alice!"

Features

  • Prompt resolution with label-based version selection and Liquid template rendering
  • Project label registry CRUD, reverse-lookup, and immutable event history
  • Typed errors for auth, rate limiting, validation, and network failures
  • Compatible with Python 3.10+

Project label registry

The project label registry is the source of truth for which labels exist on a project. Strict-mode projects reject move_label calls for labels that are not in the registry; the SDK surfaces those as a typed PromptLabelNotRegisteredError.

from to11ai_sdk import create_client, PromptLabelNotRegisteredError

client = create_client(base_url="https://api.to11.ai", api_key="...")

# Register a new label
client.prompts.create_project_label(
    project_id="proj_abc123",
    label="staging",
    is_default=False,
    description="rolling staging pointer",
    display_color="amber",
)

# List active labels
labels = client.prompts.list_project_labels(project_id="proj_abc123")

# List prompts currently pointed at by a label
usages = client.prompts.list_project_label_usages(
    project_id="proj_abc123", label="production",
)

# Inspect the immutable move history at any scope
events = client.prompts.list_label_events(
    scope="project", project_id="proj_abc123", limit=50,
)

# Strict-mode-friendly move
try:
    client.prompts.move_label(
        project_id="proj_abc123",
        prompt_id="prompt_xyz",
        label="production",
        version_id="ver_42",
    )
except PromptLabelNotRegisteredError as exc:
    # exc.project_id, exc.label carry the structured payload
    print(f"Register {exc.label!r} first")

update_project_label(description=None) means "leave unchanged"; pass description="" to clear it.

Documentation

Full API reference and guides: https://docs.to11.ai

License

MPL-2.0

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

to11ai_sdk-0.1.0.tar.gz (49.5 kB view details)

Uploaded Source

Built Distribution

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

to11ai_sdk-0.1.0-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file to11ai_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: to11ai_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 49.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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 to11ai_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 824df7200cc4e7ca0c498fb9aaf4ee5bdb694807fe0cc62fd2b9ec683f0a6721
MD5 7d76c640141c45a9f1d598e74e281828
BLAKE2b-256 5c21f35e75bba1bdb773e9de86b41ef36dae78fc078cbff9dd43d21cf9306baa

See more details on using hashes here.

File details

Details for the file to11ai_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: to11ai_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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 to11ai_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1d5c4b3adf69d78a3d71bef8a1f4d8a8a3fec33b756f24b6d65c5e372335f97
MD5 1d257b95fbd19d0703ec9650bf3fea2f
BLAKE2b-256 aa0932ee730e7c0dd42d3149ad29d3aa5496cbaad7435237e7c4ac15e06293a7

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