How-to
Article MarkdownReport an error

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


Step-by-Step Instructions

  1. In the scenario constructor, find the "Action" block with the action_fastline_pro function.
  2. After the action block, add a "Condition" or "Check" block.
  3. In the block settings, specify the keyword checking function.
  4. 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".
  1. 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.
  2. 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_name matches the variable with the agent's response.
  • Test the scenario with different agent responses.
  • Check that scenario branches work correctly.

Using your own AI agent?Install the open skill so your AI agent can work with current official ConnectiveOne documentation.Get the skillNeed support?Couldn’t find the answer or need help from the ConnectiveOne team? Create a request in Client Portal.Create a request