# Human handoff and tickets

> The three handoff signals, what a handoff does, and how tickets and SLAs follow from it.

URL: https://chatwork.io/en/docs/handoff
Section: Platform

The inbox's conversation status is the ownership model: `pending` means the bot owns the conversation, `open` means a human does. The bridge never replies into an `open` conversation that has an assignee, and a new customer message never gives ownership back to the AI; release is explicit.

## Signals

| Signal | When | Confidence |
|---|---|---|
| **Keyword** | The message contains a tenant handoff keyword (defaults: موظف, بشري, شكوى, مدير, تحويل, دعم فني, مشكلة مالية). Checked before any model call. | 0.95 |
| **Model tag** | The model ends its reply with `[HANDOFF]`. The tag is stripped from the customer-facing text. | 0.7 |
| **Agent policy** | Chatwork Router routed the message to an agent with `always_handoff: true` (Guardian). | 0.9 |

Provider errors and exhausted quotas also hand off, with a private note and no customer-facing text.

## What a handoff does

1. Sets the conversation owner to `human` and bumps the control generation, so any AI reply still in flight is dropped before it is sent.
2. Posts a private note with the reason, the channel and a short summary.
3. Toggles the conversation to `open` in the inbox.
4. Opens the conversation's ticket, or reuses the open one. There is at most one `open|pending` ticket per conversation (a partial unique index enforces it).

## Tickets and SLA

Tickets carry a per-tenant number, priority (`low`, `normal`, `high`, `urgent`), status (`open`, `pending`, `resolved`, `closed`), an assignee who must be a member of the tenant, and internal comments. SLA targets are `ticket_sla_first_response_minutes` and `ticket_sla_resolution_minutes` scaled by priority (urgent ×0.25, high ×0.5, normal ×1, low ×2). The first human reply from the inbox stamps `first_response_at`; resolve or close stamps `resolved_at`. Breach is computed when you read the ticket, never stored, so changing the SLA settings re-evaluates everything.

## Giving the conversation back

`POST /api/v1/tenants/{slug}/control/{conversation_id} {"action":"release"}` returns ownership to the AI. `claim` and `pause` exist for the portal's take-over and pause buttons.
