AI Agent

Human escalation

When and how the AI agent hands a conversation to your team, and how it reaches the right person.

Human escalation is how the AI agent passes a conversation to your team when a person should take over: the customer asks for one, the request falls outside your policy, or the AI agent can't complete it. Octocom calls this a handoff. Good escalation is what makes an AI agent safe to put in front of customers.

A handoff is a firm change of ownership, not a suggestion. From that moment the conversation belongs to your team, and the AI agent stops replying in it. The one exception is web chat, where you can let the AI agent keep answering new questions until an agent replies.

What you can do

  • Hand off when a customer asks, right away or after finding out what they need.
  • Hand off when a workflow reaches its limits, such as a policy exception or a step that fails.
  • Collect a way to reach the customer first, so your team can reply after they leave the chat.
  • Route to the right team by language, topic, sentiment, channel or details collected in the conversation.
  • Put a phone caller through to a department, a phone number or your team in the help desk.
  • Tell customers what happens next, such as when your team will reply.
  • Hand off only during opening hours, with an action that checks the time first.

This page covers the AI agent's side. For what your team sees and how replies reach the customer afterwards, see Handed-off conversations.

Need a person without a full handoff?

To have a teammate approve or decide something while the AI agent keeps the conversation, use human-in-the-loop decisions, or external decisions when another system decides. To review every AI email reply before it is sent, use AI reply approval.

Set it up

Ask Copilot or your AI agent

When a customer asks for a person, find out what they need first, then hand off. Route German conversations to our German team and strongly negative ones to our senior agents.

In the dashboard, the handoff options are in Settings -> Automation -> Handoff, the escalation steps are in your workflows, and routing is in Settings -> Help Desk -> Assignment Rules. See Settings for the full list.

How the AI agent hands off

The AI agent hands off by calling the built-in transferConversation action. You don't create this action, but like every action, it is only available where a workflow enables it. A business whose workflows don't enable transferConversation has no way to hand off on purpose.

New businesses start with two workflows that enable it: Escalation request, which hands off when a customer asks for a person, and Other queries, which offers a handoff when the AI agent can't resolve a question. A minimal escalation workflow looks like this:

  • When to follow: "When a customer asks to talk to a human or a supervisor"
  • Actions: transferConversation
  • Instructions: ask what the customer needs so the team has context, then call transferConversation.

The AI agent only signals that a person is needed. It doesn't choose the team. Routing is a separate, predictable step that runs after the handoff. See Routing to the right team.

What the AI agent collects first

Before it hands off, the AI agent makes sure your team has a way to reach the customer, so they can reply even after the customer has left. What it needs depends on the channel and on the Before handoff options in your handoff settings:

ChannelWhat the AI agent needs before handing off
Web chatAn email address, when Ask for an email address is on (the default). A phone number too, when Also ask for a phone number is on.
Email, social media, contact forms and other channelsAn email address, when Ask for an email address is on.
WhatsAppThe customer's phone number.
Web chat embedded in another help deskNothing. The handoff is immediate.
Phone callsNothing, or a destination. See Phone calls.

When the customer's email address is already on their profile, as it always is on email, the AI agent doesn't need to ask. Otherwise the address has to come from the conversation: one the customer gave, or one an action returned. The AI agent can't invent one or use your own support address.

The address is kept on the conversation as the octocom:handoffContactEmail metadata, shown in the conversation sidebar under Metadata. Help desk tickets, handoff emails and the first email reply for that conversation go to it. It never replaces an email already on the customer's profile and never merges customers.

Automatic handoffs

Not every handoff comes from the AI agent's decision. These hand off on their own:

TriggerWhat happens
Follow-ups exhaustedWith Hand off when follow-ups are exhausted on, an unresolved email conversation is handed off once its follow-ups are used up. See Follow-ups and auto-resolve.
Bot QA cancels a replyA confirmed violation on a Bot QA check set to Hand off to a person hands the conversation to your team.
A reply draft is rejectedWith AI reply approval, rejecting a draft hands the conversation to your team.
The AI agent can't produce a replyIf a reply fails three times, the AI agent stops retrying and hands off rather than leaving the customer waiting.
An agent takes overTake over conversation in the help desk hands the conversation off to that agent.

