- In a multi-turn conversation, where the user provides or receives one piece of data at a time
- Through a form, which prompts the user for several pieces of data in a single conversational turn
userflow() object.
Parameters:
{flow.input.*} and {flow.private.*} expressions. Falls back to display_name when not set.Multi-turn user activity
A UserActivity is a single-widget user interaction node. Each activity holds exactly one widget. This approach separates the internal node name from the label shown in the chat, and lets you inject flow variables into both the chat prompt and the display label.Variable substitution
You can use{flow.input.*} or {flow.private.*} expressions in label, agent_message, and text fields. These expressions are resolved when the interaction is rendered to the user.
activity() parameters
Call activity() on the userflow() object to create a UserActivity node. Then attach one widget using one of the widget methods on the returned node.
Widget methods
After you create an activity withactivity(), attach one widget by calling one of the methods below on the returned node.
The agent_message parameter is available on all input widgets. Use it to set the chat prompt shown to the user. It supports variable substitution.
text_input_field
text_input_field
{flow.input.*} and {flow.private.*} expressions.False to create a multi-line text area. Defaults to True.boolean_input_field
boolean_input_field
{flow.input.*} and {flow.private.*} expressions.False to display as radio buttons. Defaults to True.number_input_field
number_input_field
{flow.input.*} and {flow.private.*} expressions.False to accept decimal numbers. Defaults to True.date_input_field
date_input_field
{flow.input.*} and {flow.private.*} expressions.datetime_input_field
datetime_input_field
{flow.input.*} and {flow.private.*} expressions.file_upload_field
file_upload_field
{flow.input.*} and {flow.private.*} expressions.activity():
Multi-turn conversations (Legacy)
You can also collect or deliver one piece of data at a time using thefield() method on the userflow() object. This method combines the node name, widget type, and chat prompt into a single call.
Text, Date, DateTime, Time, Number, File, Boolean, Object, Choice.field():
Forms user activity
To prompt for multiple pieces of data in a single turn, callform() on the userflow() object to create a form node.
Form fields
After you create a form withform(), add fields to it. Each field type accepts its own set of parameters. You can inject flow variables into a field’s label using {flow.input.*} and {flow.private.*} expressions. These expressions are resolved when the form is rendered to the user.
Supported field types:
text_input_field
text_input_field
{flow.input.*} and {flow.private.*} expressions.False to create a multi-line text area. Defaults to True.boolean_input_field
boolean_input_field
{flow.input.*} and {flow.private.*} expressions.False to display as radio buttons. Defaults to True.date_range_input_field
date_range_input_field
{flow.input.*} and {flow.private.*} expressions.date_input_field
date_input_field
{flow.input.*} and {flow.private.*} expressions.datetime_input_field
datetime_input_field
{flow.input.*} and {flow.private.*} expressions.datetime_range_input_field
datetime_range_input_field
{flow.input.*} and {flow.private.*} expressions.number_input_field
number_input_field
{flow.input.*} and {flow.private.*} expressions.False to accept decimal numbers. Defaults to True.file_upload_field
file_upload_field
{flow.input.*} and {flow.private.*} expressions.message_output_field
message_output_field
field_output_field
field_output_field
list_output_field
list_output_field
list_input_field
list_input_field
file_download_field
file_download_field
single_choice_input_field
single_choice_input_field
{flow.input.*} and {flow.private.*} expressions.False to display as radio buttons. Defaults to True.multi_choice_input_field
multi_choice_input_field
{flow.input.*} and {flow.private.*} expressions.False to display as checkboxes. Defaults to True.user_input_field
user_input_field
multiple_users=True. Accepts an integer or a DataMap for dynamic configuration through expressions.form():
Dynamic form input
Form fields can change based on user actions. You define the dependencies between user interactions and your tools to control dynamic behavior in the form. This includes progressive selection, showing or hiding widgets, and updating widget labels. Use the following methods to configure dynamic forms:visibility_behaviour_field
visibility_behaviour_field
impacted_field that changes visibility.label_behaviour_field
label_behaviour_field
impacted_field whose label changes.
