Should Engage
Decide whether to proactively message a visitor. Returns boolean decision, reasoning, and a fallback indicator.
Signature
1shouldEngage(instructions: string): Promise<{ shouldEngage: boolean; reasoning: string; warning?: string; fallback: boolean; }>
Basic decision
1const decision = await agent.shouldEngage('Engage only if user appears stuck on pricing page');
2
3if (decision.shouldEngage) {
4 agent.greet();
5}
Use cases
- Show chat widget if user hesitates at checkout.
- Offer onboarding help after repeated failed actions.
- Escalate to support if sentiment is negative.