Pipeline checkpoints
1
Authenticate or establish visitor context
Operators use a JWT with an active organization. Widget clients exchange a public widget key and visitor context for a scoped widget token.
2
Persist before processing
The gateway creates or updates the conversation and stores the message so the inbox and AI process share the same durable state.
3
Run AI gates
The agent skips closed, escalated, or human-assigned conversations; checks AI/subscription availability; handles an active email OTP; and attempts an exact FAQ fast path.
4
Build context and generate
The agent combines a system prompt, recent conversation memory, tenant settings, channel context, and an eligible tool set. A provider router handles generation and fallback.
5
Stream and finalize
Ordered chunks and tool events travel through Redis to gateway consumers. The final response is persisted and an agent-run record captures timing, usage, steps, and errors.
