ReferenceConversation memory

Conversation memory

The bot remembers a conversation so follow-ups make sense. Memory is scoped per user and expires on its own.

Audience: developers managing conversation continuity. What you will accomplish: keep context across turns and reset it intentionally.

How memory is scoped

Memory is stored per X-User-Id. Use a stable id per user so the bot remembers the conversation across requests. Different ids are fully isolated — one user’s memory never leaks into another’s.

The X-User-Id value is validated ([A-Za-z0-9_.@-], ≤128 chars) and defaults to anonymous when omitted.

TTL and summarization

PropertyBehavior
TTLMemory expires after a time-to-live, default ~24h; old conversations are dropped.
SummarizationLong chats are summarized automatically to stay coherent within the model’s context.

Start fresh

To begin a brand-new conversation with no prior context, use a new X-User-Id. The old id’s memory remains isolated and expires on its own TTL.

Verify your result

  • Verify: Reusing one X-User-Id keeps follow-ups resolving correctly across turns.
  • Verify: Two different X-User-Id values never share memory.
  • Verify: Switching to a fresh X-User-Id gives a clean conversation.

Common mistakes and fixes

  • Follow-ups lose context → confirm you reuse the same X-User-Id; a new id (or no id) starts fresh.
  • Old context resurfaces → either rotate the X-User-Id or wait out the TTL.
  • Sensitive conversations → chat is unauthenticated by default; gate the service behind auth before storing sensitive memory.