What happens at a handoff

  1. The AI agent sends its closing message. It is told the conversation will be transferred after its message, so the customer always hears what happens next. Octocom tells it where your team will reply, and your handoff settings shape what it says about response times.
  2. The conversation is marked handed off. A closed conversation is reopened and AI messages still scheduled for later are canceled. On the Octocom help desk, auto-close stops, so the conversation stays open until a person closes it. The reason is recorded on the conversation timeline.
  3. The conversation is analyzed. Topics, sentiment, language and data collection fields are computed from the transcript.
  4. The Conversation Handed Off event fires, running any event handlers you set up, such as a Slack alert.
  5. The conversation is routed. On the Octocom help desk, assignment rules pick a team or agent. With an external help desk, Octocom creates or updates a ticket there and that help desk handles routing.

Because analysis runs before assignment, assignment rules can use topics, sentiment, language and data collection values from the whole conversation.

After the handoff, the AI agent stays quiet in that conversation. The exception is web chat with the after-handoff behavior set to Keep answering: the AI agent then keeps helping with new questions until an agent replies. Handed-off conversations covers where your team replies, the live chat timeout and what the customer sees while waiting.

Write escalation instructions

How readily the AI agent should hand off is a business decision. Three approaches cover most setups.

Hand off on request. The AI agent asks what the customer needs, then hands off. Your team gets context without making the customer work for it.

If the customer wishes to talk to a human or a supervisor, first find out what they need help with, so the team can pick it up. Don't transfer the conversation if it's not clear what the customer wants. Once the customer has explained their request, call transferConversation.

Hand off without questions. The fastest path to a person. Lowest friction, highest handoff rate.

If the customer wishes to talk to a human or a supervisor, call transferConversation right away. Don't ask them to explain their request first.

Try once, then hand off. The AI agent attempts the request before escalating. Lowest handoff rate, and the most likely to frustrate a customer who really wants a person.

If the customer asks to talk to a human or supervisor, explain that you can help with most requests and ask what they need. If you can't resolve it, or the customer insists on a person, call transferConversation.

Tips for any approach:

  • Add a fail-safe to every workflow. End each workflow with a step such as "If you are blocked or the request needs a policy exception, call transferConversation." Most handoffs should come from workflows that reach their limits, not from a dedicated escalation workflow.
  • Don't instruct the AI agent to collect the email. When Ask for an email address is on, the action itself requires it, and the AI agent asks the customer.
  • Don't script the closing message. The action already tells the AI agent where the team will reply and to end with a goodbye. Put response-time expectations in the handoff settings (Expected response time and What to tell the customer) instead of workflow instructions.
  • Make the handoff an explicit step. If the AI agent says "let me transfer you" without calling the action, the customer waits for nothing. A numbered step that calls transferConversation prevents this, and Octocom can turn on a safeguard that rewrites any reply promising a transfer the AI agent didn't make.
  • Say what to collect, not where to route. Routing happens after the AI agent is done.

Routing to the right team

transferConversation says that a person is needed, not which person. Assignment rules decide that. They run right after the handoff and can match on:

  • business, channel and email inbox
  • tags and priority
  • topics, language and sentiment
  • data collection values

Each rule has conditions (all must match) and a target: a team or a specific person. Rules are checked in priority order and the first full match wins. A rule that targets a team narrows the pool, then your round-robin or balanced assignment picks the agent.

Many routes need no code at all, because topics, language and sentiment are computed during the handoff. For example, language de routes to your German team, and sentiment Strongly Negative routes to senior agents.

When the AI agent itself should choose the department, give it a custom action that tags the conversation and then hands off, and add an assignment rule for each tag. See Route by department in the developer section.

If you use an external help desk, routing and assignment happen there. Octocom creates the ticket according to Settings -> Help Desk -> Ticket Routing. See Third-party help desk.

Phone calls

On a phone call, transferConversation puts the caller through to a person. What it does depends on the transfer destinations in the voice AI settings:

