Skip to content
ShipVoice

Relay: hand the call from agent to agent

Control passes from agent to agent. Each owns a phase with its own voice, tools and permissions.

Mahimai Raja 2 min read Who holds the call
Three glowing nodes in a row passing a red signal from one to the next, representing a call handed between agents.
A caller is handed from a front desk agent to an order taker, then to a payments agent that alone holds the card tools.
A caller is handed from a front desk agent to an order taker, then to a payments agent that alone holds the card tools. Download the Excalidraw file

The Relay pattern hands a voice call from one agent to the next, and each agent owns one phase. In a Relay, the call is a baton. A front desk agent answers and works out what the caller needs, then hands the call to an order taker. When the order is done, the order taker hands it to a payments agent. Each agent owns one phase completely, and once it hands off, it is gone.

This is the pattern for when phases are genuinely different jobs, not just different questions.

Use it when

  • Phases need hard boundaries. The payments agent is the only one with card tools. The order taker cannot issue a refund because it does not have the tool, not because a prompt told it not to.
  • Phases need a different model or voice. A fast, cheap model for routing. A stronger model for a tricky diagnosis. A different voice for the billing desk so the caller notices the change of department.
  • Phases are long and self-contained. A twenty-minute technical support session has little reason to keep the front desk’s routing rules in context.

Avoid it when

Callers jump between topics. Every jump is a handoff, and handing back and forth costs time and makes the call feel like a phone tree. If the first agent should still be around after the phase ends, you want a Supervisor.

Latency

One handoff per transition, plus whatever it costs to prepare context for the next agent. You have three choices for that context, and they trade speed for continuity:

  • Pass the full history. The next agent knows everything. Slowest to start and most tokens per turn.
  • Pass a summary. One extra model call at handoff time, then a lean context.
  • Pass nothing. Fastest, and the right call when the next phase genuinely does not need the past, like a satisfaction survey.

Build it on LiveKit

A handoff is a function tool that returns the next agent. Returning a tuple lets the current agent say something on the way out.

from livekit.agents import Agent, RunContext, function_tool


class Payments(Agent):
    def __init__(self, chat_ctx=None) -> None:
        super().__init__(
            instructions="Take payment for the confirmed order. Read back the total first.",
            chat_ctx=chat_ctx,
            tools=[charge_card, send_receipt],
        )


class OrderTaker(Agent):
    def __init__(self, chat_ctx=None) -> None:
        super().__init__(instructions="Take the food order. Confirm each item.", chat_ctx=chat_ctx)

    @function_tool()
    async def order_complete(self, ctx: RunContext):
        """Call when the caller has confirmed the full order."""
        return Payments(chat_ctx=self.chat_ctx), "Great, let me take payment for that."

LiveKit’s agents and handoffs guide covers context preservation in detail.

How it combines

Each agent in a Relay can use any other holding pattern inside its phase. A common production shape is a Supervisor at the front that hands off to a dedicated payments agent at the end. Pair the whole Relay with Bookends so the summary and CRM sync see every phase, not just the last one.

Common questions

What is an agent handoff in a voice AI call?

A handoff moves control of the live call from one agent to another. In LiveKit Agents, a function tool returns the next agent, optionally with a line for the current agent to say on the way out.

How do I keep context when handing off between agents?

Pass the full chat history for continuity, pass a summary for a lean context, or pass nothing when the next phase does not need the past.

Why not let one agent handle payments with a prompt rule?

A prompt rule can be ignored. In a Relay the payments agent is the only one holding the card tools, so other agents cannot charge a card at all.

Sources and further reading

Mahimai Raja

Mahimai builds production voice agents on LiveKit for small businesses and maintains the open-source livekit-starter. He is building ShipVoice, the voice AI platform for agencies. Find him on X or at [email protected].