Skip to main content

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

PropertyTypeRequiredDescription
fieldsstring[]YesDatapoint slugs to collect (required fields)
optionalstring[]NoDatapoint slugs to ask for but not require
instructionsstringNoGuidance for the LLM on how to collect
namestringNoHuman readable step name (creates goto target)
retry.maxnumberNoMax attempts for invalid input (default: 3)
retry.messagestringNoMessage shown on invalid input

How It Works

  1. Check which fields are already collected
  2. Extract values from the user message
  3. Validate values against datapoints
  4. Store valid values in variables
  5. 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]