Concept
A sub-intent is a short handler that lives inside oneFLOW step. It works only while that step is current. When the customer’s message matches a sub-intent, the runtime runs the handler’s actions and then returns to the step.
Choose the construct by scope and by what must happen next.
A sub-intent has no global form. It applies only to the step that declares it.
Minimal working example
A returns agent asks for an order number and then a reason. While it asks for the reason, the customer may say “change my order number”. The sub-intent clears the order number and asks for it again.order_idandreturn_reasonareGATHERfields that the customer supplies.- The sub-intent clears
order_id. Theconfirmstep reads both values.
How it works
Each sub-intent is a list item that starts withINTENT:. The properties are:
Do not use
WITH or AS in a sub-intent. They are compile error E203.
Any other key that is not in the table is dropped without an error or a warning. This includes KEYWORDS, CONDITION, GOTO, and a misspelled property name. The dropped key has no effect on the sub-intent or on the step. A sub-intent cannot jump to another step. Use a digression for that.
What happens on each customer message, in order:
- The step’s digressions are checked, then the flow’s global digressions.
- If none matched, the sub-intents of the current step are checked.
- If none matched, the runtime checks whether the parent supervisor should take the message back.
- If none matched, the step handles the message as usual, with
GATHERextraction andON_INPUT.
- A decision-model check runs first, when your project enables it.
- The classifier runs with the sub-intent names as the only candidates. A match needs the classifier to return one of those names. There is no per-candidate confidence threshold.
- The keyword fallback runs when the classifier is unavailable, subject to
LEXICAL_FALLBACK(defaultwhen_unavailable).
INTENT, such as "change my order number". A plain name such as change_order_number has no keyword path. With the classifier off it can never match.
What happens after a match:
- The actions run in this order:
CLEAR,SET,CALL. - With a
RESPOND, the runtime sends the reply and ends the turn. The step stays current. The pending question is not repeated in the same turn. - Without a
RESPOND, the step runs again with an empty message. It asks the pendingGATHERquestion again.
Common variations
Reply and then repeat the question
Leave outRESPOND when the handler only changes state. The step then repeats its question.
delivery_choice variable and a step with a GATHER.
Call a tool in the handler
AddCALL to look something up, and RESPOND to answer from the result. Declare the tool with a read_only effect and a parameter description, or the compiler warns.
Semantic names with the classifier on
Use a name such aschange_order_number when the classifier is always on. The classifier reads the name and matches the meaning. Keep the quoted phrase form when you need a keyword fallback.
Verification
- Run the validator. Expect no errors and no warnings.
- Give an order number. When the agent asks for the reason, say “actually, change my order number”.
- Expect the reply “No problem. Let’s start with the order number.” and the order number cleared.
- In the trace, open the
sub_intentevents. Checkintent,matched,detectionMode, andclassifierConfidence. - Say “it arrived broken”. Expect the step to take the answer as the reason.
- Say the same sub-intent phrase during
collect_order. Expect no match, because the sub-intent belongs tocollect_reason.
Production readiness checklist
- Every sub-intent
INTENTis a quoted phrase when the classifier can be off. - Every sub-intent has a
RESPOND, or the pending question follows. - No two sub-intents in a step share a label.
- Every key in a sub-intent is in the property table. A key that is not listed is dropped without a message.
- Tests cover a matching phrase, a phrase for another step, and a normal answer.
- Tests run with the classifier on and off.
Common mistakes
Troubleshooting
Related articles: