Behavior rules let the agent do something beyond answering — pop a CTA when the visitor matches an intent, prompt for an email after a threshold, suggest a curated answer when keywords match. They run on every turn, both server-side (during prompt assembly) and client-side (for visible UI like CTAs).
Each rule is a row in behavior_rules with three pieces:
cta, lead_capture, route, curated.
Rules also have enabled (boolean) and priority
(integer) fields. Higher priority wins when multiple rules match.
Disabled rules are kept around for history, not deleted.
Open /app/agents/{id}/behavior. The form is a kind-aware
builder — pick the kind, fill in conditions and action, save. Up to 20
enabled rules are loaded into the widget at init time; anything beyond
that is ignored at runtime (so prune the disabled list periodically).
The widget tracks lightweight signals to fire rules without the visitor saying anything:
These are evaluated locally in the widget so the trigger fires instantly. The actual action (show a CTA card, etc.) happens client-side too — no round-trip needed.
A CTA action renders a card inside the chat panel with a title, description, and one or two buttons. Buttons can:
Manage CTAs at /app/agents/{id}/ctas. They're stored as
behavior rules with kind=cta, but the dedicated UI is
friendlier than the raw rule editor.
Curated answers short-circuit the RAG pipeline. If a visitor's question matches a curated trigger (substring or regex), the curated text streams back instead of going through retrieval and the LLM. Useful for:
Manage them at /app/agents/{id}/curated. Each entry has a
list of trigger phrases, the canned answer, and an optional citation. At
runtime the agent streams the curated text token-by-token to mimic the
LLM's behavior — visitors don't see a jarring pop-in.
A lead_capture rule fires the inline lead form. Common
triggers:
The form fields are configurable — name, email, phone, and any custom field you've defined. See Voice, leads & persistence for the visitor-side flow.
A route rule pings a human operator. Use it to escalate
when:
The route appears in /app/inbox as an unread thread; an
operator can claim it and continue inline. See
Inbox & human takeover.
Behavior rules can be A/B tested. The Experiments page
(/app/agents/{id}/experiments) lets you split traffic
between two rule variants and watch the conversion delta. The split is
per-visitor, not per-conversation — once a visitor is bucketed they stay
in that bucket for the lifetime of the conversation.