AI Flow
The AI Flow scenario block allows you to invoke an AI Flow designed in AI Agent 2.0 for purposeful interactions with customers in both voice and chat scenarios.
Prerequisites
- Your service provider has enabled AI Agent 2.0
- At least one live AI Flow is configured via AI Agent 2.0
- For voice scenarios:
- At least one Speech-to-Text integration account is configured
- Text-to-speech is set up via Set Language block
Settings
Title Text
The name of the instance of the block in the scenario.
Account
<<Default>> points to the AI Agent 2.0 account supplied by your service provider.
AI Flow
Select from the list of all published AI Flows in the corresponding account that have been marked Live.
Input Data
Input variables in the scenario block optionally allow you to pass information to the AI Flow, provided that corresponding input values are defined inside the AI Flow.
Click the Validate Input Data button after changes have been made to the AI Flow.
Return variable prefix
Name a scenario variable to store the JSON data returned from the AI Flow (e.g. jsdata), provided that corresponding return values are defined inside the AI Flow.
Individual fields within the structure are accessible via dot notation (e.g. jsdata.summary).
Transcriber
Required for AI Flow blocks used in voice scenarios.
The speech-to-text service that will be used to transcribe the user's statements. Select from among the configured Speech-to-Text (STT) integration accounts, or select <<default>> to use the account configured by your service provider as part of AI Package.
End of phrase timeout
The duration of silence after the customer's reply that indicates they have finished speaking. When the customer begins speaking, their reply is recorded until there is a pause with duration equal to the End of phrase timeout, at which point their reply is considered finished and is sent to the AI Flow for evaluation.
When enabled, this allows you to specify a custom amount of silence, after which STT considers a phrase completed. Otherwise, the system defaults to a 0.8 second timeout.
Allow interpreting prompt by customer voice
Note: Use of this setting is not recommended at present.
Only for AI Agent blocks used in voice scenarios.
When enabled, the block constantly listens for the customer's voice while an AI message is playing. When a voice is detected during an AI message, the block will:
- Stop playing the AI message
- Record and transcribe the customer's response
- Continue the interaction by sending the customer's response to the AI provider for evaluation
When disabled, the block will begin to listen for the customer's voice only after the entire AI message has been played. Any voice input from the customer before the AI message ends is ignored.
Speech contexts
Only for AI Flow blocks used in voice scenarios.
An optional list of words or phrases likely to be said by the customer. Listed terms are more likely to be transcribed accurately. See the Speech context setting of the Play-Listen block for more information.
Prompt to play while waiting for AI
Only for AI Flow blocks used in voice scenarios. For best results, you may wish to handle these prompts via AI Flow Settings instead.
The selected audio prompt will play while the block waits for the AI provider to return a response. You may find that a musical prompt or sound effect helps customers understand that the system is processing their response.
Trim final response message
Controls whether the final message from the AI Flow is sent to the customer when the block exits.
- When enabled (default), the final AI response is trimmed (removed) from the transcript and is not sent to the customer.
- When disabled, the final response is sent to the customer and included in the transcript.
Regardless of whether this option is enabled, the final response from the AI is always stored in the $(aiFlowFinalMessage) variable for later use.
AI Flow execution timeout
Enter the maximum time (in seconds) the block will wait for the AI Flow to respond after receiving the customer's input. If no response is received before this time, the block will exit via the Timeout branch. For more complex use cases, you may wish to increase this time period.
Customer reply timeout
Enter the maximum time (in seconds) the block will wait for the customer to provide a response after the AI has presented a prompt. If no response is received, the block will request a new message from the AI Flow, while indicating that the customer did not reply to the previous message. The maximum number of repeated attempts to elicit a response from the customer is defined by the Max consecutive reply attempts setting. The default value is 60 seconds, but it can be set from 1 to 300.
Max consecutive retry attempts
The maximum number of consecutive times that the block will wait the full Customer reply timeout period and try to elicit a response from the customer. Once the maximum number of attempts has been made, the block will exit via the Incomplete branch.
Conditional Branches
The AI Flow block exits normally when the main objective defined for the AI Flow is successfully completed. If this does not occur, the scenario will take one of the following exit paths.
Note that any return data collected to that point will be accessible later in the scenario via the Return variable prefix.
Failed
This branch is reserved for unrecoverable errors or connectivity issues between Bright Pattern and AI Agent 2.0. You may wish to add another AI Flow block here to try to recover.
Timeout
This branch is taken when the configured AI Flow execution timeout is reached before the AI Flow can achieve its intended objective. You may wish to add a suggestion to connect to a human agent.
Incomplete
This branch is taken under the following conditions:
- If the customer disconnects or stops responding before the AI Flow reaches its intended objective, exceeding the configured Customer reply timeout and Max consecutive retry attempts.
- If the AI Flow determines it cannot complete the objective with the available information, configured capabilities, or according to its instructions prompt.
- If the AI Flow cannot complete the objective within the internal timeout configured within AI Agent 2.0, for any reason other than a fatal error. By default, this timeout value is set to 2 hours.
Escalate
This branch is taken when the AI Flow meets the configured escalation criteria defined inside AI Agent 2.0.
Note that Allow Escalation must be enabled in the corresponding AI Flow Settings in order for LLM to send the escalation request signal.
Variables
The AI Flow block populates several scenario variables to help you understand how the block is operating.
Error Codes
| Code | Description |
|---|---|
| -1000 | AI Flow account is either not specified or has been deleted. |
| -1001 | Speech-to-Text account is either not specified or has been deleted. Applicable only to voice scenarios. |
| -1002 | The AI Flow scenario block is not enabled by your service provider. |
| -1003 | Connection error between Bright Pattern and AI Agent 2.0. |
| -1004 | Reached the maximum number of consecutive turns without receiving a customer reply (as configured by Max consecutive retry attempts). |
| -1005 | AI Flow account did not provide any response or results during the most recent turn. |
| -1006 | The transcriber was not able to recognize the customer response. Applicable only to voice scenarios. |
| -1007 | The AI Agent prompt response could not be played to the customer. This may be due to Speech-to-Text issues. |
| -2000 | Other error from the AI Flow. The entire API Flow response payload is available in the aiFlowErrorMessage variable and can be useful for understanding the error reason. |