How to Check AI Agent Response in Scenario?
Checking the agent response allows detecting situations when the agent cannot give an answer and suggests transferring the query to an operator. This allows automatically directing complex queries to the operator.
When Needed
- You need to automatically detect when the agent cannot respond.
- You need to direct complex queries to the operator.
- You need to handle situations when the agent suggests transferring the query to an operator.
What's Important to Know
- Keyword checking — function for detecting certain words or phrases in the agent's response.
- If a keyword is found — the scenario continues (for example, connecting to operator).
- If a keyword is not found — the scenario goes to the error branch, and the client can be shown the AI agent's response.
Prerequisites
You are logged in with integrator or administrator rights. The action_fastline_proaction is used in the scenario.You know which keyword or phrase to search for (for example, "operator").
Step-by-Step Instructions
- In the scenario constructor, find the "Action" block with the
action_fastline_profunction. - After the action block, add a "Condition" or "Check" block.
- In the block settings, specify the keyword checking function.
- In parameters, specify:
{
"keywords": "operator",
"module_name": "client_answer"
}
keywords— keyword or phrase to find in the response. Example:"operator","оператор","передати оператору".module_name— name of the variable where the agent's response is stored (for example, from the previous step). Example:"client_answer","agent_response".
Configure scenario branches:
- If keyword is found — the scenario continues (for example, connecting to operator).
- If keyword is not found — the scenario goes to the error branch, and the client can be shown the AI agent's response.
Save changes in the scenario.
Scenario Behavior
If keyword is found:
- The scenario continues on the "found" branch
- You can connect an operator or perform other actions
- The user receives appropriate processing
If keyword is not found:
- The scenario goes to the error branch
- The client can be shown the AI agent's response
- The agent's response is considered successful
What Happens After
After configuring the check, the system automatically analyzes the agent's response for the presence of keywords. Depending on the check result, the scenario directs the user to the operator or shows the agent's response.
How to Verify It Worked
- Check that the keyword is specified correctly.
- Make sure the variable name in
module_namematches the variable with the agent's response. - Test the scenario with different agent responses.
- Check that scenario branches work correctly.