Skip to main content
Every memory call is scoped by org_id, user_id, and session_id. Your API key decides org_id. The SDK usually gets user_id from the token. Your app chooses session_id. That is the field you use for a chat thread, Slack channel, agent run, or tenant-specific memory.
FieldSourceYou set it?
org_idJWT minted from your API keyAlmost never
user_idJWT (or per-call override when supported)Sometimes
session_idYour applicationAlways
In most apps, session_id is the field you set on every call.

session_id

Pick a stable pattern:

Single chat thread

chat-{conversation_uuid}

Slack channel

slack-{channel_id}

Agent run

agent-{task_id}

Long-lived user profile

bio-{user_id}
Use the same string for the same logical thread. That way recall searches the same memory each time.

SaaS (one key)

For a SaaS app, map each customer or user conversation to a distinct session_id. One shared Tex client is enough:
tex = Tex(api_key=os.environ["TEX_API_KEY"], base_url=BASE_URL)

def chat(user_msg: str, x_user_id: str, conv_id: str):
    sid = f"u_{x_user_id}-{conv_id}"
    hits = tex.recall(q=user_msg, session_id=sid)
    ...
That gives you one bill and separated memory. The only rule is simple: never reuse one customer’s session_id for another customer.
Per-call user_id overrides are planned for SDK 1.2. Until then, include the end user in session_id. The multi-tenant SaaS recipe shows the full pattern.

Recall and ranking

top_k, modes, confidence.