branches array and tag each conditional question with the branch’s ID.
How branching works
Setting up a branch is a two-step process:1
Declare the branch
Add a branch object to the top-level
branches array. Give it a unique id and a condition that references an earlier question by its name.2
Tag the conditional questions
On each question that should only be asked when the branch condition is true, add
"branch_id": "<your-branch-id>". You can tag as many questions as you like with the same branch_id.Branch object fields
string
required
A unique identifier for this branch. Referenced by questions using
branch_id. Use a short, descriptive slug — e.g., "fever-details".object
required
The trigger condition. Evaluated when the call reaches any question tagged with this branch’s ID.
If you include both
equals and present in the same condition, present takes precedence and equals is silently ignored.Completion
Branch questions that were never activated do not block thecomplete status. If a call reaches the end of the question list without ever triggering a branch condition, the conversation is still marked complete — the skipped branch questions are treated as if they were not part of the required flow for that caller.
Save validation errors
If the agent save is rejected due to a branching configuration problem, the400 response includes a validation_issues array. Each issue has a field and a message. The following configuration errors are caught at save time:
- Unknown
branch_idon a question — thebranch_idvalue does not match any branch declared inbranches. condition.fieldreferences a non-existent question — no question with thatnameexists in thequestionsarray.- Controlling question appears after the branch’s questions — the question named in
condition.fieldmust precede all questions tagged with this branch. equalscondition on a non-boolean question —equalsis only valid when the controlling question hasresponse_type: "boolean".- Duplicate branch IDs — two or more branches share the same
id. - Branch missing required fields — a branch object is missing
id,condition, orcondition.field.
Example
This agent asks whether the caller has a fever. If they answer yes, it branches into two follow-up questions about their temperature and how long the fever has lasted.temperature and fever_duration_days are only asked if the caller answers yes to has_fever. The final question (on_medication) is asked for all callers.