Guides / §1
Start here
From nothing to a typed decision in one file. Then pick a catalog entry and rebuild it.
You need an API key from the TypeSafe console and Python 3.10 or newer. The SDK reads TYPESAFE_API_KEY from the environment.
pip install typesafe-sdk
export TYPESAFE_API_KEY=...
One call, three questions
This is the canonical example from TypeSafe's quickstart: triage a support ticket.
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient
client = TypeSafeClient()
ticket = "I've been trying to connect my Stripe account for 3 days and it keeps failing. Losing sales. Please help ASAP."
response = client.system_one(
state=ticket,
questions={
"department": Choice(
instructions="Which team should handle this",
criteria={
"billing": "Payment or subscription issues",
"technical": "Bugs or integration problems",
"sales": "Pricing or account questions",
},
),
"frustration": Score(
instructions="How frustrated the customer appears",
criteria=["Calm, just stating facts", "Frustrated but civil", "Very angry, strong language"],
),
"is_urgent": Noul(instructions="The message conveys urgency or time-sensitivity"),
},
)
print(response.answers["department"].choice) # "technical"
print(response.answers["frustration"].score) # 1.0
print(response.answers["is_urgent"].noul) # 1.0
Then rebuild something
The fastest way to learn the shape is to reproduce a catalog entry and compare your numbers to the author's.
- 500 emails for 3 cents: batch triage, the simplest loop.
- Flight search with Browser Use: a decision per browser step.
- Jev plays Doom: a decision per frame.
When yours works, file it with the cost and latency you measured. Numbers beat adjectives.
Docs
- docs.typesafe.ai - reference for Choice, Score and Noul.
- typesafe.ai/blog - the "Introducing System One Models" post.