import { Agent, openai, defineTool } from "@agentium/core";
import { z } from "zod";
const billingAgent = new Agent({
name: "billing",
model: openai(process.env.OPENAI_FAST_MODEL ?? "gpt-6-luna"),
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(process.env.OPENAI_FAST_MODEL ?? "gpt-6-luna"),
instructions: "You debug and configure. Be concrete.",
});
const frontDesk = new Agent({
name: "front-desk",
model: openai(process.env.OPENAI_MODEL ?? "gpt-6.1-sol"),
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" });