Skip to content
Console
Try one

    Events, context, and diagnostics

    Wait for one event or stream many, build request context, and check a connection.

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

    Use this when one event proves the request completed.

    from thalovant import EVENT_UTTERANCE_HANDLED
    event = client.wait_for_event(EVENT_UTTERANCE_HANDLED, timeout=12)
    print(event.text)

    Use event streams for long-running clients, live status, speech output, and UI updates.

    from thalovant import EVENT_SPEAK
    for event in client.listen(EVENT_SPEAK, timeout=30, max_events=3):
    print(event.text)

    Context carries stable user, source, locale, and trace metadata without changing the utterance.

    from thalovant import build_client_context
    context = build_client_context(
    user_id="user-42",
    user_name="Ada",
    source="checkout-kiosk",
    platform="kiosk",
    locale="en-US",
    metadata={"trace_id": "req-2026-06-10-001"},
    )
    reply = client.ask("Show the next instruction.", context=context)
    print(reply.text)

    Use diagnostics when a client cannot connect, a protocol is missing, or an event never arrives.

    print(client.doctor())

    Use the SDK protocol enum or string that matches your language.

    ProtocolPythonNode.jsGoRust
    WSS"wss""wss"thalovant.ProtocolWSSHubProtocol::Wss
    HTTPS"https""https"thalovant.ProtocolHTTPSHubProtocol::Https
    MQTT"mqtt""mqtt"thalovant.ProtocolMQTTHubProtocol::Mqtt

    The automatic protocol selectors prefer WSS, then HTTPS, then MQTT when the identity includes broker credentials. Go’s older NewClient(identity) and Rust’s Client::new(identity) constructors select HTTPS directly; use NewClientWithOptions or Client::auto for automatic selection.

    1. Discover a hub. Use list_public_hubs, get_public_hub, list_hubs, or get_hub.
    2. Create or load identity material. Use create_client_identity for new clients, or load an existing identity from config, file, or environment.
    3. Choose a protocol. Start with WSS unless your deployment needs HTTPS or MQTT.
    4. Send one request. Use ask first because it gives a clear reply.
    5. Add events and context. Add listen, wait_for_event, and build_client_context once the basic request works.
    6. Show what can be asked. Use intents when the client should list the hub’s intents and sentences per language.