collect Step
The collect step gathers information from users through natural conversation. The LLM extracts data from user messages and validates it against datapoint definitions.
Syntax
Short Form
- collect: [field1, field2, field3]
Full Form
- collect:
fields: [field1, field2]
optional: [field3]
instructions: "Custom guidance for the LLM"
name: "Step Name"
retry:
max: 3
message: "Please provide valid information"
Properties
| Property | Type | Required | Description |
|---|---|---|---|
fields | string[] | Yes | Datapoint slugs to collect (required fields) |
optional | string[] | No | Datapoint slugs to ask for but not require |
instructions | string | No | Guidance for the LLM on how to collect |
name | string | No | Human readable step name (creates goto target) |
retry.max | number | No | Max attempts for invalid input (default: 3) |
retry.message | string | No | Message shown on invalid input |
How It Works
- Check which fields are already collected
- Extract values from the user message
- Validate values against datapoints
- Store valid values in variables
- Continue or re ask
Examples
Basic Collection
- collect: [email, phone]
With Optional Fields
- collect:
fields: [shipping_address]
optional: [phone_number, delivery_notes]
With Instructions
- collect:
fields: [device_serial]
instructions: |
Ask for the device serial number.
Format: XX-XXXX-XXXX
Named Step (for goto)
- collect:
name: Get Order Details
fields: [order_id]
Accessing Collected Data
After collection, values are available as $variables.<slug>:
- collect: [email, name]
- action: notifications.send
inputs:
to: "$variables.email"
Pre Filled From Context
If a value already exists in context, you can skip collection:
- if: "$user.identity.user_email"
then: continue
else:
- collect: [email]