Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions packages/agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -205,7 +205,7 @@ export function resolveModel(spec: ModelSpecifier): LanguageModel {
}

/**
* Tool definition for BasicAgent
* Tool definition for BuiltInAgent
*/
export interface ToolDefinition<TParameters extends z.ZodTypeAny = z.ZodTypeAny> {
name: string;
Expand All @@ -215,7 +215,7 @@ export interface ToolDefinition<TParameters extends z.ZodTypeAny = z.ZodTypeAny>
}

/**
* 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
Expand Down Expand Up @@ -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)
*/
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the import path path on a newline as well please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's exactly the same path in this case

*/
export class BasicAgent extends BuiltInAgent {
constructor(config: BuiltInAgentConfiguration) {
super(config);
console.warn("BasicAgent is deprecated, use BuiltInAgent instead");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is a clean way to do this.

}
}