Skip to main content

AI agent routing

Rules can perform actions after the conversation starts. This guide reassigns the conversation to a different AI agent with rules and tags in a dialog.

The plan​

This example continues with the agent created in Build your first AI agent. In this example, a gym's Upsell Agent handles membership payments. When the user wants to change their membership plan, a rule assigns the conversation to a different AI agent, the Change plan Agent. This AI agent is of the Customer Support type.

To do this, create a dialog in Agent 1 that triggers when the user asks to change their membership plan. This dialog uses a tag that the rule evaluates. The rule then assigns the conversation to the Change plan Agent.

note

To create an AI agent from scratch, see Build your first AI agent.

Create the dialog​

A dialog is a set of messages that the AI agent sends to the user. In this case, create a dialog in the Upsell Agent that triggers from an intent matching when the user asks to change their membership plan.

Intent​

  1. Go to AI Agents.
  2. Select the Upsell Agent.
  3. Go to Workflows > Intents.
  4. Select Create intent.
  5. Name the intent Change plan.
  6. Add examples of what the user says when they want to change their membership plan. For example:
    • I want to change my membership plan.
    • Can I change my membership plan?
    • How can I change my membership plan?
  7. Select Save.

Dialog​

The key point of this dialog is the replay action. This action triggers a message on the user's behalf. The user does not see this message, but the rule evaluates it and the logs show it.

  1. Go to Workflows > Dialogs.
  2. Select Create dialog.
  3. Name the dialog Change plan.
  4. Drag the Intent action from the right sidebar to the canvas.
  5. Select the Change plan intent in the dropdown list.
  6. Add a text response message to the dialog. For example:
    • Sure, I can help you with that. Let me assign you to our Customer Support Agent.
  7. Add a tag to the dialog. The rule evaluates this tag. For example: change_plan.
  8. Finally, add a replay action to the dialog.

Create the rules​

With the dialog ready, you need a way to connect the AI agent to the user. First, create a rule that assigns the conversation to the Upsell Agent. This rule triggers when the user starts a conversation. Then, create a second rule that assigns the conversation to the Change plan Agent when it evaluates the tag change_plan.

warning

You cannot test this routing with the AI agent test feature, because that feature tests the AI agent only, not rules. Test the routing in a real conversation.

Assign to Upsell Agent​

  1. Go to Deploy > Rules.
  2. Select Create. The Create rule panel opens next to the rule list.
  3. Enter a Name and select Continue.
  4. Set the Trigger field to Customer starts conversation.
  5. Set the Actions field to Assign AI agent and select the Upsell Agent.
  6. Select Done. Moveo creates the rule as active.
The Assign to Upsell Agent rule with the Customer starts conversation trigger and the Assign AI agent action set to the Upsell Agent.The Assign to Upsell Agent rule with the Customer starts conversation trigger and the Assign AI agent action set to the Upsell Agent.

Assign to Change plan Agent​

Follow the same steps as the previous rule, with these changes:

  • Set the Trigger field to AI agent has replied. The AI agent adds the tag while it replies, so a rule that runs before the reply cannot see the tag.
  • Set the Conditions (optional) field to Tag is change_plan.
  • Set the Actions field to Assign AI agent and select the Change plan Agent.
The Assign to Change plan Agent rule with the AI agent has replied trigger, the condition Tag is change_plan, and the Change plan Agent.The Assign to Change plan Agent rule with the AI agent has replied trigger, the condition Tag is change_plan, and the Change plan Agent.

Next steps​