02 — Dialogue: what the agent says, collects, and answers
2.1 Messages
messages is an array of message objects; the groups are variants (written lines), pushback (§2.7), and instructions (§2.2). The first variant is the goal's prompt — detection and performed-validation key off it, so put the real question first.
"messages": [
{ "message": "I'd like to send you the details — what email should I use?" },
{ "message": "Where should I email the details?" },
{ "message": "Which email address works best for you?",
"pre_message": "Thanks for bearing with me." }
]
- Variants & rotation: variants are said in round-robin for as long as the goal stays active. An ask goal with written messages gets at least 3 variants — a question re-asked verbatim sounds robotic. A say goal gets one message: it performs once and moves on, so variants are dead weight (add them only when the goal actually repeats). When an ask goal has an intro ("I'd like to send you the details…"), the first variant carries intro + question and the later ones only the question — the intro shouldn't repeat on retries. Instructions (§2.2) are exempt: the LLM varies its own phrasing.
- One term for the value — everywhere. Pick a single word for the thing the goal collects; make it the goal name, and use it — and no synonym of it, in any variant — in every variant. Detection matches the goal name against the question asked (§2.6), so a variant that swaps in or mixes in another term ("spending" when the goal is
budget) reads close to a human but silently loses the answer. If another term reads better, rename the goal to it — never vary the term across variants. - Never repeat — per-message
repeat: 0: this variant is said at most once (a storedfalsereads the same). - Lead-in (
pre_message): a short line spoken before the message, kept separate so interruption recovery and answer detection still match the message itself. Prefer a lead-in over baking transitions ("Thanks! So,…") into the message. - Conditions (per-message
conditions): gates that variant only. - Say exactly (
force_exact_response, goal-level): the agent must deliver the message verbatim, no rephrasing. For legal wording, closing lines. - Inline speech markup: a message may open with a rate tag —
"[SPEED=0.8]Ok, thank you for your time!"— to slow (or speed) delivery of that message. - Disable lead-ins (
exclusive_message, goal-level): this goal's message becomes the only thing in the turn — acknowledgements and appended content are suppressed. Use for clean exits ("Ok, thank you for your time!") where a cheerful auto-acknowledgement would be wrong. - Ignore interruptions (
uninterruptible, goal-level): the agent finishes speaking even if the contact talks over it. Required on transfer goals (flows/hot-transfer.md).
Writing style rules: §2.9.
2.2 Instructions
An instruction is a generative: true message: instead of a fixed line, the agent follows a behavior prompt for the turn.
"messages": [{ "message": "Answer pricing questions briefly, and steer back to booking the demo.",
"generative": true }]
- While any instruction exists on a goal, written variants become one-shot (each carries
repeat: 0): they are said once, then the instruction takes over. All written messages must come before the instruction, and be non-repeating — so once the instruction is reached, the agent stays on it. - Hard intro + instruction — a strong pattern: one exact written opener, then a generative message to handle whatever the contact says next:
"messages": [
{ "message": "Let me quickly explain how the program works: three sessions, fully covered by your insurance.", "repeat": 0 },
{ "message": "Answer questions about the program briefly, and check the contact is following.", "generative": true }
]
- A persisting behavior — the agent holding a stance across turns (waiting with the contact, troubleshooting, free-form closing) — is an instruction goal with
repeat: true; it re-runs every turn until a transition stops it (01-flow §1.5–01 §1.6). Give every persisting behavior an explicit exit: a transition or a trigger phrase on the next goal — otherwise it holds the call forever. An open-ended conversational phase built on this shape — with exit transitions that also emit collected slots — is the subagent goal, the default body of a call (flows/subagent.md). The full shape — instruction +repeat: true+ transition:
{ "name": "hold with contact", "goal_type": "say", "repeat": true,
"messages": [{ "message": "Keep the contact company while the transfer connects — reassure them it takes a minute or two, and answer their questions briefly.", "generative": true }],
"transitions": [{ "name": "go_to_goodbye", "prompt": "the contact asks to end the call", "target": "goodbye" }] }
2.3 Turn assembly
One agent turn is composed as:
[acknowledgement] + [appended goals' messages] + [the active goal's message]
-
Acknowledgement — the reaction to the answer just collected. Modes (per ask goal,
acknowledge): absent = Auto, agent-generated ("Great!", "Perfect, {value}."); a string = Custom, may use{value};false= Disabled, say nothing. Some configs carryacknowledgeas an array of conditional entries instead of a string — treat it as a valid custom acknowledgement and preserve it; author strings. Never open a message with an acknowledgement ("Great! Let's…") — the engine already prepends one, so you'd get doubles, and messages are validated/spoken independently of what precedes them. Put the reaction in the previous goal'sacknowledgefield instead.For example, the following line: "That's great to hear. What kind of timeline are you working with?". Wrong — the reaction stays in the message:
{ "messages": [{ "message": "That's great to hear. What kind of timeline are you working with?" }] }Right — the reaction becomes the previous goal's acknowledgement; the message keeps only the question:
{ "acknowledge": "That's great to hear", ... },{ "messages": [{ "message": "Roughly what kind of timeline are you working with?" }] } -
Appended goals (
appended: true): say goals whose message rides as a prefix on the next goal's turn instead of costing a turn of their own — a pitch or disclaimer delivered right before a question. The appended goal completes when its message is said (01-flow §1.5). Gate it with conditions; don't make the next goal's conditions depend on it having been performed — they run in the same turn. This is the shape for any mid-flow pitch: a non-terminal say goal that is neither appended nor ends with a question stalls the turn — the agent says it and waits for a reply it never asked for. -
Disable lead-ins (
exclusive_message) suppresses both parts and leaves only the goal's message.
2.4 Field collection
A goal collects an answer when goal_type is "ask" (absent goal_type also reads as ask) and value_type names what to collect. The answer is stored under the goal's name — usable in conditions, placeholders, webhooks, and reports.
Field type (value_type) | Collects | Notes |
|---|---|---|
approval | yes / no | agree/disagree questions; normalized to 'yes'/'no' |
selection | one of the goal's choices | closed set; §2.5 |
custom | free text — the type for any text/string answer | pair with a Field description (validation_prompt) |
email / phone | validated address / number | format-validated; failed format re-asks with a notice |
name | the contact's own name | rejects third-party/celebrity names |
address / country | location | |
date | normalized date-time | "Monday next week" → a real date |
year / month / number / quantity | numeric | options.range: [min,max] limits; `options.tense: "past" |
unit | value + unit of measure, normalized to base units | |
company / url / timezone | as named |
Booleans are 'yes'/'no' everywhere — collected values, conditions, control variables.
-
Field description (
validation_prompt, string): forcustom, describes a valid value ("A role with purchasing authority"); detection accepts only replies that satisfy it. On other types it overrides the built-in detection statement. Multiple alternatives go in as an array — never"A or B"in one string. -
Sentinel values: an open-ended question where only some answers need handling doesn't need a closed
selection. Keepcustomand name the sentinels in the description — real answers stay free text, and the sentinel is a stable value to condition on:{ "name": "use case", "goal_type": "ask", "value_type": "custom","validation_prompt": "The business purpose or use case the prospect has in mind, or \"personal\" if the use case is personal / non-business", ... }Downstream gates and tools match it like any value (
"conditions": "use case = personal"→ the disqualify path). Quote each sentinel literally in the description and keep the set tiny — one or two; more than that wants aselection(§2.5). -
Numeric answers: use a numeric type (
number,quantity,year,unit) — never aselectionof ranges ("1-10", "11-50", "50+"). Choice detection is unreliable on numbers, especially indirect replies ("we're about thirty people"), while numeric extraction normalizes them. Bucket afterwards with conditions (company size > 20) or bound withoptions.range. For both this and sentinel values, co-locate the negative paths with the question via a wrapping sequence (01-flow §1.8).
2.5 Choices
Ask goals of type approval or selection carry choices — each choice is both an answer option and a branch container:
{ "name": "interested in offer", "goal_type": "ask", "value_type": "approval",
"messages": [
{ "message": "We have an offer running — is it something you'd be interested in?" },
{ "message": "Would you be interested in our offer?" },
{ "message": "Is our offer something you'd be interested in?" }
],
"choices": [
{ "name": "yes", "acknowledge": "Great choice!" },
{ "name": "no",
"validation_prompt": ["User wants more details"],
"goals": [ { "name": "goodbye", "goal_type": "say", "messages": [{ "message": "Thanks anyway!" }] } ] }
]}
- The choice name is the collected value of the parent. Approval goals always have an implicit yes/no pair.
- Pick this choice when (choice
validation_prompt): always a string array, each entry a statement of the form"User <statement>"—"User is busy","User wants to purchase insurance". They extend or replace how the choice is detected; the statements are OR'd, so no entry may itself contain an "or":"User is busy or can't talk right now"must be two statements,["User is busy", "User can't talk right now"]. Useful when a reply implies a choice without naming it ("User wants more details"→no). - Per-choice acknowledgement: a choice's
acknowledgeoverrides the parent's when that choice is picked. - A choice may carry:
name,validation_prompt,detection_name,acknowledge,transitions, tools (fulfillment/options.llm_tools), and nestedgoals(the branch body → 01-flow §1.8). A choice is never performed — it says nothing, and tools on it fire only oncollected(the builder labels it Choice selected; fires each time the contact picks the choice) orcompleted(the branch body finished, or immediately on selection when there is none). Put messages on the parent (gated by a condition likeinterested in offer = yes) or inside the choice's nestedgoals. - Don't force a
selectionwhen the answer isn't really one of N named options: numeric answers want a numeric type, and mostly-open-ended answers with a few handled cases wantcustomwith sentinel values — both in §2.4.
2.6 How answers are detected
Detection matches the goal name + the asked message against the contact's reply. The name, the question, and the expected value must agree — that's the naming contract.
Worked failure: goal "budget for senior care" asks "Do you have any sort of budget in mind?"; contact answers "$500 is the budget". Detection tests "user's budget for senior care is $500" → neutral → not collected, because nothing said "senior care". Renaming the goal "budget" fixes it. The same applies per variant: every message must plausibly ask for the named value.
detection_name: when the flow label and the value label must differ, keepnamefor flow and setdetection_nameto the semantic label detection should use.- Escalation:
detection_model: "llm_function"switches the goal to a stronger LLM-based detector — use when the default misfires on nuanced values or choice sets (then also sharpenvalidation_promptper choice).customanswers use it by default. - Active vs. passive: the active goal's answer is checked first each turn. Beyond that, the two families of answer types differ:
- Custom types (
approval,selection,custom) are evaluated only while the goal is active — the agent asked, or a trigger phrase started the goal and the triggering utterance is checked as the answer. Passive detection (passive_detection: true) extends this while the goal is active: on a turn where the agent hasn't asked yet, such as right after a trigger phrase started it, the goal fills its field if the contact already said it. A volunteered answer to a goal that isn't active is not collected; to catch one, give the goal trigger phrases (01-flow §1.4). - Built-in types (
email,phone,name,number,date,company, and the rest of the §2.4 table) are evaluated every turn for every eligible goal — "my email is…" fills an email goal that was never asked. This is always on and cannot be switched off per goal (the panel shows Passive detection as always on for these types); the only control is eligibility (01-flow §1.3).
- Custom types (
- Two eligible goals, same built-in type (a personal and a work email): a volunteered value lands on the first eligible goal in script order — goal names do not steer it. Route with trigger phrases on the later goal, or gate the earlier one with conditions so only one is eligible at a time.
- Interrupted questions: if the explicit question sits at the start of a longer message, mark it —
"explicit_part"on the message — so an answer given mid-interruption still counts as the question having been asked.
2.7 When the contact doesn't answer
Outcome tree for an ask goal's turn:
- Refused ("I'd rather not say") → pushback, refusal mode (Pushback trigger: Contact refuses to answer): the next line from
refusal_handling(string array) is used, one per refusal, in order. When exhausted, the goal enters a long, escalating cooldown — effectively disqualified — and dependent goals stay blocked until the value changes. - Objected (an undesired answer was collected — e.g.
noon an approval) → pushback, custom mode (Pushback trigger: Custom, with its Conditions): messages markedobjection_handler: truere-ask whileobjection_conditionsholds (approval goals get a default gate of "answered and not yes").objection_handling_attempts(Attempts) caps the attempts; with dedicated pushback messages the message count is the cap. Keep at least as many plain variants as pushback lines. - Ignored (answered something else) → the goal cools down briefly and is retried later (01-flow §1.7).
{ "name": "agrees to transfer", "goal_type": "ask", "value_type": "approval",
"refusal_handling": ["I just need to know if I can transfer you."],
"messages": [
{ "message": "Can I transfer you to one of our experts?" },
{ "message": "Should I go ahead and transfer you?" },
{ "message": "Would you like me to transfer you to one of our experts?" },
{ "message": "Our rate is 1.35% flat. Can I transfer you to my supervisor?", "objection_handler": true }
]}
2.8 Responses (Q&A)
The top-level responses list answers recurring contact questions regardless of the active goal — the agent answers, then resumes the flow:
"responses": [
{ "questions": ["When was your company founded?"],
"answers": ["{%company_name%} was founded in 2019."] }
]
questions(aliastriggers) are sample phrasings;answers(aliasmessages) are the reply variants — each answer may be a full message object withconditions. A response may carrynegative_triggersandconditionslike a goal.- Normal vs. forced: normally the agent may rephrase and blend the answer with knowledge;
force_response: truedelivers the text exactly — for sensitive wording. - Response vs. goal precedence: a trigger phrase that starts a goal beats a response on the same utterance. If something exists only to answer a question, make it a response, not a goal — goals hijack the flow position (01-flow §1.7).
- A set of built-in questions (agent name, reason for call, "are you an AI?", …) is answered via
%responses_*%control variables, not via this list — override those instead (04 §4.2).
2.9 Phrasing guidelines
How to word what the agent says — each rule's mechanics live in the linked section:
- Ask positively. No negatives or double negatives ("Are you sure you do not want…", "Can you not attend?") — they confuse both the contact and answer detection (§2.6).
- Acknowledgements go in the previous goal, never at the start of a message ("Great! Let's…" doubles up with the engine's own acknowledgement). Use the ask goal's
acknowledgefield, and skip generic ones entirely — "Great", "Thanks", "Sure" are added automatically (§2.3). - Question first, details after. Lead a message with the explicit question so an interrupted contact has still been asked (§2.6); use a lead-in for softeners rather than baking them into the message (§2.1).
- Standard copy belongs in its dedicated variable, not in messages: the call intro (
%call_intro%), the verification question (%speaker_verification_question%), voicemail text, and the built-in Q&A answers (%responses_*%) — 05 §5.1, 04 §4.2. Re-writing these inside goals duplicates what the built-ins already say. - Format spoken values. Phone numbers, dates, and amounts placed in messages need formatting specifiers (
{phone:local_phone:digits}) or they're mispronounced (04 §4.2). - Write for the ear: short sentences, contractions, one idea per message — and real variety across variants, not word-swaps (§2.1). Budget: a message stays under ~35 spoken words; if it needs more, split it or cut it — monologues lose contacts.