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:
- Context for the LLM - The model sees previous exchanges to maintain coherent conversation
- 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:
- Receives user input (audio or text)
- Transcribes to text (STT)
- Adds to conversation history
- Sends history to LLM
- Gets response
- Synthesizes speech (TTS)
- 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
Related Documentation
- Architecture Overview - How sessions fit in the system
- Connection Lifecycle - Client-side connection handling
- Protocol Messages - Session-related message formats
- Backend Configuration - Session TTL and history settings