DestinationsWhat transferConversation does
OneTransfers the live call to it.
SeveralTransfers the live call to the destination the AI agent chooses. It can only choose from the names you configured, such as "Sales" or "Billing".
NoneDoesn't transfer. The conversation is handed to your team in the help desk, the caller stays with the AI agent until the call ends, and the AI agent tells them someone will be in touch.

A destination can be a phone number, a SIP address or your_team, which rings your available agents in the Octocom help desk. For a fixed menu of departments, destinations are all you need. To pick the destination with your own logic, such as opening hours, the account owner or an API lookup, see Transfer calls with your own logic. For tips on transfers that always connect, see Voice AI best practices.

Choose an approach

You needUse
A person when the customer askstransferConversation in an escalation workflow
A handoff when a workflow reaches its limitsA transferConversation fail-safe step in that workflow
Different teams by language, topic or sentimentAssignment rules, no code
Different teams chosen by the AI agentA custom action that tags, then an assignment rule
Escalation only during opening hoursA custom action that checks the time before handing off
A live call put through to a fixed set of teamsTransfer destinations in the voice AI settings
A live call routed by your own logicA custom action with hand_off_conversation(phone_destination=...)
Something to happen after every handoffAn event handler on Conversation Handed Off

FAQ

Why isn't the AI agent handing off? In order of likelihood: no workflow enables transferConversation; the workflow isn't selected for that kind of request; or the customer hasn't given an email address and Ask for an email address is on. Open the conversation in the help desk and select Debug this message on the AI agent's reply to see which actions it had and called.

The AI agent said it would transfer, but nothing happened. It promised the transfer without calling the action. Make the action call an explicit numbered step in the workflow instructions. Octocom can also turn on a safeguard that catches these replies and writes them again.

Can the AI agent hand off without an email address? Yes. Turn off Ask for an email address in Settings -> Automation -> Handoff. Consider first how your team will reach a customer who has left the chat.

Does a handoff close the conversation? No, the opposite. A closed conversation is reopened, and on the Octocom help desk auto-close stops, so it stays open until a person closes it.

Can a handed-off conversation go back to the AI agent? No. A handoff is permanent for that conversation. On web chat, the Keep answering option lets the AI agent keep answering new questions until an agent replies.

How do I see why a conversation was handed off? The reason is recorded on the conversation timeline. Conversation topics shows which subjects lead to handoffs over time.

Settings

Most handoff behavior is self-service:

  • Settings -> Automation -> Handoff: asking for an email address or phone number, live chat, response times, what the AI agent tells the customer, and what it does after the handoff. See Handed-off conversations. Copilot and MCP use get_handoff_settings and update_handoff_settings.
  • Settings -> Automation -> Follow-Ups: Hand off when follow-ups are exhausted. See Follow-ups and auto-resolve.
  • Settings -> Help Desk -> Assignment Rules: where handed-off conversations go. See Assignment and routing.

Two options are set by Octocom on request: turning off transferConversation entirely, so the AI agent can never hand off on purpose, and the safeguard that rewrites replies promising a transfer that didn't happen.

For developers: custom escalation actions

When escalation needs a decision ("are we open?", "which team?", "which number?"), put that logic in a custom Python action that calls hand_off_conversation, rather than in instructions.

The action decides whether the handoff happens. If it returns without calling hand_off_conversation, nothing is handed off, and its return value tells the AI agent what to say instead. When it does hand off, Octocom sets the reply channel as for transferConversation and tells the AI agent where the team will reply (by email, in the chat, in Messenger), so your action's text shouldn't promise a channel. If your team needs the customer's email first, collect it in the action (for example with an email argument) and hand off only once you have it.

hand_off_conversation can only be called from an action the AI agent runs, not from a condition provider, event handler or sidebar widget. It has no effect when you test the action on its own.

Route by department

Tag the conversation, then hand off. Tags written before the handoff are already on the conversation when assignment rules run, so one rule per tag sends each department to its team.

