await_response.mdx
Overview
The Await response component is designed to halt a workflow and wait for user input before proceeding. It initiates a conversation with the user and collects key information through predefined forms. This component is typically used in conversational workflows or agent-based interactions where user input is required to continue the process.
Purpose and Functionality
Pause Workflow: Temporarily stops the automated workflow to wait for user input.
Display Agent Messages: Sends static or randomized messages to the user to prompt or guide input.
Collect User Input: Gathers one or more user inputs defined as global variables with various input types.
Validate Input: Supports mandatory and optional variables ensuring required data is collected before proceeding.
Detailed Explanation
Configurations
1. Guiding Question
Description: Configures whether the message defined in the Message field is displayed to the user.
Type: Boolean toggle (show/hide).
Usage: Helps determine if the user should see a prompt before input.
2. Message
Description: Defines the static message(s) sent to the user when the component is activated.
Multiple Messages: You can add multiple messages. When multiple messages exist, one is randomly selected for display to keep interactions dynamic.
Usage Example:
"Please provide your contact details."
or
"We need some additional information to proceed."
3. Input Variables
Purpose: Collects user inputs required for the workflow to continue.
Configuration: You can add multiple global variables with attributes:
Name (Required): Descriptive label shown to users.
Type (Required): Defines the kind of input expected.
Key (Required): Unique internal identifier for the variable.
Optional: Indicates if the input is required or optional.
Supported Input Types:
Type | Description |
|---|---|
Single-line text | Accepts a single line of text without line breaks. |
Paragraph text | Accepts multi-line text input with line breaks. |
Dropdown options | User must select one value from a predefined list of options (at least one option required). |
File upload | Allows uploading one or multiple files. |
Number | Accepts numeric input. |
Boolean | Toggle input (on/off). |
Important Note:
For file uploads, the uploaded file's token count must stay within the model provider's maximum token limit to avoid truncation.
Usage Example
Imagine a support chatbot workflow where the bot needs the user’s email and a description of their issue before escalating:
Message: "Please provide your email and a brief description of your issue."
Input variables:
Email (Single-line text, Required, key:
user_email)Issue Description (Paragraph text, Required, key:
issue_desc)
The Await response component will display the message, pause the workflow, and wait until the user provides the required inputs.
Implementation Details and Algorithms
Random Message Selection: When multiple messages are configured, the component randomly picks one to display. This randomness adds variation to user interactions, improving conversational naturalness.
Input Validation: The component enforces input requirements based on the "Optional" flag for each variable, ensuring that mandatory data is collected before proceeding.
Token Count Handling for Files: To prevent incomplete data, the component advises limiting file upload size according to model token limits. This ensures data integrity when processing file content.
Integration and Interaction
Client Interaction:
To interact programmatically with this component, clients must call the Converse with agent API. This can be done via:HTTP method: Converse with agent
Python SDK method: Converse with agent
Workflow Integration:
The component fits into conversational workflows as a blocking step that halts progression until user input is received, thus enabling dynamic branching based on user responses.
Mermaid Flowchart Diagram
flowchart TD
A[Await Response Component] --> B{Display Message?}
B -- Yes --> C[Select Random Message]
C --> D[Send Message to User]
B -- No --> D
D --> E[Define Input Variables]
E --> F{For each variable}
F --> G[Collect User Input]
G --> H{Is input valid and mandatory?}
H -- Yes --> I[Store Input]
H -- No --> G
I --> J{All inputs collected?}
J -- No --> G
J -- Yes --> K[Resume Workflow]
Diagram Explanation:
The component optionally displays a message (randomly selected if multiple exist).
It defines multiple input variables, each collected and validated in turn.
The workflow is paused until all mandatory inputs are collected and validated.
Once complete, the workflow resumes.
Summary
The Await response component is a critical building block for workflows requiring user interaction. It is flexible, supporting multiple input types and validation rules, and offers an engaging user experience through message randomization. Integration via API ensures it can be programmatically controlled and embedded within larger conversational systems.