> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Handoff examples

> Front desk agent transfers the chat to billing or tech. Context comes along.

# Handoff examples

Runnable file: [agentium-examples/handoff/agent-handoff.ts](https://github.com/agentiumOS/agentium-examples/blob/main/handoff/agent-handoff.ts).

Guide: [Handoff](/handoff/overview)

***

## 1. Front desk → specialist

```typescript theme={null}
import { Agent, openai, defineTool } from "@agentium/core";
import { z } from "zod";

const billingAgent = new Agent({
  name: "billing",
  model: openai("gpt-4o-mini"),
  instructions: "You handle invoices and payments. Be precise with numbers.",
  tools: [
    defineTool({
      name: "get_invoice",
      description: "Look up an invoice",
      parameters: z.object({ userId: z.string() }),
      execute: async ({ userId }) => `Invoice for ${userId}: $49.99/month`,
    }),
  ],
});

const techAgent = new Agent({
  name: "tech-support",
  model: openai("gpt-4o-mini"),
  instructions: "You debug and configure. Be concrete.",
});

const frontDesk = new Agent({
  name: "front-desk",
  model: openai("gpt-4o"),
  instructions: `Greet the user.
Billing or payment → transfer to billing.
Bugs or setup → transfer to tech-support.
Otherwise answer yourself.`,
  handoff: {
    targets: [
      { agent: billingAgent, description: "Billing, invoices, payments" },
      { agent: techAgent, description: "Technical support, debugging" },
    ],
    maxHandoffs: 3,
  },
});

await frontDesk.run("My last invoice looks wrong.", { userId: "u-1" });
```

The user keeps talking to `frontDesk`. The specialist sees the same thread.
