Two deliveries after the same proactive trigger: Flow A — textual proactive trigger, user chats, then visual guidance; Flow B — visual guidance directly (no chat step).
Available now.
When to fire (shared layer)
- Context — On each tick, build
ProactiveTriggerContextfrom your event buffer, session metadata, and any flags you maintain (URLs, workflow hints, etc.). - Triggers — Implement
ProactiveTrigger(predicate-style or custom) that returns aProactiveTriggerResult(body, optionalreply_option_labels, timings, cooldown metadata) orNone. - Registry — Wrap triggers in
ProactiveTriggerRegistryand callevaluate_first(orevaluate_all) to pick the first firing trigger. - Gate — Before sending, use Agent session states: apply v2 state checks + cooldown gating so you keep one proactive offer at a time and avoid overlap while reactive chat is active.
Why agent states are required (v2)
Treat proactive triggers as state-gated orchestration, not just predicates:thinking— only state where a new proactive offer may be initiated.proactive_assistance— a proactive offer is already shown; do not stack another proactive suggestion.reactive_assistance— user-initiated chat is active; suppress overlapping unsolicited proactive prompts.
Trigger conditions and heuristics
Not every event should fire help — that becomes noise. Encode intent and workflow conditions using your payload and memory (when available) — not ad-hoc URL rules alone — before you evaluate triggers and deliver proactive chat. Examples of situations worth detecting:- Inferred intent is stuck on the same workflow step (no forward progress toward the session goal) for more than 60 seconds
- The user hits failure signals for the same workflow three times in a row (for example validation or integration errors within one adoption flow)
- The user starts a feature workflow they have never completed before (first-time path through that workflow, not “first visit” to a URL)
- Workflow completion for a key journey stays low across attempts — for example stuck in
in_progresswith completion below a threshold while memory shows repeat struggle on that workflow
Put these checks before your registry evaluation and delivery. In this step, focus on proactive trigger definition plus state-gated chat / reply-option delivery. Step 4 covers routing into relevant visual guidance tours.
Choose your trigger path: built-in vs custom
You can implement Step 3 in two ways:Use built-in proactive triggers
Use this path when default patterns are enough and you want quick setup withdefault_proactive_trigger_registry().
- Start with the built-in registry using
default_proactive_trigger_registry(). - Evaluate with
evaluate_first(ctx)on each tick. - State-gate delivery with
can_show_proactive_with_reasonbefore showing UI.
Build a custom proactive trigger
Use this path when you need product-specific workflow logic, custom copy, or domain-specific metadata.- Define a
PredicateProactiveTrigger(or subclassProactiveTriggerfor more complex logic). - Register it in
ProactiveTriggerRegistry(optionally prepending it before built-ins). - Evaluate with
evaluate_first(ctx)on each tick. - State-gate delivery with
can_show_proactive_with_reasonbefore showing UI.
Delivery A: Proactive chat and reply options (SDK)
The SDK is transport-agnostic for detection; you wire a firingProactiveTriggerResult into your delivery layer (chat widget message, in-app chat, toast, etc.). That is the path fully covered by the reference pages.
For v2-first integrations, keep the same flow (
context -> registry -> delivery) but enforce that proactive delivery happens only from thinking, with cooldown-aware state transitions.