INTRODUCTION
Quick start
Prefer to just dive in? Here’s everything you need to get started immediately.
Try it: the Playground
The public console is the entry point for trying a question against a state. The console recipe shows the sign-in boundary and validates a synthetic email locally.
Open the console entry recipeCall the API
Define a bounded answer before connecting a request to an action. This original fixture shows a support-routing question with three allowed choices; it does not contact the service.
{
"state": "Please restore access before the team meeting.",
"questions": {
"route_to": {
"type": "choice",
"instructions": "Choose the team that can resolve this request.",
"criteria": {
"account": "Account access or sign-in help",
"billing": "Invoices or subscription questions",
"feedback": "Suggestions about the product"
}
}
}
}Ready to copy
Code it: the Python SDK
The current public quickstart uses the standard pip or uv command and the synchronous TypeSafeClient. The example below adapts that public API to a synthetic support request. This page never executes it; an application integration needs a valid API key.
Install the client
pip install typesafe-sdk
Prepare a state
Start with a short synthetic input and a question with explicit alternatives.
Handle the result
Read the returned value and confidence separately. Keep an application fallback for uncertain outcomes.
from typesafe_sdk import Choice, TypeSafeClient
# Reads TYPESAFE_API_KEY from the environment.
# Documentation only; this page never runs the request.
with TypeSafeClient() as client:
response = client.system_one(
state="Please restore access before the team meeting.",
questions={
"route_to": Choice(
instructions="Choose the team that can resolve this request.",
criteria={
"account": "Account access or sign-in help",
"billing": "Invoices or subscription questions",
"feedback": "Suggestions about the product",
},
),
},
)
print(response.answers["route_to"].choice)Ready to copy
TypeSafe console