Type Alias AgentBuilderWithSchema<T, M>

AgentBuilderWithSchema<T, M>: {
    [K in keyof AgentBuilder<any, any>]: K extends "withOutputSchema"
        ? AgentBuilder<any, any>[K]
        : AgentBuilder<any, any>[K] extends ((...args: any[]) => AgentBuilder<any, any>)
            ? ((...args: Parameters<AgentBuilder<any, any>[K]>) => AgentBuilderWithSchema<T, M>)
            : K extends "build" | "buildWithSchema" | "ask"
                ? K extends "build"
                    ? (() => Promise<BuiltAgent<T, M>>)
                    : K extends "buildWithSchema"
                        ? (<U>() => Promise<BuiltAgent<U, M>>)
                        : K extends "ask"
                            ? ((message: string | FullMessage) => Promise<RunnerAskReturn<T, M>>)
                            : never
                : AgentBuilder<any, any>[K]
}

AgentBuilder with typed output schema using mapped types This automatically preserves all method signatures from AgentBuilder while ensuring proper type inference

Type Parameters

  • T
  • M extends boolean = false