Web search
Understand how TurboStarter AI integrates web search, where the provider layer lives, and how Tavily, Brave Search, Exa, and Firecrawl fit into the chat stack.
Web search is the capability that lets the chat app pull in current or externally verified information instead of relying only on model memory. In TurboStarter AI, that capability lives behind a shared provider contract so the tool layer can stay stable while the search backend changes.
This is especially useful for:
- current events and recent announcements
- source-backed answers that need citations or fresh data
- niche lookups where static model knowledge may be incomplete
- assistant flows that benefit from explicit retrieval before generating a response
Where it lives
The shared implementation is in packages/ai/chat/src/tools/web-search.
That module currently includes:
- a tool entrypoint used by the chat flow
- input schemas for multi-query web search requests
- shared normalization utilities for results, images, domains, and dates
- provider strategies for Tavily, Brave Search, Exa, and Firecrawl
- provider-specific SDK wrappers under
packages/ai/chat/src/tools/sdk/*
The overall shape follows the same pattern as the rest of the AI package: keep the chat app code focused on behavior, and isolate third-party integrations behind typed boundaries.
Provider architecture
The web-search tool does not talk to a single provider API directly. Instead, it uses a provider strategy layer. Each provider implementation maps its own SDK response into the same result shape:
results: normalized search hitsimages: normalized image candidates
That makes it easier to:
- swap the default provider
- compare providers during development
- keep the UI independent from provider-specific response formats
- add provider-specific options without rewriting the whole tool surface
Implemented providers
TurboStarter AI currently includes the following web-search providers:
Tavily
Search engine designed for agent and LLM workflows, with structured results that fit tool-driven assistants well.
Brave Search
General web search API with broad public web coverage and a straightforward result format.
Exa
Search platform tailored for AI applications, with highlights, page text, and metadata useful in agentic workflows.
Firecrawl
Search and crawl-oriented provider that fits well when you want richer control over web, news, and image retrieval.
Environment variables
If you want to enable these providers, add the corresponding server-side keys in apps/web/.env.local or your deployment environment:
BRAVE_SEARCH_API_KEY=""
EXA_API_KEY=""
FIRECRAWL_API_KEY=""
TAVILY_API_KEY=""Only configure the providers you actually plan to use. Keeping multiple providers available can be useful during development, but it is not required.
How it fits into chat
The Chat app uses web search as a tool rather than as a separate product surface. That means the model decides when browsing is necessary based on the request and the tool instructions.
The shared chat package handles:
- deciding when the tool is relevant
- executing the normalized web-search flow
- streaming the tool status back into the conversation UI
- passing structured search results back into the model loop
For the user, this shows up as a normal tool-driven assistant interaction rather than a separate search screen.
Related documentation
How is this guide?
Last updated on
Tool calling
Learn how AI tool calling works, when to let models use external tools, and how to design reliable tool-based workflows in modern AI apps.
Model Context Protocol (MCP)
Learn what MCP is, how it standardizes tool and context access for AI systems, and when to use it instead of building custom integrations.