TypeSafe Python SDK

September 17, 2026 ยท View on GitHub

Install the TypeSafe Python SDK and get started with asynchronous or synchronous API calls.

Asynchronous and synchronous Python clients for theTypeSafeAPI. Learn how to use TypeSafehere.

Quickstart

  1. Install the SDK:- uv
  • pip
uv add typesafe-sdk
pip install typesafe-sdk
  1. SetTYPESAFE_API_KEYin your environment (create ithere)
  2. Call the System One API:- Async
  • Sync

WithAsyncTypeSafeClient:``` from typesafe_sdk import AsyncTypeSafeClient, Choice, Noul, Score

async def main() -> None: async with AsyncTypeSafeClient() as client: response = await client.system_one( state={"document": "I was charged twice. Please fix this ASAP."}, questions={ "billing": Noul(instructions="Is this ticket about billing?"), "tone": Choice( instructions="What is the customer's tone?", criteria={"calm": None, "frustrated": None, "angry": None}, ), "urgency": Score( instructions="How urgent is this ticket?", criteria=["can wait", "this week", "today"], ), }, )

print(response.nouls["billing"].noul) print(response.choices["tone"].choice) print(response.scores["urgency"].score)


With[TypeSafeClient](python/api/clients/sync/client.md):```
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient

with TypeSafeClient() as client:
 response = client.system_one(
 state={"document": "I was charged twice. Please fix this ASAP."},
 questions={
 "billing": Noul(instructions="Is this ticket about billing?"),
 "tone": Choice(
 instructions="What is the customer's tone?",
 criteria={"calm": None, "frustrated": None, "angry": None},
 ),
 "urgency": Score(
 instructions="How urgent is this ticket?",
 criteria=["can wait", "this week", "today"],
 ),
 },
 )

print(response.nouls["billing"].noul)
print(response.choices["tone"].choice)
print(response.scores["urgency"].score)

Usage

Learn more in theUsage guide.