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
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: manager methods accept Pythonic snake_case keyword arguments and convert them to the camelCase wire fields shown in each page's request field table (e.g. interpolation_stringinterpolationString).
  • 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.