Conversation Management π‘ BETA
A conversation is a WebSocket session whose history, active knowledge and tools are resolved server-side on every turn.
The Conversation Lifecycle
| Step | Mechanism |
|---|---|
| 1. Handshake | WebSocket connection creates a session with a server-generated id. |
| 2. Start script | start.bas runs once per session; a Redis flag prevents a second run. |
| 3. Message | The handler assembles system prompt, KB context and recent history. |
| 4. Response | The model streams chunks, or a type-6 tool call runs directly. |
| 5. Close | Session-scoped associations end with the session. |
Message History and Persistence
History is stored per session and per user. Episodic memory can compact older turns into an episode when the configured threshold is reached; see Episodic Memory.
Context Assembly and Management
inject_kb_context appends retrieved KB or website text to the system message only for active, authorised associations. The context is truncated to the caller's token budget before the model call.
Real-Time Communication
Chat uses WebSocket streaming; tool calls (message type 6) execute the compiled script without a model call and without KB injection.
Conversation Analytics
Episode storage records summary, topics, decisions, action items and sentiment for summarised conversations. Raw message text remains in the conversation history.
Configuration and Tuning
| Key | Effect |
|---|---|
rag-mode |
Retrieval strategy for each turn. |
mention-class |
Whether KBs and websites contribute context. |
episodic-memory-* |
History retention and summarisation. |
Privacy and Compliance
Retrieval fails closed without a verified bot scope and rechecks payload stamps and ACLs on every result. Anonymous conversational turns receive no saved-document citations.
Limits
- Activation of KBs and tools is session-scoped.
- No model, token-limit or chunk-size value is fixed by the conversation layer.
- Tool execution bypasses both the model and KB injection.
Related
- Chapter overview - Index of this chapter.
See Also
- Memory Management - Memory scopes and keywords
- Retrieval and RAG - Context selection
- Chat app - User-facing surface