import { Agent } from './agent'; import { RunItem, TResponseInputItem } from './items'; import { RunContextWrapper } from './run-context'; import { SpanError } from './tracing/spans'; import { transformStringFunctionStyle } from './utils'; type OnHandoffWithInput = (context: RunContextWrapper, input: T) => any | Promise; type OnHandoffWithoutInput = (context: RunContextWrapper) => any | Promise; /** * The input data passed to a handoff. */ export declare class HandoffInputData { /** * The input history before `Runner.run()` was called. */ readonly inputHistory: string | TResponseInputItem[]; /** * The items generated before the agent turn where the handoff was invoked. */ readonly preHandoffItems: ReadonlyArray; /** * The new items generated during the current agent turn, including the item that triggered the * handoff and the tool output message representing the response from the handoff output. */ readonly newItems: ReadonlyArray; constructor( /** * The input history before `Runner.run()` was called. */ inputHistory: string | TResponseInputItem[], /** * The items generated before the agent turn where the handoff was invoked. */ preHandoffItems: ReadonlyArray, /** * The new items generated during the current agent turn, including the item that triggered the * handoff and the tool output message representing the response from the handoff output. */ newItems: ReadonlyArray); } /** * A function that filters the input data passed to the next agent. */ export type HandoffInputFilter = (data: HandoffInputData) => HandoffInputData; /** * A handoff is when an agent delegates a task to another agent. * For example, in a customer support scenario you might have a "triage agent" that determines * which agent should handle the user's request, and sub-agents that specialize in different * areas like billing, account management, etc. */ export declare class Handoff { /** * The name of the tool that represents the handoff. */ readonly toolName: string; /** * The description of the tool that represents the handoff. */ readonly toolDescription: string; /** * The JSON schema for the handoff input. Can be empty if the handoff does not take an input. */ readonly inputJsonSchema: Record; /** * The function that invokes the handoff. */ readonly onInvokeHandoff: (context: RunContextWrapper, args: string) => Promise>; /** * The name of the agent that is being handed off to. */ readonly agentName: string; /** * A function that filters the inputs that are passed to the next agent. */ readonly inputFilter: HandoffInputFilter | null; /** * Whether the input JSON schema is in strict mode. */ readonly strictJsonSchema: boolean; constructor(toolName: string, toolDescription: string, inputJsonSchema: Record, onInvokeHandoff: (context: RunContextWrapper, args: string) => Promise>, agentName: string, inputFilter?: HandoffInputFilter | null, strictJsonSchema?: boolean); /** * Get a transfer message for the handoff. */ getTransferMessage(agent: Agent): string; /** * Get the default tool name for a handoff to the given agent. */ static defaultToolName(agent: Agent): string; /** * Get the default tool description for a handoff to the given agent. */ static defaultToolDescription(agent: Agent): string; } /** * Create a handoff from an agent. * * @param agent The agent to handoff to * @param options Configuration options for the handoff */ export declare function handoff(agent: Agent, options?: { toolNameOverride?: string; toolDescriptionOverride?: string; onHandoff?: OnHandoffWithInput | OnHandoffWithoutInput; inputType?: new () => TInput; inputFilter?: HandoffInputFilter; }): Handoff; export declare const util: { transformStringFunctionStyle: typeof transformStringFunctionStyle; validateJson: (json: string, adapter: any, partial: boolean) => any; attachErrorToCurrentSpan: (error: SpanError) => void; }; export {};