import { z } from 'zod'; import { Agent, handoff, RunContext } from '@openai/agents'; const EscalationData = z.object({ reason: z.string() }); type EscalationData = z.infer; async function onHandoff( ctx: RunContext, input: EscalationData | undefined, ) { console.log(`Escalation agent called with reason: ${input?.reason}`); } const agent = new Agent({ name: 'Escalation agent' }); const handoffObj = handoff(agent, { onHandoff, inputType: EscalationData, });