# Human in the loop

Two things decide when a person takes over: the agent's `handoff` block, which
you deploy, and the business hours, which whoever runs the inbox sets.

```yaml
agent:
  instructions: ...
  handoff:
    after_turns: 8
    when:
      - el cliente pide hablar con una persona
      - reclamo por un cobro
```

Declaring `handoff` is what gives the agent the tool to hand a conversation
over. Calling it marks the chat as waiting for a person; it shows up that way
in [the inbox](https://vatio.ai/docs/channels/inbox), and whoever replies there or from the WhatsApp
Business app takes it over. Vatio does not notify anyone yet.

The agent says so plainly. It is an assistant, it does not pretend otherwise,
and when it hands something over it tells the visitor it is checking with a
colleague and will come back with an answer — no invented errand to cover for
it. Several jurisdictions require disclosing that a person is talking to a
machine, and a single honest behavior is one less thing to get wrong.

## When it escalates

**`handoff.when`** is your own list of conditions, in your words, and goes into
the prompt. **`handoff.after_turns`** is the deterministic floor under it: past
that many visitor messages the handoff happens whether or not the model asked
for one. A visitor who asks for a human in plain words always triggers one —
that never depends on the model's judgement. Declare neither and escalation is
entirely the model's judgement.

## Business hours

The hours are not in `vatio.yml`. They belong to the people who answer, so
they are set on the **Business** page of [the inbox](https://vatio.ai/docs/channels/inbox): a time
zone and one or more shifts per day. A developer setting a workspace up can use
[`vatio business hours`](https://vatio.ai/docs/cli/business) instead. They apply to every
environment as soon as they are saved, and an `hours:` block left in
`vatio.yml` is ignored with a warning.

The agent is given the week, so it can tell a customer when you are open. The
hours do **not** decide who answers — the agent triages and tries to resolve
either way. They decide what happens after it gives up:

| | Inside hours | Outside hours |
|---|---|---|
| The agent | Goes quiet, someone is there to pick it up | Keeps answering — it promised a person for the morning, and going silent on top of that is worse than helping |

With no hours set the agent is treated as always reachable, so a handoff
always quiets it. A handoff nobody picks up within an hour hands the
conversation back to the agent rather than leaving the visitor with a promise
and silence.
