Skip to main content

Python SDK overview

toothfairyai@latest…

The toothfairyai package exposes a single ToothFairyClient whose managers cover the whole platform. Each manager is one attribute on the client and is documented on its own page with field tables sourced from the API spec.

from toothfairyai import ToothFairyClient

client = ToothFairyClient(
api_key=os.environ["TF_API_KEY"],
workspace_id=os.environ["TF_WORKSPACE_ID"],
)

agent = client.agents.create(
label="Support",
mode="retriever",
interpolation_string="You are a helpful assistant.",
goals="Help customers",
temperature=0.7,
max_tokens=2000,
max_history=10,
top_k=10,
doc_top_k=5,
)

See Authentication & routing for all configuration options and the three routing domains (core API, AI service, streaming).

Managers

ManagerAccessorDomain
Agentsclient.agentsAPI
Agent Functionsclient.agent_functionsAPI
Alertsclient.alertsAPI
Authorisationsclient.authorisationsAPI
Benchmarksclient.benchmarksAPI
Billingclient.billingAPI
Channelsclient.channelsAPI
Charting Settingsclient.charting_settingsAPI
Chatclient.chatAPI + AI
Connectionsclient.connectionsAPI
Dictionaryclient.dictionaryAPI
Documentsclient.documentsAPI + AI
Embeddingsclient.embeddingsAI
Embeddings Settingsclient.embeddings_settingsAPI
Entitiesclient.entitiesAPI
Fine-Tuningclient.finetuningFine-Tuning
Foldersclient.foldersAPI
Hooksclient.hooksAPI
Membersclient.membersAPI
Promptsclient.promptsAPI
Predictionsclient.predictionsAI streaming
Request Logsclient.request_logsAPI
Scheduled Jobsclient.scheduled_jobsAPI
Secretsclient.secretsAPI
Sitesclient.sitesAPI
Streamingclient.streamingAI streaming
Triggersclient.triggersAPI
Streams is Node-only

The Streams manager (client.streams) is only available in the Node.js SDK. The Python SDK does not ship a streams manager.

Conventions

  • Snake_case kwargs (the supported surface): manager methods accept Pythonic snake_case keyword arguments and convert them deterministically to the exact camelCase wire fields the API expects, using mappings generated from the backend validator (e.g. interpolation_stringinterpolationString, authorisation_idauthorisationID, has_nerhasNER, workspace_idworkspaceid). Each page's request field table shows the exact Python kwarg name to pass for every wire field — including irregular keys that do not follow the mechanical conversion. Passing camelCase directly still works but is deprecated: it emits a FutureWarning and normalizes to the same wire key, so it is never needed as a fallback. Unknown field names emit a warning and are forwarded to the API, which rejects fields it does not recognize.
  • Finetuning exception: the /finetuning/* endpoints read snake_case directly (training_type, base_model, test_size, …); the SDK passes those through unchanged instead of converting them.
  • Response models: responses are parsed into typed dataclasses (Agent, Chat, Document, …) where available; lists return a ListResponse with an items attribute.
  • Derived methods (e.g. agents.get_by_mode, agents.search) delegate to another SDK call and perform no direct HTTP request; they are marked derived on their pages.
  • Streaming managers (predictions, streaming) consume Server-Sent Events; see their pages for event/yield semantics.
  • Errors: all failures raise subclasses of ToothFairyError; see Error handling.