Concept
AGATHER inside a FLOW step belongs to that step. The step stays active until its required fields are filled. Then the flow moves to the next step with THEN.
This differs from a top-level GATHER in four ways:
Set
REASONING: false on a collection step for deterministic behavior. Collect in one step and read the answer in the next step. This keeps the branching in ON_INPUT separate from the collection.
For the model-led alternative, see Collect information with global GATHER.
Minimal working example
An appointment agent collects contact details in one step and scheduling details in the next. The phone number and notes are optional.agents/appointment-booker.agent.abl
- Every variable is a
GATHERfield. The customer supplies each one. - The
confirmstep readsfull_name,service_type,preferred_date, andemail. The optional fields are not read there.
How it works
- The flow enters
collect_contact. The step asks for the missing required fields. It joins the prompts, one per line, in declaration order. - The turn ends. The step waits for input.
- The customer replies. The runtime extracts values for all the step’s fields, required and optional, in one pass. A customer can give several values in one message.
- The runtime validates the values and stores the good ones.
- If required fields are still missing, the step asks again. The repeat uses the field’s
retry_prompt, then itsprompt, then a fixed message. - When all required fields have values, the step falls through to its
THEN.
Field forms
Inside a step, write each field in one of these forms. The keys are case-insensitive.Inheriting a top-level field
A step field inherits the properties of a top-levelGATHER field of the same name. The step overrides only the properties it sets.
A step field that sets nothing but required or optional, such as - notes: optional, does not override required. The inherited value stays. Add another property, such as a prompt, to override it.
Common variations
Inherit, correct, and confirm
Declare the fields once at the top level. Reference them in the step. Turn onCORRECTIONS so the customer can change a value that was already collected. Confirm in the next step with ON_INPUT.
agents/card-replacement.agent.abl
Shape the step prompt
SetPRESENT for an introduction. Set PROMPT for the question text. Use {{_missingList}} or {{_missing}} for the names of the missing fields. See Collect multiple fields across a natural conversation.
Limit attempts
SetMAX_ATTEMPTS and ON_EXHAUSTED on the step. After that many failed collection attempts, the flow moves to the step you name. Use it to hand off to a person.
Per-field retry limit
max_retries counts failed validations for one field. When it runs out, the flow follows ON_ERROR for validation_error with the subtype max_retries_exceeded.
Verification
- Run the validator. Expect no errors and no warnings.
- Start the conversation. Expect the first step to ask for the name and the email together, and not for the phone number.
- Reply with the name and the email in one message. Expect the flow to move to the schedule step.
- Reply with an invalid email. Expect the step to ask again.
- In the card example, say “no” at the confirmation. Expect the flow to return to
collect_card. - In the trace, open the
dsl_promptevents with the modegather.missingFieldslists what the step asked for. - Open the
dsl_collectevents with the modegather. They list the extracted fields.
Production readiness checklist
- Each collection step sets
REASONING: false. - Each step that must ask for a field marks it required.
- Each field has a
prompt. - Each step has a
THEN, so the flow does not stall after collection. - Collection and
ON_INPUTbranching are in separate steps. - A step that can loop has
MAX_ATTEMPTSandON_EXHAUSTED. - Tests cover all values in one message, one value at a time, a bad value, and a correction.
Common mistakes
Troubleshooting
Related articles: