Skip to content
Console

Sessions and Context

Session and context fields let your product keep hub requests tied to the right user journey.

Use them when a client needs memory, tracing, audit records, personalization, or tool calls around a request.

FieldScopeWhy it matters
session_idMany requestsKeeps a conversation or workflow grouped.
request_idOne requestGives logs and support records a stable trace key.
contextOne request or sessionCarries product metadata without changing the utterance.
site_idClient identityNames the deployed client or runtime.

Start with fields that help you debug and personalize safely:

Context keyExampleUse
user_iduser-42Tie the request to an app user without sending private profile data.
user_nameAdaLet skills address the user when that is useful.
sourcekiosk-checkoutIdentify the app, device, or entry flow.
platformwebSeparate browser, mobile, service, and embedded behavior.
localeen-USPrefer a response language or formatting style.
trace_idreq-2026-06-05-001Join SDK, service, and hub logs.
from thalovant import ThalovantClient, 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-05-001"},
)
with ThalovantClient.from_identity_file("_identity.json") as client:
reply = client.ask(
"What should happen next?",
session_id="checkout-session",
request_id="req-2026-06-05-001",
context=context,
)
  1. Keep identifiers stable. Reuse session_id for the whole conversation or workflow.
  2. Keep request IDs unique. Generate a new request_id for each send.
  3. Keep context small. Send labels, IDs, and routing hints instead of large payloads.
  4. Keep secrets out. Do not pass tokens, passwords, or raw identity material as context.
  5. Keep names generic. Model product roles and flows in your app, then pass neutral metadata to the SDK.

Chat session

One session_id per visible conversation, with one request_id per turn.

Workflow session

One session_id per task, checkout, form, or guided process.

Device session

One session_id per device interaction window, paired with a stable site_id.

Service trace

One service trace ID copied into request context and logs.