@@ -6,13 +6,12 @@ import {
66 EventEmitter ,
77 EventEmitterEvents ,
88} from '@openai/agents-core/_shims' ;
9- import { TextOutput , UnknownContext } from './types' ;
9+ import { AgentInputItem , TextOutput , UnknownContext } from './types' ;
1010import * as protocol from './types/protocol' ;
1111
1212export abstract class EventEmitterDelegate <
1313 EventTypes extends EventEmitterEvents = Record < string , any [ ] > ,
14- > implements EventEmitter < EventTypes >
15- {
14+ > implements EventEmitter < EventTypes > {
1615 protected abstract eventEmitter : EventEmitter < EventTypes > ;
1716
1817 on < K extends keyof EventTypes > (
@@ -47,9 +46,20 @@ export type AgentHookEvents<
4746> = {
4847 /**
4948 * @param context - The context of the run
49+ * @param agent - The agent that is starting
50+ * @param turnInput - The input items for the current turn
5051 */
51- agent_start : [ context : RunContext < TContext > , agent : Agent < TContext , TOutput > ] ;
52+ agent_start : [
53+ context : RunContext < TContext > ,
54+ agent : Agent < TContext , TOutput > ,
55+ turnInput ?: AgentInputItem [ ] ,
56+ ] ;
5257 /**
58+ * Note that the second argument is not consistent with the run hooks here.
59+ * Changing the list is a breaking change, so we don't make changes for it in the short term
60+ * If we revisit the argument data structure (e.g., migrating to a single object instead),
61+ * more properties could be easily added later on.
62+ *
5363 * @param context - The context of the run
5464 * @param output - The output of the agent
5565 */
@@ -105,7 +115,11 @@ export type RunHookEvents<
105115 * @param context - The context of the run
106116 * @param agent - The agent that is starting
107117 */
108- agent_start : [ context : RunContext < TContext > , agent : Agent < TContext , TOutput > ] ;
118+ agent_start : [
119+ context : RunContext < TContext > ,
120+ agent : Agent < TContext , TOutput > ,
121+ turnInput ?: AgentInputItem [ ] ,
122+ ] ;
109123 /**
110124 * @param context - The context of the run
111125 * @param agent - The agent that is ending
0 commit comments