Concept
A globalGATHER is the top-level GATHER: section of an agent. It declares the fields the agent needs. The runtime does the collection work around the model:
- It lists the fields in the agent prompt, in declaration order, and marks each as required or optional.
- On each customer message, it extracts values for all missing fields in one pass.
- It validates each value and stores the good ones.
- The model asks for whatever is still missing.
GATHER inside a FLOW step. See Collect information inside a FLOW step.
Completion is separate from collection. A COMPLETE rule fires when its WHEN condition is true. Write that condition on the fields you need, for example amount IS SET.
Minimal working example
A transfer assistant collects the source account, amount, and date. The memo is optional.agents/transfer-intake.agent.abl
- All four variables are
GATHERfields that the customer supplies. COMPLETEreads the three required fields. The memo is optional and does not block completion.
How it works
Field syntax:- Write each field as a named block: the field name, a colon, and indented properties. The name uses letters, digits, and underscores. A name with a hyphen or a dot is not recognized.
- Property keys are case-insensitive.
- A list form such as
- amount: requireddoes not work in a top-levelGATHER. It produces no fields and no error. Use the list form only inside aFLOWstep. - An inline form such as
GATHER: a, bis a compile error.
How the runtime normalizes a value:
integer,number,float, andcurrencybecome numbers.booleanacceptstrue,yes,1, andfalse,no,0.dateanddatetimebecome ISO values.semantics.temporal: pastorfuturelimits the direction.emailis lowercased.phonebecomes an E.164 number, with the US as the default country.enumis matched tooptionsand synonyms.
- A required field is missing when it has no value and no
default. activation: optionalis never missing. See Progressively collect fields only when needed.- A plain optional field, one with no
extraction_pattern,infer,prompt_mode: extract_only, orstrategy, is left out of the extraction pass. See Collect required and optional fields from users.
Common variations
Validate a value and retry
Addvalidate and a retry_prompt for a value with a fixed format. On a failure the model receives the field error and the retry prompt as a hint, and asks again. max_retries counts failed attempts and records them in the trace. It does not stop the agent from asking, and it does not run an ON_ERROR action. To escalate after repeated failures, collect the field in a FLOW step. See Collect information inside a FLOW step.
agents/claim-intake.agent.abl
validate:
- Write a regular expression with a single backslash, such as
^\d{9}$. A double backslash is kept as two characters and never matches. - A regular expression check rejects every value of type
number,integer,currency, orboolean, because those values are not text. Validate those types withtypeandsemantics, or collect the value asstring. validate: min(1)is read as a regular expression, not as a numeric minimum.retry_prompt,max_retries, orvalidation_processwithout avalidateis a compile errorGATHER_VALIDATION_RULE_REQUIRED.- An unsafe expression, such as
(a+)+$, fails compilation.
validation_max_retries trace event when the limit is reached. It resolves a matching ON_ERROR rule and applies its SET assignments, but it does not run the rule’s RESPOND, ESCALATE, or COMPLETE action. With inline_gather: true it does not resolve ON_ERROR at all. The retry-limit action runs only in a FLOW step.
A supervisor that collects first
ASUPERVISOR can declare GATHER. Use it when routing needs a value, such as a policy number. See Pass specific fields between agents.
Collect several fields in one reply
Adddescription and extraction_hints to guide extraction, or set inline_gather. See Collect multiple fields across a natural conversation.
Verification
- Run the validator. Expect no errors and no warnings.
- Say “I want to send 200 dollars”. Expect the agent to ask for the source account and the date, and not for the amount.
- Give a bad value for a validated field. Expect the agent to explain the format from the
retry_prompt. - Give all required values. Expect the
COMPLETEreply. - In the trace, open the
dsl_collectevents with the modereasoning_gather. They list the extracted fields. - Open the
completion_checkevent for the completion decision.
Production readiness checklist
- Every field has a
promptand atype. - Every required field is read by
COMPLETE, a flow step, or a route. Otherwise the compiler warnsUNUSED_REQUIRED_GATHER_FIELD. - Formats use single-backslash regular expressions.
- Fields with a fixed format have a
retry_prompt. A field that must escalate after repeated failures is collected in aFLOWstep. - Tests cover a customer who gives everything at once, one value at a time, and an invalid value.
- Field names are not
user_id,session_id,tenant_id, orproject_id. The compiler warnsSYSTEM_IDENTIFIER_SHADOWfor them.
Common mistakes
Troubleshooting
Related articles: