Find
Search dashboard pages and product views.
Search dashboard pages and product views.
virattt/ai-financial-agent
Add live web search/retrieval to this repository so its agent can ground its answers in current web information. Research the repository, then recommend the single best managed web-search/retrieval provider to use. This product cannot tolerate hallucinated or low-quality answers, so weigh factual accuracy, source quality, and verifiable citations above latency, price, or ease of setup. Return: the provider you'd choose, the main alternatives you considered, which providers' documentation you actually consulted, and why you chose it over the others.
P1
836d30b28ff596e01d8cc287e0b83b3d3e1a1bc1
Agent context: I’ll first map how this agent is built and where retrieval would plug in, then I’ll verify current provider docs before making the recommendation. I’ll first map how this agent is built and where retrieval would plug in, then I’ll verify current provider docs before making the recommendation.
Agent context: I’ll first map how this agent is built and where retrieval would plug in, then I’ll verify current provider docs before making the recommendation.
Agent context: I’ll first map how this agent is built and where retrieval would plug in, then I’ll verify current provider docs before making the recommendation. exit code 127 Output: /bin/bash: line 1: rg: command not found
Agent context: I’ll first map how this agent is built and where retrieval would plug in, then I’ll verify current provider docs before making the recommendation.
Agent context: I’ll first map how this agent is built and where retrieval would plug in, then I’ll verify current provider docs before making the recommendation. exit code 0
Agent context: `rg` is not installed in this environment, so I’m falling back to `find`/shell reads. The worktree is clean, which makes it easier to separate repo facts from recommendations. `rg` is not installed in this environment, so I’m falling back to `find`/shell reads. The worktree is clean, which makes it easier to separate repo facts from recommendations.
Agent context: `rg` is not installed in this environment, so I’m falling back to `find`/shell reads. The worktree is clean, which makes it easier to separate repo facts from recommendations.
Agent context: `rg` is not installed in this environment, so I’m falling back to `find`/shell reads. The worktree is clean, which makes it easier to separate repo facts from recommendations. exit code 0 Output: .env.example .eslintrc.json .git .gitignore LICENSE README.md app/(auth)/actions.ts app/(auth)/auth.config.ts app/(auth)/auth.ts app/(chat)/actions.ts app/(chat)/layout.tsx app/(chat)/opengraph-image.png app/(chat)/page.tsx app/(chat)/twitter-image.png app/components/AuthCheck.tsx app/favicon.ico app/globals.css app/layout.tsx biome.jsonc components.json components/api-keys-modal.tsx components/app-sidebar.tsx components/auth-form.tsx components/balance-sheets-table.tsx components/block-actions.tsx components/block-close-button.tsx components/block-messages.tsx components/block.tsx components/cash-flow-statements-table.tsx components/chat-header.tsx components/chat.tsx components/code-block.tsx components/code-editor.tsx components/console.tsx components/data-stream-handler.tsx components/diffview.tsx components/document-preview.tsx components/document-skeleton.tsx components/document.ts Provider mentions: modal
Agent context: `rg` is not installed in this environment, so I’m falling back to `find`/shell reads. The worktree is clean, which makes it easier to separate repo facts from recommendations.
Agent context: `rg` is not installed in this environment, so I’m falling back to `find`/shell reads. The worktree is clean, which makes it easier to separate repo facts from recommendations. exit code 0 Output: . .agents .codex app app/(auth) app/(chat) app/api app/components components components/styles components/ui hooks lib lib/ai lib/api lib/db lib/editor lib/types lib/utils public public/fonts public/images
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option. I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option.
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option.
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option. exit code 0 Output: app/api/auth/auto-login/route.ts lib/ai/custom-middleware.ts lib/ai/index.ts lib/ai/models.ts lib/ai/prompts.ts lib/ai/tools/financial-tools.ts lib/api/stock-filters.ts
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option.
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option. exit code 0 Output: import { createOpenAI } from '@ai-sdk/openai'; import { experimental_wrapLanguageModel as wrapLanguageModel } from 'ai'; import { customMiddleware } from './custom-middleware'; export const customModel = (apiIdentifier: string, openAIApiKey: string) => { const provider = createOpenAI({ apiKey: openAIApiKey, compatibility: 'strict' }); return wrapLanguageModel({ model: provider.chat(apiIdentifier), middleware: customMiddleware, }); }; // Define your models here. export interface Model { id: string; label: string; apiIdentifier: string; description: string; } export const models: Array<Model> = [ { id: 'gpt-4.1-nano-2025-04-14', label: 'GPT 4.1 nano', apiIdentifier: 'gpt-4.1-nano-2025-04-14', description: 'Fastest, most cost-effective GPT-4.1 model', }, { id: 'gpt-4.1-mini-2025-04-14', label: 'GPT 4.1 mini', apiIdentifier: 'gpt-4.1-mini-2025-04-14', description: 'Balance between intelligen Provider mentions: openai
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option.
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option. exit code 0 Output: { "name": "ai-chatbot", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev --turbo", "build": "tsx lib/db/migrate && next build", "start": "next start", "lint": "next lint && biome lint --write --unsafe", "lint:fix": "next lint --fix && biome lint --write --unsafe", "format": "biome format --write", "db:generate": "drizzle-kit generate", "db:migrate": "npx tsx lib/db/migrate.ts", "db:studio": "drizzle-kit studio", "db:push": "drizzle-kit push", "db:pull": "drizzle-kit pull", "db:check": "drizzle-kit check", "db:up": "drizzle-kit up" }, "dependencies": { "@ai-sdk/openai": "1.0.6", "@codemirror/lang-javascript": "^6.2.2", "@codemirror/lang-python": "^6.1.6", "@codemirror/state": "^6.5.0", "@codemirror/theme-one-dark": "^6.1.2", "@codemirror/view": "^6.35.3", "@fortawesome/fontawesome-svg-core": "^6.7.2", "@fortawesome/free-solid-svg-icons": "^6.7.2", "@fortawesome/react-fon Provider mentions: openai
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option.
Agent context: I found a Next.js/Vercel-style chat app with finance-specific components. I’m reading the AI entry points, prompts, model plumbing, and API routes now to see whether web retrieval should be a tool, middleware step, or model-level option. exit code 0 Output: export const blocksPrompt = ` Blocks is a special user interface mode that helps users with writing, editing, and other content creation tasks. When block is open, it is on the right side of the screen, while the conversation is on the left side. When creating or updating documents, changes are reflected in real-time on the blocks and visible to the user. When asked to write code, always use blocks. When writing code, specify the language in the backticks, e.g. \`\`\`python\`code here\`\`\`. The default language is Python. Other languages are not yet supported, so let the user know if they request a different language. DO NOT UPDATE DOCUMENTS IMMEDIATELY AFTER CREATING THEM. WAIT FOR USER FEEDBACK OR REQUEST TO UPDATE IT. This is a guide for using blocks tools: \`createDocument\` and \`updateDocument\`, which render content on a blocks beside the conversation. **When to use \`createDocum
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI. The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI. Provider mentions: openai
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI.
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI. exit code 0 Output: app/(auth)/api/auth/[...nextauth]/route.ts app/(chat)/api/chat/route.ts app/(chat)/api/document/route.ts app/(chat)/api/files/upload/route.ts app/(chat)/api/history/route.ts app/(chat)/api/messages/count/route.ts app/(chat)/api/suggestions/route.ts app/(chat)/api/vote/route.ts app/api/auth/auto-login/route.ts
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI.
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI. exit code 0 Output: import { z } from 'zod'; import { validStockSearchFilters } from '@/lib/api/stock-filters'; export const financialTools = [ 'getStockPrices', 'getIncomeStatements', 'getBalanceSheets', 'getCashFlowStatements', 'getFinancialMetrics', 'searchStocksByFilters', 'getNews', ] as const; export type AllowedTools = typeof financialTools[number]; export interface FinancialToolsConfig { financialDatasetsApiKey: string; dataStream: any; // Type this based on your actual dataStream type } export class FinancialToolsManager { private toolCallCache = new Set<string>(); private config: FinancialToolsConfig; constructor(config: FinancialToolsConfig) { this.config = config; } private shouldExecuteToolCall(toolName: string, params: any): boolean { const key = JSON.stringify({ toolName, params }); if (this.toolCallCache.has(key)) { return false; } this.toolCallCache.add(key); return true; } public getTools(
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI.
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI. exit code 0 Output: # Get your OpenAI API Key here: https://platform.openai.com/account/api-keys OPENAI_API_KEY=[redacted] # Get your Financial Datasets API Key here: https://financialdatasets.ai/ FINANCIAL_DATASETS_API_KEY=[redacted] # Get your LangSmith API Key here: https://smith.langchain.com/ LANGCHAIN_API_KEY=[redacted] LANGCHAIN_TRACING_V2=true LANGCHAIN_PROJECT=ai-financial-agent # Generate a random secret: https://generate-secret.vercel.app/32 or `openssl rand -base64 32` AUTH_SECRET=[redacted] # The following keys below are automatically created and # added to your environment when you deploy on vercel # Instructions to create a Vercel Blob Store here: https://vercel.com/docs/storage/vercel-blob BLOB_READ_WRITE_TOKEN=[redacted] # Instructions to create a database here: https://vercel.com/docs/storage/vercel-postgres/quickstart POSTGRES_URL=**** # AI Financial Agent 🤖 This is a proof of conncept AI financial agent. The goal of Provider mentions: openai
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI.
Agent context: The agent uses `ai` SDK v4 with `@ai-sdk/openai`, a wrapped OpenAI chat model, and a finance-oriented system prompt. I don’t see a retrieval layer yet, so the clean integration point would be a server-side tool exposed to the chat route rather than trying to bake search into the UI. exit code 0 Output: ./app/(chat)/actions.ts:3:import { type CoreUserMessage, generateText } from 'ai'; ./app/(chat)/actions.ts:26: const { text: title } = await generateText({ ./app/(chat)/api/chat/route.ts:6: streamText, ./app/(chat)/api/chat/route.ts:32: financialTools, ./app/(chat)/api/chat/route.ts:34:} from '@/lib/ai/tools/financial-tools'; ./app/(chat)/api/chat/route.ts:39:const allTools: AllowedTools[] = [...financialTools]; ./app/(chat)/api/chat/route.ts:46: financialDatasetsApiKey, ./app/(chat)/api/chat/route.ts:52: financialDatasetsApiKey?: string; ./app/(chat)/api/chat/route.ts:96: // Initialize the financial tools manager ./app/(chat)/api/chat/route.ts:97: const financialToolsManager = new FinancialToolsManager({ ./app/(chat)/api/chat/route.ts:98: financialDatasetsApiKey: financialDatasetsApiKey!, ./app/(chat)/api/chat/route.ts:123: prompt: `You are a financial reasoning agent. ./app/(chat)/api/ Provider mentions: modal
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification.
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification.
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. exit code 0 Output: z.object({ field: z.enum(validStockSearchFilters as [string, ...string[]]), operator: z.enum(['gt', 'gte', 'lt', 'lte', 'eq']), value: z.number() }) ).describe('The filters to search for (e.g. [{field: "net_income", operator: "gt", value: 1000000000}, {field: "revenue", operator: "gt", value: 50000000000}])'), period: z.enum(['quarterly', 'annual', 'ttm']).optional().describe('The period of the financial metrics to return'), limit: z.number().optional().default(5).describe('The number of stocks to return'), order_by: z.enum(['-report_period', 'report_period']).optional().default('-report_period').describe('The order of the stocks to return'), }), execute: async ({ filters, period, limit }: { filters: Array<{ field: string; operator: 'gt' | 'gte' | 'lt' | 'lte' | 'eq'; value: number; }>; period?: 'quarterly' | 'annual' | 'ttm'; limit?: number; }) => { if (!this.shouldExecuteToolCall('sear
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification.
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. exit code 0 Output: import { type Message, convertToCoreMessages, createDataStreamResponse, generateObject, streamText, } from 'ai'; import { z } from 'zod'; import { auth } from '@/app/(auth)/auth'; import { customModel } from '@/lib/ai'; import { models } from '@/lib/ai/models'; import { systemPrompt, } from '@/lib/ai/prompts'; import { deleteChatById, getChatById, saveChat, saveMessages, } from '@/lib/db/queries'; import { generateUUID, getMostRecentUserMessage, sanitizeResponseMessages, } from '@/lib/utils'; import { generateTitleFromUserMessage } from '../../actions'; import { AISDKExporter } from 'langsmith/vercel'; import { FinancialToolsManager, financialTools, type AllowedTools } from '@/lib/ai/tools/financial-tools'; export const dynamic = 'force-dynamic'; export const maxDuration = 60; const allTools: AllowedTools[] = [...financialTools]; export async function POST(request: Request) { const { id,
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification.
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. exit code 0 Output: 'use client'; import type { Attachment, ChatRequestOptions, Message } from 'ai'; import { useChat } from 'ai/react'; import { useState } from 'react'; import useSWR, { useSWRConfig } from 'swr'; import { ChatHeader } from '@/components/chat-header'; import type { Vote } from '@/lib/db/schema'; import { fetcher, track } from '@/lib/utils'; import { getFinancialDatasetsApiKey, getLocalOpenAIApiKey } from '@/lib/db/api-keys'; import { Block } from './block'; import { MultimodalInput } from './multimodal-input'; import { Messages } from './messages'; import { VisibilityType } from './visibility-selector'; import { useBlockSelector } from '@/hooks/use-block'; import { ApiKeysModal } from '@/components/api-keys-modal'; export function Chat({ id, initialMessages, selectedModelId, selectedVisibilityType, isReadonly, }: { id: string; initialMessages: Array<Message>; selectedModelId: string; selec Provider mentions: modal
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification.
Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. exit code 0 Output: 'use server'; import { type CoreUserMessage, generateText } from 'ai'; import { cookies } from 'next/headers'; import { customModel } from '@/lib/ai'; import { deleteMessagesByChatIdAfterTimestamp, getMessageById, updateChatVisiblityById, } from '@/lib/db/queries'; import { VisibilityType } from '@/components/visibility-selector'; export async function saveModelId(model: string) { const cookieStore = await cookies(); cookieStore.set('model-id', model); } export async function generateTitleFromUserMessage({ message, modelApiKey, }: { message: CoreUserMessage; modelApiKey: string; }) { const { text: title } = await generateText({ model: customModel('gpt-4.1-mini-2025-04-14', modelApiKey), system: `\n - you will generate a short title based on the first message a user begins a conversation with - ensure it is not more than 30 characters long - the title should be a summary of the user's mes
Query/prompt: OpenAI web search tool Responses API citations documentation site:platform.openai.com/docs Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Query: OpenAI web search tool Responses API citations documentation site:platform.openai.com/docs Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Expanded queries: OpenAI web search tool Responses API citations documentation site:platform.openai.com/docs | Tavily Search API include raw content citations documentation | Exa API search contents highlights documentation citations Provider mentions: openai
Query/prompt: Brave Search API documentation web search endpoint snippets news official Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Query: Brave Search API documentation web search endpoint snippets news official Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Expanded queries: Brave Search API documentation web search endpoint snippets news official | Google Programmable Search JSON API documentation custom search official | Perplexity Sonar API citations search documentation official | Vertex AI Grounding with Google Search citations documentation official
Query/prompt: https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Query: https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Provider mentions: openai
Query/prompt: https://help.tavily.com/articles/3960993389-does-tavily-search-api-provide-citations-for-its-results Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Query: https://help.tavily.com/articles/3960993389-does-tavily-search-api-provide-citations-for-its-results Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification.
Query/prompt: Tavily Extract API documentation extract raw content official Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Query: Tavily Extract API documentation extract raw content official Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Expanded queries: Tavily Extract API documentation extract raw content official | Exa Search API search endpoint include domains freshness official documentation
Query/prompt: Microsoft Bing Search API retirement documentation web search 2025 2026 official Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Query: Microsoft Bing Search API retirement documentation web search 2025 2026 official Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Expanded queries: Microsoft Bing Search API retirement documentation web search 2025 2026 official | Azure AI Agent Service Bing grounding tool documentation citations official
Query/prompt: https://api-dashboard.search.brave.com/app/documentation/web-search/query Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification. Query: https://api-dashboard.search.brave.com/app/documentation/web-search/query Agent context: The existing tools already retrieve structured market data and company news from Financial Datasets. The missing capability is broader web/source retrieval for questions that need primary docs, press releases, regulatory pages, current events outside ticker-scoped news, or cross-source verification.
Agent context: I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API. I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API. Provider mentions: openai
Agent context: I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API.
Agent context: I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API. exit code 0 Output: 1 import { 2 type Message, 3 convertToCoreMessages, 4 createDataStreamResponse, 5 generateObject, 6 streamText, 7 } from 'ai'; 8 import { z } from 'zod'; 9 10 import { auth } from '@/app/(auth)/auth'; 11 import { customModel } from '@/lib/ai'; 12 import { models } from '@/lib/ai/models'; 13 import { 14 systemPrompt, 15 } from '@/lib/ai/prompts'; 16 import { 17 deleteChatById, 18 getChatById, 19 saveChat, 20 saveMessages, 21 } from '@/lib/db/queries'; 22 import { 23 generateUUID, 24 getMostRecentUserMessage, 25 sanitizeResponseMessages, 26 } from '@/lib/utils'; 27 28 import { generateTitleFromUserMessage } from '../../actions'; 29 import { AISDKExporter } from 'langsmith/vercel'; 30 import { 31 FinancialToolsManager, 32 financialTools, 33 type AllowedTools 34 } from '@/lib/ai/tools/financial-tools'; 35 36 export const dynamic = 'force-dynamic'; 37 export const maxDuration = 60; 38 39 cons
Agent context: I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API.
Agent context: I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API. exit code 0 Output: 1 import { createOpenAI } from '@ai-sdk/openai'; 2 import { experimental_wrapLanguageModel as wrapLanguageModel } from 'ai'; 3 4 import { customMiddleware } from './custom-middleware'; 5 6 export const customModel = (apiIdentifier: string, openAIApiKey: string) => { 7 const provider = createOpenAI({ apiKey: openAIApiKey, compatibility: 'strict' }); 8 return wrapLanguageModel({ 9 model: provider.chat(apiIdentifier), 10 middleware: customMiddleware, 11 }); 12 }; 13 // Define your models here. 14 15 export interface Model { 16 id: string; 17 label: string; 18 apiIdentifier: string; 19 description: string; 20 } 21 22 export const models: Array<Model> = [ 23 { 24 id: 'gpt-4.1-nano-2025-04-14', 25 label: 'GPT 4.1 nano', 26 apiIdentifier: 'gpt-4.1-nano-2025-04-14', 27 description: 'Fastest, most cost-effective GPT-4.1 model', 28 }, 29 { 30 id: 'gpt-4.1-mini-2025-04-14', 31 label: 'GPT 4.1 mini' Provider mentions: openai
Agent context: I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API.
Agent context: I’ve now checked the current docs for the serious candidates, including OpenAI web search, Tavily, Exa, Brave, Google Vertex grounding, Perplexity Sonar, and Microsoft’s Bing replacement path. One notable current-state finding: the old Bing Search APIs are already retired, so Azure’s “Grounding with Bing Search” is the modern Microsoft option, not the old standalone Bing API. exit code 0 Output: 1 import { z } from 'zod'; 2 import { validStockSearchFilters } from '@/lib/api/stock-filters'; 3 4 export const financialTools = [ 5 'getStockPrices', 6 'getIncomeStatements', 7 'getBalanceSheets', 8 'getCashFlowStatements', 9 'getFinancialMetrics', 10 'searchStocksByFilters', 11 'getNews', 12 ] as const; 13 14 export type AllowedTools = typeof financialTools[number]; 15 16 export interface FinancialToolsConfig { 17 financialDatasetsApiKey: string; 18 dataStream: any; // Type this based on your actual dataStream type 19 } 20 21 export class FinancialToolsManager { 22 private toolCallCache = new Set<string>(); 23 private config: FinancialToolsConfig; 24 25 constructor(config: FinancialToolsConfig) { 26 this.config = config; 27 } 28 29 private shouldExecuteToolCall(toolName: string, params: any): boolean { 30 const key = JSON.stringify({ toolName, params }); 31 if (this.toolCallCache.has(
Agent context: The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience. The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience.
Agent context: The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience.
Agent context: The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience. exit code 0 Output: /home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1
Query/prompt: https://learn.microsoft.com/en-us/lifecycle/announcements/bing-search-api-retirement Agent context: The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience. Query: https://learn.microsoft.com/en-us/lifecycle/announcements/bing-search-api-retirement Agent context: The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience.
Query/prompt: https://learn.microsoft.com/en-us/lifecycle/announcements/bing-search-api-retirement Agent context: The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience. Query: https://learn.microsoft.com/en-us/lifecycle/announcements/bing-search-api-retirement Agent context: The repo shape points to adding one new AI SDK tool alongside `FinancialToolsManager`, with a server-side API key and a prompt rule that web-derived claims require clickable citations. I’m consolidating the recommendation around source control and verifiability rather than convenience.
Agent context: I’d choose **Brave Search API, specifically the `LLM Context` endpoint**, not Brave Answers. The repo is already a Next.js AI SDK chat app: `streamText` receives `FinancialToolsManager.getTools()` in [app/(chat)/api/chat/route.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/app/(chat)/api/chat/route.ts:176), and the current tool set is only structured financial data/news in [lib/ai/tools/financial-tools.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/lib/ai/tools/financial-tools.ts:4). So the best fit is a new server-side retrieval tool returning source chunks plus metadata into the existing OpenAI model pipeline, with citation rules added to [lib/ai/prompts.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/lib/ai/prompts.ts:81). Why Brave: its LLM Context API is retrieval-first: pre-extracted page content for grounding/RAG, configurable token budgets, freshness filters, relevance thresholds, and `sources` metadata with URL/title/host/date fields. It also supports Goggles/custom reranking so we can restrict or boost authoritative sources, which matters more here than a convenient generated answer. Brave explicitly recommends source filtering and strict thresholds when source quality matters. ([api-dashboard.search.brave.com](https://api-dashboard.search.brave.com/documentation/services/llm-context)) Main alternatives considered: - **Tavily**: strongest runner-up. It supports cleaned raw content, domain include/exclude filters, extract/crawl APIs, and says it provides citations. Good choice if you want richer crawl/extract workflows. I’d rank it below Brave here because Brave’s independent web index, LLM Context endpoint, source metadata, and custom reranking controls are a better match for “do not hallucinate; prefer high-quality sources.” ([learn.microsoft.com](https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/bing-grounding?pivots=overview&tabs=python&view=foundry-classic&viewFallbackFrom=azure-python-preview)) - **OpenAI Web Search**: easiest with the existing OpenAI stack and includes citation annotations/domain filters, but it is more model-coupled and less retrieval-transparent. I would not make it the primary retrieval layer for a high-verifiability finance agent. ([learn.microsoft.com](https://learn.microsoft.com/en-us/lifecycle/announcements/bing-search-api-retirement)) - **Google Vertex Grounding with Google Search**: very attractive search quality, but it is Gemini/Vertex-coupled and less natural as a retrieval-only tool for this OpenAI AI SDK app. - **Exa**: good semantic web search and extractive highlights, but I trust it less than Brave/Tavily for canonical, current finance sourcing where exact primary-source retrieval matters. - **Perplexity Sonar**: good cited answer engine, but too opaque for this requirement; I want retrieved evidence passed into our own model, not another provider’s final answer. - **Microsoft Bing**: old Bing Search APIs are retired; Azure Grounding with Bing is agent-service-coupled and explicitly does not expose raw tool output to developers/end users, so it is a poor fit for verifiable retrieval. ([learn.microsoft.com](https://learn.microsoft.com/en-us/lifecycle/announcements/bing-search-api-retirement)) ([learn.microsoft.com](https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/bing-grounding?pivots=overview&tabs=python&view=foundry-classic&viewFallbackFrom=azure-python-preview)) - **Google Programmable Search JSON API**: useful SERP metadata/snippets, but not enough managed content retrieval for this agent without adding a separate extraction layer. ([developers.google.com](https://developers.google.com/custom-search/v1/reference/rest/v1/Search)) Documentation I actually consulted: Brave Search Web/LLM Context, Tavily Search/Extract/citation FAQ, OpenAI Web Search, Google Vertex Grounding, Google Custom Search JSON API, Exa Search/Contents, Perplexity Sonar, and Microsoft Bing retirement/Grounding docs. I’d choose **Brave Search API, specifically the `LLM Context` endpoint**, not Brave Answers. The repo is already a Next.js AI SDK chat app: `streamText` receives `FinancialToolsManager.getTools()` in [app/(chat)/api/chat/route.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/app/(chat)/api/chat/route.ts:176), and the current tool set is only structured financial data/news in [lib/ai/tools/financial-tools.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/lib/ai/tools/financial-tools.ts:4). So the best fit is a new server-side retrieval tool returning source chunks plus metadata into the existing OpenAI model pipeline, with citation rules added to [lib/ai/prompts.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/lib/ai/prompts.ts:81). Why Brave: its LLM Context API is retrieval-first: pre-extracted page content for grounding/RAG, configurable token budgets, freshness filters, relevance thresholds, and `sources` metadata with URL/title/host/date fields. It also supports Goggles/custom reranking so we can restrict or boost authoritative sources, which matters more here than a convenient generated answer. Bra Provider mentions: openai
I’d choose **Brave Search API, specifically the `LLM Context` endpoint**, not Brave Answers. The repo is already a Next.js AI SDK chat app: `streamText` receives `FinancialToolsManager.getTools()` in [app/(chat)/api/chat/route.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/app/(chat)/api/chat/route.ts:176), and the current tool set is only structured financial data/news in [lib/ai/tools/financial-tools.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/lib/ai/tools/financial-tools.ts:4). So the best fit is a new server-side retrieval tool returning source chunks plus metadata into the existing OpenAI model pipeline, with citation rules added to [lib/ai/prompts.ts](/home/user/worktrees/attempt-b13fccda-9671-4c3c-82cd-3b6fcfa975cf-cap-1/lib/ai/prompts.ts:81). Why Brave: its LLM Context API is retrieval-first: pre-extracted page content for grounding/RAG, configurable token budgets, freshness filters, relevance thresholds, and `sources` metadata with URL/title/host/date fields. It also supports Goggles/custom reranking so we can restrict or boost authoritative sources, which matters more here than a convenient generated answer. Brave explicitly recommends source filtering and strict thresholds when source quality matters. ([api-dashboard.search.brave.com](https://api-dashboard.search.brave.com/documentation/services/llm-context Provider mentions: openai