> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ada.cx/llms.txt.

# rank_handoff_reasons

Ranks every handoff reason in a date range by the number of conversations, in one call. Each reason has its count, its share, what can fix it, a suggestion, and sample conversation IDs. Use it to pick the handoff reason to work on.

Read-only. The [improvement loop](/mcp/tools/start-improvement-loop) uses it when you ask to reduce handoffs.

## Example prompts

* "Why does the Agent hand off to human agents? Rank the reasons for the last 30 days."
* "Which handoff reasons can I fix on the Chat channel this month?"

## Parameters

| Parameter    | Type    | Required | Description                                                                                                                                                                                                                               |
| ------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `start_date` | string  | Yes      | Start of the range, `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM` in `time_zone`. A date starts at 00:00.                                                                                                                                            |
| `end_date`   | string  | Yes      | End of the range, `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM` in `time_zone`. A date includes its whole day. A date with a time is exclusive.                                                                                                      |
| `time_zone`  | string  | No       | IANA time zone, such as `America/New_York`, for the day boundaries. Defaults to `UTC`.                                                                                                                                                    |
| `filters`    | array   | No       | Filters in the shape of [`get_ada_metric`](/mcp/tools/get-ada-metric) filters, for example a channel or an Intent. Get the types from [`get_available_filters`](/mcp/tools/get-available-filters). A handoff reason filter isn't allowed. |
| `samples`    | integer | No       | Sample conversation IDs for each reason, from 0 to 10. Defaults to 3. `0` returns none and is faster.                                                                                                                                     |

## Response

| Field     | Description                                                                                                                                            |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `totals`  | The `conversations` in the range, the `escalated` conversations, and the conversations `with_reason`: those with a recorded handoff reason.            |
| `reasons` | One row per reason, ranked by count. Each row has `reason_code`, `conversations`, `share`, `fix_surface`, `suggestion`, and `sample_conversation_ids`. |

`fix_surface` says what can fix the reason:

* `tool`, `knowledge`, or `routing`: a change to the AI Agent's configuration can fix it.
* `system` or `none`: a configuration change usually can't fix it. Read the `suggestion`.
* `unknown`: the cause isn't known. Read the sample conversations to decide.

`conversations` counts each conversation with at least one handoff of that reason. A conversation with two reasons counts under both, so the shares can add up to more than 1. `share` is the share of the conversations `with_reason`, or `null` when no conversation has a recorded reason. A handoff that recorded no reason is in no row, so the counts are a lower bound.

To read a sample, the assistant calls [`get_conversation`](/mcp/tools/get-conversation). To list more conversations for one reason, it calls [`get_conversations`](/mcp/tools/get-conversations) with a handoff reason filter.