def execute_action(context):
    args = context["args"]
    department = args["department"]  # "billing" | "technical" | "sales"

    add_conversation_tag(context, f"dept:{department}")
    set_conversation_metadata(context, "escalation_reason", args["reason"])

    hand_off_conversation(context, reason=args["reason"][:500])

    return {
        "success": True,
        "message": "Tell the customer the right team will follow up shortly.",
    }

Constrain the AI agent to your exact values in the argument description. The AI agent picks the department, but only from a list you control:

The department argument MUST be one of these exact values: "billing", "technical", "sales". If you don't know which one the customer needs, ask before calling this action.

Gate on working hours

The most common custom escalation. An action named, for example, tryEscalateToHuman (the name tells the AI agent it might not succeed) checks the clock and public holidays before handing off, and returns an explanation for the customer when the team is closed.

from datetime import datetime
from zoneinfo import ZoneInfo

def execute_action(context):
    now = datetime.now(ZoneInfo("Europe/Berlin"))
    today = is_holiday("DE", check_date=now.strftime("%Y-%m-%d"))

    open_now = (
        now.weekday() < 5
        and 9 <= now.hour < 18
        and not today.get("isHoliday")
    )

    if not open_now:
        return {
            "success": False,
            "reason": "outside_working_hours",
            "message_to_customer": (
                "Our team is available Monday to Friday, 9:00–18:00 CET. "
                "Leave your question here and we'll reply on the next working day."
            ),
        }

    hand_off_conversation(context, reason="Customer requested a human agent")
    return {"success": True, "message_to_customer": "Connecting you to an agent now."}

Describe the closed-hours behavior in the action description too, so the AI agent knows what a refusal means and doesn't retry in a loop.

Two habits worth copying:

  • Say explicitly what did not happen. If the return value doesn't say the handoff was refused, the AI agent may still tell the customer they're being connected.
  • Fail open. If your gating logic itself errors, hand off anyway. A brief outage in another system should never stop a customer from reaching a person.

For hours that differ by customer type, take an argument such as is_b2b, apply a different schedule to each, and tag the conversation (for example customer:b2b) so an assignment rule can route it to the right team.

Transfer calls with your own logic

Use a custom action when the call's destination depends on logic rather than a fixed list: opening hours, the agent who owns the account, or an API lookup. Pass phone_destination to hand_off_conversation and the live call is transferred to that number:

DESTINATIONS = {
    "Sales": "+15551230001",
    "Support": "+15551230002",
    "Accounting": "+15551230003",
}

def execute_action(context):
    destination = context["args"].get("destination")

    if destination not in DESTINATIONS:
        valid = ", ".join(f'"{d}"' for d in DESTINATIONS)
        return {
            "success": False,
            "message": f"Invalid destination. Valid values are: {valid}. Try again.",
        }

    hand_off_conversation(context, phone_destination=DESTINATIONS[destination])
    return {"success": True}
  • Put the menu in the action description, listing every valid destination, and tell the AI agent to ask the caller when it isn't sure. Rejecting an invalid value with the valid list in the message lets the AI agent recover on its next turn.
  • phone_destination is ignored outside phone calls, so the same action works for chat, where it becomes a normal handoff. Combine it with a working-hours check so calls outside hours become a regular handoff (a callback the next working day) instead of ringing an empty office.

Override the built-in action

A custom Python action named transferConversation replaces the built-in one. On a name clash, Python actions win over API actions, which win over built-in actions. Override when you want the same role with different mechanics (extra arguments, your own validation, tags on the way out) without changing every workflow that already uses transferConversation.

def execute_action(context):
    email = context["args"].get("email")
    reason = context["args"].get("reason")

    if not email:
        return {"success": False, "message": "Email is required to transfer the conversation."}

    upsert_customer(context, email=email)
    hand_off_conversation(context, reason=reason)

    return "The team will reach out by email as soon as possible."

Your override does not inherit what the built-in action does:

  • the channel-aware arguments (phone on WhatsApp, none on web chat embedded in another help desk) and the email checks
  • the closing-message guidance from your handoff settings

A clear instruction in your return value covers most of the second point. If you only need to add behavior (a tag, a metadata field, a Slack message), prefer a separate action with its own name, or an event handler on Conversation Handed Off, and keep the built-in action.

On this page