From 975b2ae65357605332c823370c745eb3c1c703da Mon Sep 17 00:00:00 2001 From: MuhammadHamidRaza Date: Thu, 23 Oct 2025 22:56:21 +0500 Subject: [PATCH 1/3] Update customizeHandoff.ts --- examples/docs/handoffs/customizeHandoff.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/docs/handoffs/customizeHandoff.ts b/examples/docs/handoffs/customizeHandoff.ts index 10d5eee4..05371f59 100644 --- a/examples/docs/handoffs/customizeHandoff.ts +++ b/examples/docs/handoffs/customizeHandoff.ts @@ -1,13 +1,8 @@ -import { Agent, handoff, RunContext } from '@openai/agents'; - -function onHandoff(ctx: RunContext) { - console.log('Handoff called'); -} +import { Agent, handoff } from '@openai/agents'; const agent = new Agent({ name: 'My agent' }); const handoffObj = handoff(agent, { - onHandoff, toolNameOverride: 'custom_handoff_tool', toolDescriptionOverride: 'Custom description', }); From a540ebfcbb3b3521ece77964bb55ac7c3ebba839 Mon Sep 17 00:00:00 2001 From: MuhammadHamidRaza Date: Fri, 24 Oct 2025 06:29:41 +0500 Subject: [PATCH 2/3] Update customizeHandoff.ts --- examples/docs/handoffs/customizeHandoff.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/docs/handoffs/customizeHandoff.ts b/examples/docs/handoffs/customizeHandoff.ts index 05371f59..8d65217c 100644 --- a/examples/docs/handoffs/customizeHandoff.ts +++ b/examples/docs/handoffs/customizeHandoff.ts @@ -1,8 +1,15 @@ -import { Agent, handoff } from '@openai/agents'; +import { z } from 'zod'; +import { Agent, handoff, RunContext } from '@openai/agents'; + +function onHandoff(ctx: RunContext, input: { foo: string }) { + console.log('Handoff called with:', input.foo); +} const agent = new Agent({ name: 'My agent' }); const handoffObj = handoff(agent, { + onHandoff, + inputType: z.object({ foo: z.string() }), toolNameOverride: 'custom_handoff_tool', toolDescriptionOverride: 'Custom description', }); From a53e8fa1521b7705b9d2a185f7592585dbe0693c Mon Sep 17 00:00:00 2001 From: MuhammadHamidRaza Date: Fri, 24 Oct 2025 06:34:10 +0500 Subject: [PATCH 3/3] Update customizeHandoff.ts --- examples/docs/handoffs/customizeHandoff.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/docs/handoffs/customizeHandoff.ts b/examples/docs/handoffs/customizeHandoff.ts index 8d65217c..fe1642e2 100644 --- a/examples/docs/handoffs/customizeHandoff.ts +++ b/examples/docs/handoffs/customizeHandoff.ts @@ -1,15 +1,17 @@ import { z } from 'zod'; import { Agent, handoff, RunContext } from '@openai/agents'; -function onHandoff(ctx: RunContext, input: { foo: string }) { - console.log('Handoff called with:', input.foo); +const FooSchema = z.object({ foo: z.string() }); + +function onHandoff(ctx: RunContext, input?: { foo: string }) { + console.log('Handoff called with:', input?.foo); } const agent = new Agent({ name: 'My agent' }); const handoffObj = handoff(agent, { onHandoff, - inputType: z.object({ foo: z.string() }), + inputType: FooSchema, toolNameOverride: 'custom_handoff_tool', toolDescriptionOverride: 'Custom description', });