Delegate to agents

Let one agent hand a question to another agent, called as a tool, and use its answer. Each call runs as a child run.

Before you start

You need a project with an agent. See Create an agent.

Let an agent call another

  1. Add the specialist. Here it holds the answer to refund questions:
    agents/billing.ts
    import { agent } from "veryfront/agent"; export default agent({  id: "billing",  name: "Billing",  system: "Answer billing questions in one sentence. Refunds take 5 business days.",});
  2. Name it in the front agent's delegates. Each one becomes an agent_<id> tool:
    agents/support.ts
    import { agent } from "veryfront/agent"; export default agent({  id: "support",  name: "Support assistant",  system: "Send billing and refund questions to the billing agent and pass its answer on.",  delegates: ["billing"],});
  3. Start the project with npm run dev.
  4. Open Chat in Studio.
  5. Pick Support assistant.
  6. Ask "How long does a refund take?". You should now see it call agent_billing and reply 5 business days.

Next steps