> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatling.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Routing

> Route handed-off conversations to a team queue or automatically assign an agent using ordered routing rules.

Agent routing determines who receives a conversation when a human handoff occurs. You can leave the conversation unassigned in a team queue or automatically assign an agent using round-robin routing.

Routing is configured separately for each **Human Handoff** action or block. This lets you use different routing rules for different handoff scenarios.

<Note>Availability of this feature depends on your plan.</Note>

## Before you begin

Before configuring routing:

* Set up human handoff for your [AI Agent](/live-chat/human-handoff/ai-agent) or [Chatbot](/live-chat/human-handoff/chatbot).
* If you want to route to a team, create the team and add its members under **Settings > Teams**. See [Teams](/live-chat/teams).
* Make sure the agents you want to include have access to the chatbot or AI Agent's conversations.

## Open the routing settings

### AI Agent

1. Open your AI Agent.
2. Go to **Actions**.
3. Find the **Human Handoff** action and click `Edit Action`.
4. Scroll to the **Agent routing** section.

### Chatbot

1. Open your Chatbot.
2. Go to **Builder**.
3. Select the **Human Handoff** block you want to configure.
4. Find the **Agent routing** section in the block editor.

## Create a routing rule

1. Click `Add rule`.
2. Choose whether **all** or **any** of the rule's conditions must match.
3. Add the conditions that identify the conversations you want to route.
4. Choose what should happen when the rule matches.
5. Save the Human Handoff action, or save and publish your Chatbot flow.

Rules are evaluated from top to bottom. The first enabled rule that matches is applied, and the remaining rules are skipped.

<Tip>Place your most specific rules first and your broadest fallback rule last.</Tip>

## Conditions

Conditions let you route conversations using information available at the time of handoff:

* **Channel**: Route based on where the conversation started, such as Web, WhatsApp, API, Instagram, Messenger, or Telegram.
* **Language**: Route based on the user's detected language.
* **Priority**: Route using the conversation's assigned priority.
* **Sentiment**: Route using the user's detected sentiment.
* **Captured variable**: Route using information gathered during the conversation, such as a department, product, region, or customer type.

Use **Is** or **Is not** to compare one value. Use **Is one of** or **Is not one of** to select multiple accepted values.

For captured variables, enter the variable name and choose the appropriate comparison. Variable names must match the information configured for the handoff.

### Match all or any conditions

* **All conditions match**: Every condition in the rule must match.
* **Any condition matches**: At least one condition in the rule must match.

A rule with no conditions always matches. Use it as the final rule when you want a default routing destination.

## Routing actions

### Leave in team queue

Select **Leave in team queue**, then choose a team.

The conversation is assigned to the team but remains unassigned to an individual agent. Any eligible member of that team can pick it up from the Conversations page.

Use this option when your team manages a shared queue and agents choose conversations themselves.

### Round-robin auto-assign

Round-robin routing automatically assigns each matching conversation to the next eligible agent in rotation.

Choose one of the following agent pools:

* **All agents with access**: Rotate between all eligible agents who can access the chatbot or AI Agent's conversations.
* **Selected team**: Rotate between eligible members of a specific team. The conversation is assigned to both the team and the selected agent.
* **Custom agent pool**: Rotate between only the agents you select.

Each chatbot and routing target maintains its own rotation. After the final eligible agent receives a conversation, the next assignment starts again from the beginning.

<Note>Round-robin routing currently does not consider agent online status, capacity, or current workload.</Note>

## Reorder, disable, or remove rules

* Drag rules to change their evaluation order.
* Use the toggle on a rule to temporarily disable it without deleting its configuration.
* Click the delete icon to remove a rule.

Routing runs when at least one rule is enabled.

## What happens when routing cannot assign a conversation

The conversation remains in the unassigned queue when:

* No enabled rule matches.
* A selected team is unavailable.
* A round-robin pool has no eligible agents.
* Routing is unavailable on the current plan.

The human handoff still succeeds, so an agent can assign or pick up the conversation manually.

## Example setup

You could create the following ordered rules:

1. If the captured variable `department` is `billing`, leave the conversation in the **Billing** team queue.
2. If priority is `urgent` or `high`, round-robin between the **Escalations** team.
3. If there are no conditions, round-robin between all agents with access.

The third rule acts as the default because a rule without conditions always matches.

## Next steps

<CardGroup cols={2}>
  <Card title="Teams" icon="users" href="/live-chat/teams">
    Create teams and manage their members.
  </Card>

  <Card title="Managing Conversations" icon="comments" href="/live-chat/managing-conversations">
    Learn how agents pick up and manage handed-off conversations.
  </Card>

  <Card title="Notifications" icon="bell" href="/live-chat/notifications">
    Configure notifications for agent and team assignments.
  </Card>
</CardGroup>
