Collect and Store Customer Information with Ask For (Beta)

Use ask for inside reasoning instructions to collect information from the customer, one field at a time, and store each response in a variable. For every ask for instruction, Agentforce prompts the customer for a single value, saves the response to the specified variable, and then routes back to the same subagent to collect the next value. The agent routes to the same subagent until every ask for variable is populated.

Agentforce validates responses against the variable’s type. For example, if a variable expects an email address and the customer enters something that isn’t a valid email, the agent asks again until it receives a valid value.

When to use: Use ask for when your subagent needs structured input, like an intake form, before it can transition to the next step or run a downstream action.

Example Agent to Collect Address and Email
1#This subagent collects information from the user. When all the information is collected, the subagent transitions to another subagent
2subagent patient_intake:
3    description: "Gather the patient's street address, city, and email — one field at a time."
4    reasoning:
5        instructions: ->
6            ask for @variables.patient_address_line1
7                instructions: |Please provide the first line of your address (house/building number and street name only).
8            ask for @variables.patient_city
9                instructions: |Please provide your town or city.
10            ask for @variables.patient_email
11                instructions: |Please provide your email address.
12
13    after_reasoning:
14        if @variables.patient_email is not None:
15            transition to @subagent.patient_symptoms
16
17subagent patient_symptoms:
18
19# This subagent demonstrates a transition target; it doesn't do anything
20 label: "patient_symptoms"
21 description: |
22     Collects the patient symptoms
23 reasoning:
24     instructions: ->
25         | Ask the customer about their symptoms