Skip to content
Console
Try one

    Talking to a hub

    Connect, ask, list what it understands, and send utterances, actions, and codes.

    Part of SDK Functions. Every call below is shown in each language that has it.

    All seven managed SDKs expose HubSession and HubSessionPolicy for a reusable connection, retained subscriptions, and configurable reconnect/probe timing. Supply a connected-client factory and close the session when its owner exits. An uncertain Ask or Emit is not replayed automatically: the application decides whether retrying an action is safe. Failed cleanup blocks a replacement until that connection has been retired.

    Use Inventory, Skill, and Intent for a presentable view of discovered skills and locale-aware examples. InventoryCache adds optional bounded, private storage with a default one-hour TTL; unknown catalogue language support stays unknown. Explicit language order survives JSON serialization. This view is separate from the native intent-inventory response.

    See the managed-session and cache examples for Python, Node, Go, Rust, Kotlin, .NET, and Swift. MCP returns the presentation view within each tool’s identity lease. Embedded C leaves sessions and storage to its caller.

    Use a runtime client after you have identity material.

    Keep the SDK’s saved keys in private, persistent storage. Use one identity per client process that runs at the same time. A reconnect authenticates again with the same identity and saved keys; a failed connection is never a reason to delete them. Each SDK page names its storage option.

    from thalovant import ThalovantClient
    client = ThalovantClient(identity, protocol="wss")
    client.connect()
    print(client.healthcheck())
    client.close()

    Use a context manager, try/finally, or defer so connections close reliably. In Rust, close the client before propagating a request error: ? immediately returns from the current function and does not await connection cleanup. Concurrent callers join authenticated readiness within their own deadlines. A cancelled queued caller must not close the active connection.

    These helpers cover the same workflows in each high-level SDK’s supported transports. Kotlin extension helpers need import com.thalovant.sdk.*.

    WorkflowPythonNode.jsGoRustKotlin / Swift.NET
    Routed query and cascade repliesqueryqueryQueryqueryqueryQueryAsync
    Reuse a conversational sessionconversationconversationConversationconversationconversationConversation
    Wait for a correlated eventwait_for_eventwaitForEventWaitForEventwait_for_eventwaitForEventWaitForEventAsync
    Observe an event streamlistenonListenlistenlistenListenAsync
    Connect and inspect readinessconnect_with_infoconnectWithInfoConnectWithInfoconnect_with_infoconnectWithInfoConnectWithInfoAsync
    Ask with language, pipeline and location hintsaskaskAskWithOptionsask_with_hintsaskWithHintsAskWithHintsAsync
    Build a request locationbuild_locationbuildLocationBuildLocationbuild_locationbuildLocationThalovantContext.BuildLocation
    Render a speakable intent patternspeakablespeakableSpeakablespeakablespeakableThalovantContext.Speakable
    Decode one embedded audio eventaudio_bytesaudioBytesAudioBytesaudio_bytesaudioBytesAudioBytes
    Read answering pipeline IDsreply.pipeline_idsreply.pipelineIdsreply.PipelineIDs()reply.pipeline_ids()reply.pipelineIdsreply.PipelineIds
    Read answering skill IDsreply.skill_idsreply.skillIdsreply.SkillIDs()reply.skill_ids()reply.skillIdsreply.SkillIds
    Inspect advisory reply claimreply.claimedreply.claimedreply.Claimed()reply.claimed()reply.claimedreply.Claimed

    Kotlin uses a Flow, Swift an AsyncThrowingStream, and .NET an IAsyncEnumerable for listening. Their buffers hold at most 64 events and report overflow explicitly. Cancel or finish the stream to remove its subscription. Swift starts the subscription when listen is called; .NET starts when enumerated. Use each language guide for timeout units and cancellation inputs.

    Ask allows bounded delayed speech; Query follows its query ID through cascade replies and waits for completion. A soft intent miss can recover when speech arrives. Hard policy denial and explicit query timeout remain failures, with partial speech preserved. Conversation helpers reuse the session while creating a fresh request ID and merged context per request. A reconnect never automatically replays an application request.

    Reply IDs are nonempty strings in first-seen order. A fallback-only successful reply retains its text and success status but reports claimed=false; a successful reply without stage stamps retains legacy claimed behavior. Failed or unhandled replies are never claimed. Claim metadata does not verify peer identity. See reply claims for matching and malformed-stamp behavior.

    Embedded C exposes thalovant_ask_event_pipeline_id(), thalovant_ask_event_skill_id() and thalovant_reply_claimed() with caller-owned buffers and ID aggregation. MCP runtime summaries expose pipelineIds, skillIds and claimed through the Node SDK.

    Use ask for one request-response interaction.

    reply = client.ask("What can this hub do?")
    print(reply.text)
    for item in reply.display_items():
    print(item)

    Expected output shape:

    {
    "text": "This hub can answer quick joke and trivia requests.",
    "display_items": []
    }

    Use intents when a client should show people what the hub understands, or confirm that a skill registered. The hub answers over the client’s own session with every intent, per language, and the sentences that reach it. No control-plane token is involved. The connection must be allowed to publish ovos.intent.list, and ovos.intent.describe as well when the SDK has to ask for the sentences separately, which a hub that returns them with the listing never makes it do. See What Can My Hub Be Asked?.

    from thalovant import ThalovantPolicyDeniedError
    try:
    inventory = client.intents(["en-us", "fr-fr"])
    except ThalovantPolicyDeniedError as denied:
    print("refused:", denied.denied_type, "allowed:", denied.allowed)
    raise
    for intent in inventory.intents:
    print(intent.id, intent.examples("en-us"))

    Expected output shape:

    {
    "languages": ["en-us", "fr-fr"],
    "source": "intent-manifest",
    "denied": [],
    "skills": [
    {
    "skill_id": "thalovant-skill-weather.thalovant",
    "languages": ["en-us", "fr-fr"],
    "intents": [
    {
    "id": "thalovant-skill-weather.thalovant:current.weather",
    "skill_id": "thalovant-skill-weather.thalovant",
    "name": "current.weather",
    "engine": "padatious",
    "enabled": true,
    "phrases": {
    "en-us": ["what is the weather", "what is the weather in {location}"],
    "fr-fr": ["quel temps fait-il", "quelle est la météo à {location}"]
    }
    }
    ]
    }
    ]
    }

    A refused query raises the SDK’s policy error at once, naming the message type, instead of waiting for a timeout. When ovos.intent.list is refused and the fallback is on, which is the default, the result carries names only with source set to engine-manifests. A hub that accepts a query and answers it with ok: false is a different case: a failed listing raises the SDK’s runtime error with the hub’s error text, because a failed listing is not an empty hub, while a failed describe leaves that one intent without sentences and raises nothing. Every published SDK ships this recipe under its own spelling; each SDK page gives a working example, and the SDKs page lists the version each one shipped it in.

    The current high-level SDKs use the default engine-manifest fallback when ovos.intent.list times out. In that case, denied names the unanswered query and does not prove a policy refusal. Disable fallback to propagate the listing timeout; silent fallback engines still produce a timeout. See intent discovery.

    Use raw events when you already have an event name and a structured payload.

    client.emit(
    "thalovant.client.status",
    {"state": "ready"},
    {"source": "checkout-kiosk"},
    )

    Use an utterance when the input should behave like speech or chat text from a client.

    client.send_utterance(
    "What is the status?",
    lang="en-us",
    session_id="status-session",
    )

    Use actions for buttons, menu picks, confirmations, and tool commands.

    client.send_action(
    "/approve invoice-42",
    title="Approve invoice",
    session_id="approval-session",
    )

    Use code input for QR values, barcode scans, serial numbers, short codes, or typed exact values.

    client.send_code(
    "INV-2026-001",
    kind="invoice",
    session_id="scan-session",
    )

    Use a conversation when related turns should share the same session.

    with client.conversation(lang="en-us") as convo:
    print(convo.ask("Remember that my favorite color is blue.").text)
    print(convo.ask("What color did I mention?").text)

    With the current supported SDK versions, Python uses sentence=True with the optional listing extra. Node accepts { sentence: true } in intent.examples(lang, limit, options). Go uses IntentExampleOptions{Sentence: true} with ExamplesWithOptions; Rust uses IntentExampleOptions with examples_with_listing. Kotlin, Swift and .NET expose examplesWithListing / ExamplesWithListing. MCP exposes sentence on thalovant_intent_inventory.

    These renderers use locale slot samples before caller overrides, prefer complete phrases, and count unique nonempty results toward rendered limits. Raw unlimited examples preserve registration order. The managed SDKs bundle the same data used by Python’s listing extra. See each SDK guide for its call signature and custom-rule options.