import { Agent, Team, TeamMode, openai } from "@radaros/core";
const billing = new Agent({
name: "billing",
model: openai("gpt-4o-mini"),
instructions: `You are a billing specialist. Handle invoices, payments, and refunds.
When the issue is resolved, use the complete tool to end the conversation.`,
});
const support = new Agent({
name: "technical-support",
model: openai("gpt-4o-mini"),
instructions: `You are a tech support agent. Troubleshoot software and hardware issues.
When the issue is resolved, use the complete tool to end the conversation.`,
});
const frontDesk = new Agent({
name: "front-desk",
model: openai("gpt-4o"),
instructions: `You are the front desk receptionist. Understand the user's needs
and route them to the right specialist. Do not try to solve issues yourself.`,
});
const team = new Team({
name: "support-team",
mode: TeamMode.Handoff,
model: openai("gpt-4o"),
members: [frontDesk, billing, support],
maxRounds: 5,
});
const result = await team.run("I got charged twice for my subscription");
console.log(result.text);
// The front-desk routes to billing, which handles the duplicate charge
console.log(result.handoffChain);
// ["front-desk", "billing"]