Concept
Clarification is the right pattern when the supervisor has too little information to select a specialist. Instead of guessing, gather one routing field with a globalGATHER, then use deterministic HANDOFF conditions over the clarified answer. Keep a quoted semantic fallback for answers that don’t cleanly match any expected value.
One thing to get right when you write that fallback condition: keep it in ordinary lowercase sentence form. The runtime’s classifier that decides whether a quoted WHEN string is natural language or a structured expression checks for AND/OR/NOT case-sensitively (uppercase only) in the step that ultimately matters, but an earlier quote-unwrapping check matches and/or case-insensitively. In practice this means:
- Lowercase connector words in an ordinary sentence (like “the clarified route topic is unsupported or still unclear”) work correctly and are treated as natural language.
- The same sentence with an uppercase
OR/AND/NOTcan be misclassified as a structured deterministic expression instead — and since ordinary English words aren’t valid variable names, that misclassification will fail rather than degrade gracefully.
Minimal working example
customer_id is passed as context with no declared source in this example — treat it as a project-local assumption (typically populated from authentication) and declare it via MEMORY in your actual project.
How it works
- The top-level
GATHERruns before anyHANDOFFis evaluated — the supervisor asks its one clarification question and waits forroute_topicbefore routing. - The two deterministic routes compare
route_topicagainst expected values directly. Ifroute_topicsomehow weren’t set yet, the comparison would simply evaluatefalse— no error, and the trace shows your literal authored condition text. - The fallback route’s quoted condition is evaluated by the runtime’s semantic-routing classifier, not a deterministic expression evaluator — which is exactly why the lowercase-wording rule above matters.
- Since
HISTORYis omitted from everyHANDOFF, each specialist now receives the full conversation history by default (the current platform default).
Common variations
- Global gather before any specialist route (shown above).
- A fallback agent gathers clarification itself and returns to the supervisor (see the fallback-routing HowTo) instead of resolving directly in the supervisor’s own
GATHER. - Multi-intent disambiguation when several valid routes are detected in one message, instead of a single missing-field clarification.
Verification
- Parse and compile the ABL and confirm there are no parser or compiler errors/warnings.
- Test at least one matching utterance for each specialist route, plus an utterance that should hit the fallback (something outside billing/technical support).
- Deliberately test with an answer containing the word “or”/“and” in lowercase to confirm the fallback still classifies correctly; avoid ever writing an uppercase
AND/OR/NOTinto a quoted fallback condition. - Inspect the trace for the selected target and the evaluated condition (matches your literal authored text for the deterministic routes).
Production readiness checklist
- The gathered field asks for exactly the one value needed to route — nothing more.
- Deterministic conditions use declared, gathered, tool-result, runtime, or returned fields.
- Semantic fallback conditions are quoted, written as ordinary lowercase sentences, and never contain a capitalized
AND/OR/NOT. - Fallback behavior is explicit and does not hide missing intent coverage.
- Any variable assumed to already exist (like
customer_idabove) has a real declared source in your project.