Skip to main content

Conversations & Sessions

A conversation is a sequence of exchanges between a user and an AI assistant. A session is the container that holds a conversation's state, history, and connection context.


What is a Session?

When a user connects to LLMRTC, the server creates a session that:

  • Assigns a unique session ID for identification
  • Maintains conversation history (messages exchanged so far)
  • Tracks connection state (WebSocket, WebRTC)
  • Enables reconnection if the network drops

Conversation History

Every session maintains a rolling history of messages:

History serves two purposes:

  1. Context for the LLM - The model sees previous exchanges to maintain coherent conversation
  2. Continuity on reconnect - Users can resume where they left off after network issues

The historyLimit setting controls how many messages are retained. When exceeded, older messages are trimmed while preserving the integrity of tool call/result pairs.


Session Lifecycle

Sessions expire if a disconnected user doesn't reconnect within a reasonable window.


Multi-Turn Conversations

A conversation consists of multiple turns. Each turn follows this pattern:

Within a turn, the orchestrator:

  1. Receives user input (audio or text)
  2. Transcribes to text (STT)
  3. Adds to conversation history
  4. Sends history to LLM
  5. Gets response
  6. Synthesizes speech (TTS)
  7. Adds assistant response to history

Conversations in Playbooks

When using playbooks, conversations gain additional structure:

  • Stages - Conversation moves through defined phases
  • Stage-specific history - Each stage can have its own context
  • Transitions - Rules that move between stages based on conversation content