#Human in the loop
A person takes a conversation over by answering it: from the inbox, or from the WhatsApp Business or Instagram app. That is a human takeover: the agent stops replying on that chat until it is handed back, or until 8 hours pass without the person writing.
To have the agent ask for a person, give it the built-in notify_team tool and
say in its instructions when to send a handoff. It reaches the team
(supervisor), or whoever builds the agent while there is nobody else, in the
inbox's For you page, where Open the conversation is how they take it over,
and on WhatsApp unless the person turned it off. Who gets it, and
where, is set by notices, not by the agent.
When the alert has to land somewhere else (whoever is on call in your own system, a Slack channel, a ticket in your helpdesk), give the agent a tool that calls your backend instead, and your backend alerts whoever it should, as below.
#A tool that asks for a person
Your coding agent adds it with set_tool, with these arguments
(Tools has every field):
{ "workspace": "acme", "name": "ask_for_a_person", "description": "Tell the team that this conversation needs a person.", "when_to_use": "You cannot resolve it with what you know and your other tools, or the visitor asks to talk to a person. Once per conversation: if you already asked and nobody has replied yet, tell them the team already has it.", "parameters": { "type": "object", "properties": { "reason": { "type": "string", "description": "Why it needs a person, in one line, for whoever picks it up." } }, "required": ["reason"] }, "access": "public", "request": { "method": "POST", "base_url": "$env.ACME_API", "path": "/vatio/ask-for-a-person", "requires": ["chat.url"], "headers": { "Authorization": "Bearer $env.ACME_API_KEY" }, "body": { "reason": null, "chat_id": "$chat.id", "chat_url": "$chat.url", "name": "$contact.name", "phone": "$contact.phone_number" } }}set_tool also gives the tool to the agent, adding it to the agent's tools.
$chat.url opens the conversation in the inbox, so the person you alert lands
on it, reads what was said and answers. Their first reply is the takeover.
$chat.id is the same conversation as a number, for a backend that keeps its
own record of it. To send the photo or file the visitor sent along with the alert or a
ticket, add a parameter with format: vatio-attachment: see
Visitor files.
What your endpoint sends is up to it. A WhatsApp message to a supervisor from
your own number, for example, with the reason and the link, or one to a
different person depending on the hour. Check the key in Authorization, so
nobody else who finds the URL can alert your team.
It answers with a 2xx and a message for the agent: what to tell the visitor.
Your endpoint knows whether anyone is in, so it can say "tell them you are
checking with a colleague, who answers here shortly" on a Tuesday and "…on
Monday morning" on a Saturday:
{ "message": "The team was told. Tell them you are checking this with a colleague, who will answer here on Monday morning." }Anything other than a 2xx reaches the agent as an error, and it tells the
visitor it could not reach anyone. A fixed respond.message in the tool
replaces your endpoint's message; leave it out to let your endpoint decide.
An eval replay that calls the tool does not reach your endpoint unless one of its secrets has a test value, so tests do not alert anyone.
#When it asks
when_to_use is the agent's guide, in your words. Conditions particular to
your business, such as a charge someone disputes or anything about their
health, go there or in the agent's instructions.
The agent keeps answering after it calls the tool, and stops only when a person
replies. Your endpoint's message says what it tells the visitor in the
meantime: honestly, that it is an assistant checking with a colleague, rather
than an invented errand.
#Asking once
The agent knows it already asked. Every turn it reads the whole
conversation, its own tool calls and what they answered included, so the
call and your endpoint's reply are right there. A visitor who writes "hello?
anyone?" ten minutes later hears that the team already has it, because
when_to_use above says to ask once. When a person replies, the agent stops;
when the takeover ends, it reads what that person wrote, marked as a
teammate's, and stays consistent with it.
That is the model following its instructions, so the guarantee against a
second alert is your endpoint's. It gets $chat.id: skip a conversation you
already alerted on, and answer with what the agent should say instead,
"the team already has this and will answer here", so a second call still
ends in the right words.
On WhatsApp and Instagram, a message after eight quiet hours starts a new
conversation, without the earlier call in it. If your endpoint should know
that this person was already waiting, key it on the contact
($contact.phone_number) as well as the conversation.
#Hours when the agent does not answer
On the inbox's WhatsApp page, Quiet hours sets a weekly schedule in which the
agent stays silent on every channel: a time zone, and for each day of the week
any number of ranges. A range ends the same day, so a night is two ranges, late
on one day and early on the next. A message that arrives inside a range is not
answered afterwards; it waits for your team in the inbox. A message the agent
writes from an event your backend published waits for the range
to end; a message your backend sends with its
own text or a template goes out at once. With no ranges the agent answers
around the clock. It is not part of the agent, so it applies on save, with no
tests: set it on that page, or with the MCP's set_quiet_hours
(get_settings reads it, as quiet_hours).
#Name the cases in your words
The vatio skill (/vatio in Claude Code, after npx @vatio-ai/skills in
your app's project) asks when a person should take over. Later, ask your
coding agent in plain words: "Hand over
to a person when a piece arrives damaged, when someone asks for a refund or
disputes a charge, and for quotes of more than ten pieces." Those cases go in
the tool's when_to_use.
Name them as specifically as the business would. "A complaint about a charge" is a condition a model can recognize. "Difficult situations" is not.
#An endpoint that alerts the team
A minimal endpoint for the tool above. It checks the key, skips a conversation it already alerted on, posts the link to Slack and answers with what the agent should tell the visitor:
export async function POST(request: Request) { if (request.headers.get("authorization") !== `Bearer ${process.env.ACME_API_KEY}`) { return new Response(null, { status: 401 }); } const { reason, chat_id, chat_url, name } = await request.json(); if (await alreadyAlerted(chat_id)) { return Response.json({ message: "The team already has this. Say so, and that they will answer here." }); } await fetch(process.env.SLACK_WEBHOOK_URL!, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text: `${name ?? "A customer"} needs a person: ${reason}\n${chat_url}` }), }); return Response.json({ message: teamIsIn() ? "The team was told. Say you are checking this with a colleague, who will answer here shortly." : "The team was told. Say you are checking this with a colleague, and the team answers here on its next working day.", });}teamIsIn() is your own schedule, as precise as you need. alreadyAlerted() is
your own record of the chat_ids you sent. $env. values are workspace secrets,
set with set_secret (Secrets).
#Ask the team, keep the answer
When the person to ask is on your team, nothing needs your backend. Add the
store's owner (or whoever answers) to the workspace as a supervisor from
Team in the inbox (or with the MCP's invite_member), have them verify their WhatsApp number on their account page
(Who is asked), and give the agent the built-in tools
with update_agent:
{ "workspace": "acme", "tools": ["knowledge_lookup", "knowledge_write", "ask_team", "answer_customer", "supervisor_questions"], "knowledge": ["docs"]}tools replaces the whole list, so include the agent's own tools in it too.
- A customer asks what the agent cannot answer, on any channel: the web
widget, your app, WhatsApp or Instagram. After searching
knowledge_lookup, the agent callsask_teamwith the question. Vatio asks the team (Who is asked), on WhatsApp and in the inbox's For you page, with a short note: who asked, what, and how to answer. The agent tells the customer it asked and will write here. - While the question waits, the agent knows it: it does not ask again, it tells the customer the team has not answered yet if they ask, and it calls the question off if they no longer need it.
- The supervisor answers the agent in their own chat.
answer_customersends that answer to the customer in their conversation, on the channel they asked from, and the agent words it as its own and adds nothing to it. When the supervisor says they already answered the customer themselves (from their own phone, say),answer_customercloses the question instead: the customer is sent nothing, and nobody is reminded or told later that the team has not answered.supervisor_questionslists what is still waiting, for when it is unclear which question an answer is for. - If the answer holds for anyone who asks, the agent also writes it with
knowledge_write, andknowledge_lookupfinds it the next time, before anyone is asked.
answer_customer and supervisor_questions exist only in a conversation with
a supervisor (a team member with the supervisor role or a higher one, by
their verified number);
ask_team is for everyone except the people it asks. A question reaches
them in their own chat with the agent, often while they are doing something
else there (setting up the store, say): the agent asks it, helps with what
they were doing, then brings the question back up.
A test replay that calls ask_team asks nobody:
the agent gets the same answer it gets when a question is sent, and no
supervisor receives a message. Tests of a handoff are safe to run.
For the customer, a question is a job running in the background, like an
async tool: the answer comes back as
the answer to ask_team, so the agent can keep using it later in the
conversation. If nobody answers within 8 hours (as long as a WhatsApp or
Instagram conversation lasts without a message), the agent tells the customer
the team has not answered yet, and reminds the people asked once (with the
template when their window has closed). An answer that comes later still reaches them
while that conversation goes on; once it has ended, answer_customer keeps
the answer on the question and tells the supervisor it was not sent.
#The Team questions page
Team questions in the inbox lists every question the agent took to the team,
newest first: the customer, the question, whether it reached the team yet,
the answer, who gave it (or that they answered the customer directly), and,
when the answer was saved with knowledge_write, a link to that version of
the knowledge entry. The agent links the entry by passing the question's
question_id to knowledge_write; a write without it, within the hour after
the same person answered, is taken to be that answer. Anyone who reads the
conversations sees it, for the conversations they can open. Through the
MCP, each question is a notice of kind question: list_notices
lists the ones sent to you, and resolve_notice answers one.
#Who is asked
ask_team asks the team: the same people as every notice that is not an
alert (Notices). That is the supervisors, or, while the workspace
has none, the owner and the developers. Nobody is picked: to have someone
asked, add them as a supervisor, and once there is one, the owner and the
developers are no longer asked. Each person gets the question in their For
you page in the inbox, and on the WhatsApp number they verified on their
account unless they turned WhatsApp off for notices.
The inbox's Team page shows who is asked now under Questions from the
agent, and the server API says it per person as receives_questions
(Team members).
#Opening the conversation
WhatsApp only lets the business write first with an approved
template once the person has not written to the
agent in 24 hours. Create one whose body takes two parameters, the customer's
name and the question, with the MCP's create_whatsapp_template:
{ "workspace": "acme", "name": "supervisor_question", "language": "es", "body": "Hola, un cliente ({{1}}) pregunta: {{2}}. Respóndele a Florencia por aquí.", "examples": ["Ana", "¿Hacen coronas para el sábado?"]}Pick it on the Questions from the agent card on the inbox's Team
page, or with the MCP's update_whatsapp and team_template (both the
owner's). When the window is open the agent writes the
question itself; when it is closed the template goes out, and the supervisor's
reply opens the conversation, with the agent knowing what it asked. Without a
template, a question for someone outside the window is kept, not lost: the
customer is told the team will answer here, and the question goes out as soon
as one of the people asked writes to the agent, or a template is set. A customer waiting on
three answers asks no more until one comes. The questions and the messages are
in the inbox, and a contact's questions are part of their
export.
WhatsApp only lets the business write to someone who messaged it in the last
24 hours, so a supervisor must have written to the agent recently to be asked
(or the template above goes out). An answer for a customer on WhatsApp or
Instagram who has not written in 24 hours waits: answer_customer tells the
supervisor so, and the customer gets it as soon as they write again. In the
web widget and your app there is no window, and the answer arrives when it is
given.
#Gather details first
The person who picks the conversation up should not have to start over. Add one line to the agent's instructions, or ask your coding agent to: "Before handing over a conversation about an order, ask for the order number."
#Try it
Have your coding agent send each case to the agent with chat_with_agent,
which talks to the newest version, the one your team has, each in a new
conversation (leave chat_id out):
{ "workspace": "acme", "message": "My table arrived with a broken leg" }{ "workspace": "acme", "message": "I want to talk to a person" }Both should end in a call to ask_for_a_person, which each reply lists with
the agent's other tool calls, and in a message to your team. To keep one as a
test, add_test with the question and what the agent should do
(Improve your agent). You can send the
same messages from Try the agent in the inbox. It is the
model's judgement, not a rule Vatio enforces, so try each case with the words
your customers use.
#Taking over and handing back
Supervisors are invited from Team in the inbox or with the MCP's
invite_member. They see every conversation
and the agent's tool calls, and replying starts a takeover: the agent stops
answering that chat. With your own WhatsApp number connected, a reply from the
WhatsApp Business app counts the same.
Hand back to agent in the inbox returns the conversation, as does the
MCP's hand_back_conversation. If nobody does,
the takeover expires 8 hours after the last reply someone on your team sent, and
the agent picks the conversation up again the next time the visitor writes.
Every reply from your team restarts that clock.
While reading, a supervisor can use Report this reply on a reply that should
have been a handoff and write what the agent should have done. That note becomes
a test. Your coding agent reads it with list_reports, and the fix often
lands in the tool's when_to_use, set again with set_tool. See
Improve your agent.
#A worked example
Northfield Furniture sells through its own web store, with the agent in the
store's chat. The team works weekdays 9:00 to 18:00 and Saturdays 10:00 to 14:00,
New York time, and reads a Slack channel. Its agent has ask_for_a_person in
its tools and this line in instructions: "Before handing over a
conversation about an order, ask for the order number so whoever picks it up has
it."
On a Saturday at 4 p.m., after the team has left:
Customer: the table came with a broken leg [photo]
Agent: I'm sorry, that shouldn't happen. What's your order number?
Customer: NF-20931
Agent: Thanks. I'm Northfield's assistant, so I'm checking this with a colleague, and the team will get back to you here on Monday morning. Is there anything else I can help with meanwhile?
The agent asked for the order number as instructed, then called the tool because a piece arrived damaged. The endpoint posted the reason and the link in Slack and, the team being out, told the agent to promise Monday. On Monday someone opens the link and replies, and the conversation is theirs until they hand it back.
#Disclosure
The agent says plainly that it is an assistant. When it hands something over it tells the visitor it is checking with a colleague, with no invented errand. Do not write a human name and backstory into the instructions. Several jurisdictions require disclosing that a person is talking to a machine; check what yours requires.
#Pitfalls
- An alert nobody reads. Send the link where someone on duty looks, and decide in your endpoint what happens when nobody is.
- Promising a time your team does not keep. The agent says what your endpoint tells it. "Shortly" at midnight means the visitor waits until morning.
- Alerting twice. A model can ask again despite
when_to_use. Skip achat_idyou already sent. - An endpoint anyone can call. Check the key in
Authorization. - Vague conditions. "When it gets complicated" cannot be applied consistently.
- A forgotten takeover. If the agent "stopped answering" one chat, check for a takeover first.
- Handoff instead of a fix. If the same question keeps reaching people, report it and have your coding agent give the agent the knowledge or tool it was missing.
#Frequently asked questions
#Does Vatio notify my team when a conversation is handed off?
Your backend does. The tool sends it the reason and $chat.url, and your
backend sends that wherever your team looks: a WhatsApp to whoever is on call, a
Slack channel, an email or a helpdesk ticket.
#What does the agent do outside office hours?
Whatever your endpoint tells it in message, such as that the team replies on
Monday morning. The agent keeps helping with anything else until a person
replies. To keep the agent silent in set hours, use quiet hours above.
#Will a customer who asks for a person get one?
When when_to_use says so, the agent calls the tool, and current models do that
reliably for a plain request. It is the model's judgement, not a rule Vatio
enforces.
#Does the agent pretend to be a person?
No. See Disclosure above.