diff --git a/bots/bot_father.ts b/bots/bot_father.ts index 306129fcb..74b74c724 100644 --- a/bots/bot_father.ts +++ b/bots/bot_father.ts @@ -1,4 +1,4 @@ -import { Agent, Runner, hostedMcpTool, withTrace } from "@openai/agents"; +import { Agent, Runner, hostedMcpTool, withTrace, webSearchTool } from "@openai/agents"; export type WorkflowInput = { input_as_text: string }; @@ -6,8 +6,9 @@ export abstract class BotFather { protected readonly openisleToken = (process.env.OPENISLE_TOKEN ?? "").trim(); protected readonly weatherToken = (process.env.APIFY_API_TOKEN ?? "").trim(); - protected readonly mcp = this.createHostedMcpTool(); + protected readonly openisleMcp = this.createHostedMcpTool(); protected readonly weatherMcp = this.createWeatherMcpTool(); + protected readonly webSearchPreview = this.createWebSearchPreviewTool(); protected readonly agent: Agent; constructor(protected readonly name: string) { @@ -27,7 +28,11 @@ export abstract class BotFather { this.agent = new Agent({ name: this.name, instructions: this.buildInstructions(), - tools: [this.mcp, this.weatherMcp], + tools: [ + this.openisleMcp, + this.weatherMcp, + this.webSearchPreview + ], model: "gpt-4o", modelSettings: { temperature: 0.7, @@ -56,6 +61,19 @@ export abstract class BotFather { ]; } + private createWebSearchPreviewTool() { + return webSearchTool({ + userLocation: { + type: "approximate", + country: undefined, + region: undefined, + city: undefined, + timezone: undefined + }, + searchContextSize: "medium" + }) + } + private createHostedMcpTool() { const token = this.openisleToken; const authConfig = token