From 572e43b3ded322a56187e6bfbd5b2b8012846855 Mon Sep 17 00:00:00 2001 From: ran Date: Thu, 11 Dec 2025 16:39:25 +0100 Subject: [PATCH] fix: rename BasicAgent to BuiltInAgent and add deprecation --- packages/agent/src/index.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts index d19b225..9a8b2de 100644 --- a/packages/agent/src/index.ts +++ b/packages/agent/src/index.ts @@ -62,9 +62,9 @@ export type OverridableProperty = | "prompt"; /** - * Supported model identifiers for BasicAgent + * Supported model identifiers for BuiltInAgent */ -export type BasicAgentModel = +export type BuiltInAgentModel = // OpenAI models | "openai/gpt-5" | "openai/gpt-5-mini" @@ -205,7 +205,7 @@ export function resolveModel(spec: ModelSpecifier): LanguageModel { } /** - * Tool definition for BasicAgent + * Tool definition for BuiltInAgent */ export interface ToolDefinition { name: string; @@ -215,7 +215,7 @@ export interface ToolDefinition } /** - * Define a tool for use with BasicAgent + * Define a tool for use with BuiltInAgent * @param name - The name of the tool * @param description - Description of what the tool does * @param parameters - Zod schema for the tool's input parameters @@ -423,13 +423,13 @@ export function convertToolDefinitionsToVercelAITools(tools: ToolDefinition[]): } /** - * Configuration for BasicAgent + * Configuration for BuiltInAgent */ -export interface BasicAgentConfiguration { +export interface BuiltInAgentConfiguration { /** * The model to use */ - model: BasicAgentModel | LanguageModel; + model: BuiltInAgentModel | LanguageModel; /** * Maximum number of steps/iterations for tool calling (default: 1) */ @@ -492,10 +492,10 @@ export interface BasicAgentConfiguration { tools?: ToolDefinition[]; } -export class BasicAgent extends AbstractAgent { +export class BuiltInAgent extends AbstractAgent { private abortController?: AbortController; - constructor(private config: BasicAgentConfiguration) { + constructor(private config: BuiltInAgentConfiguration) { super(); } @@ -976,10 +976,20 @@ export class BasicAgent extends AbstractAgent { } clone() { - return new BasicAgent(this.config); + return new BuiltInAgent(this.config); } abortRun(): void { this.abortController?.abort(); } } + +/** + * @deprecated Use BuiltInAgent instead + */ +export class BasicAgent extends BuiltInAgent { + constructor(config: BuiltInAgentConfiguration) { + super(config); + console.warn("BasicAgent is deprecated, use BuiltInAgent instead"); + } +}