Conversations
Conversation Overview
Deep dive into conversational lifecycle, message turn-taking, session hierarchy, and real-time streaming architectures.
Overview
In Asiyst, a Conversation is an interactive, stateful dialogue between a website visitor and your configured AI assistant. Every conversation maintains multi-turn memory, captures real-time telemetry, associates knowledge citations, and can trigger client-side DOM actions like scrolling, page navigation, and product highlights.
Conversation Lifecycle & State Machine
Every conversation progresses through a strict, deterministic lifecycle:
[Visitor Opens Widget]
│
▼
┌──────────────┐
│ Initializing │ ── (Exchange auth token & load assistant persona)
└──────┬───────┘
│
▼
┌──────────────┐
│ Active │ ◀───┐ (Exchange multi-turn messages & tokens)
└──────┬───────┘ │
│ │
[Inactivity / Close] │ (Re-open within session TTL)
│ │
▼ │
┌──────────────┐ │
│ Suspended │ ────┘
└──────┬───────┘
│ (After 30 min idle or explicit logout)
▼
┌──────────────┐
│ Completed │ ── (Persisted to analytics & transcript store)
└──────────────┘
- Initialization: The SDK mounts the Shadow DOM container, exchanges credentials via
POST /api/v1/sdk/handshake, and downloads the active avatar and assistant manifest.
- Active Dialogue: The visitor submits queries. The Asiyst Cloud context router queries dense vector indices, streams assistant tokens with low latency (< 180ms TTFT), and animates avatar mouth and gesture states.
- Suspension: When the visitor minimizes the chat bubble or navigates to another page on the same domain, conversational state is preserved in
sessionStorageand synchronized across browser tabs.
- Completion: Conversations conclude upon explicit user logout (
Asiyst.logout()) or when the 30-minute inactivity timeout triggers. Completed sessions are indexed for analytics dashboards.
Data Model & Anatomy
Each conversation object adheres to the canonical schema:
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier prefixed with conv_ (e.g., conv_8f9a2b1c) |
projectId | string | Scoped project identifier (proj_...) |
sessionId | string | Ephemeral visitor session identifier (sess_...) |
visitorId | string | Persistent visitor identifier (anonymous UUID or custom userId) |
status | string | One of active, suspended, completed, archived |
turnCount | number | Total number of exchanges in the conversation |
startedAt | string (ISO) | Timestamp when the first user message was received |
updatedAt | string (ISO) | Timestamp of the most recent interaction |
metadata | object | Arbitrary custom JSON payload passed by the host application |
Relationship: Sessions, Conversations, and Turns
- Visitor Session (
sess_...): Represents a visitor's entire visit across pages on your website. A session lasts until 30 minutes of complete inactivity.
- Conversation (
conv_...): A continuous chat dialogue occurring within a session. A single visitor session can contain multiple distinct conversations if the visitor resets the chat.
- Turn (
turn_...): A paired exchange comprising a single user message and the corresponding AI assistant response with its grounding citations and token stream.
Real-Time Streaming Protocol
Asiyst streams conversational responses using either WebSockets (wss://api.asiyst.com) or HTTP/2 Server-Sent Events (SSE). As the LLM generates tokens, each chunk is pushed immediately to the client to render smooth typewriter animations and synchronize real-time avatar lip movements without buffering the entire response.