Web Search
Overview
AI Generate can run a provider's native web search as part of a generation. The model searches the live web, grounds its answer in what it finds, and returns source URLs alongside the text. You enable it per request through a providerTools field on the AI Generate input, with no extra nodes.
providerTools works like providerOptions: you supply one block per provider namespace, and the executing AI Route reads only the block for the provider it runs. A single payload can carry search config for every provider, so search keeps working when a Route fails over from one provider to another.
Benefits
One request field - Turn on web search by adding
providerToolsto the input; no tool nodes to wire.Provider-agnostic - Set all provider blocks once; each Route uses the one that applies.
Failover-safe - A payload with every namespace stays valid across AI Route fallbacks; each provider applies the settings it supports and ignores the rest.
Normalized result - A
providerToolActivityfield reports the search the same way across providers, alongside asourcesarray of the URLs used.
Input Format
Add providerTools to the same input object you pass to AI Generate (default msg.payload), next to prompt or messages:
msg.payload = {
prompt: "What are the top technology news stories today? Cite your sources.",
providerTools: {
openai: { webSearch: { searchContextSize: "medium" } },
anthropic: { webSearch: { maxUses: 3 } },
google: { webSearch: {} }
}
};providerTools is keyed by provider namespace. The AI Route's connection provider selects the namespace using the same mapping as providerOptions:
openai
OpenAI, Azure OpenAI
anthropic
Anthropic, Vertex AI Anthropic
google
Google AI, Vertex AI
Every other block is ignored, so it is safe to set all three.
The tool key inside each block is webSearch (the only tool today). An unrecognized tool key is skipped with a warning and the request still succeeds.
Per-Provider Configuration
Each provider reads the config in its own vocabulary. Set the fields that apply to the provider your Route uses:
Azure OpenAI accepts a subset of the OpenAI settings (searchContextSize and an approximate userLocation); other fields are dropped. Vertex AI uses the same empty-config form as google.
Example: constrain the search by location
Using Web Search With Tools
Web search runs alongside any Tools you select on the AI Generate node. In a single generation the model can search the web and call your tools. See Tool Calling with AI Generate for tool setup.
Two behaviors to know:
Name collision - If one of your tools is named
web_searchand the provider's search tool has the same native name, your tool keeps its name and the provider search is exposed to the model asprovider_web_search.Gemini before v3 - Older Gemini models cannot combine search grounding with function tools. On those models, when you select tools the search is dropped and your tools still run.
Output Format
Providers report web search differently, so the response includes a normalized field that reports it the same way everywhere.
providerToolActivity- The normalized, provider-agnostic signal. An array of provider-executed tool activity, discriminated bytool. When a web search ran it holds awebSearchentry whosedatacarries the searchqueries(when the provider exposes them) andsources. It is[]when no provider tool ran. Read this to confirm a search happened without branching on provider.sources- The response-level aggregate of the sources used to ground the answer. Each entry hassourceType,id,url, andtitle, plus aproviderMetadataobject on providers that attach one (e.g. Anthropic).text- The grounded answer, often with inline citations.steps- Raw per-step detail. For OpenAI, Azure OpenAI, and Anthropic the search appears here as provider-executed tool calls. For Google and Vertex AI, the gateway normalizes Gemini's search into grounding metadata underproviderMetadatarather than a tool call, so no tool-call step appears.
Gemini grounds without a tool call, so providerToolActivity (which folds in the grounding case) is the field to check rather than scanning steps for a tool call.
Example output
See AI Generate for the full output shape and metadata fields.
Last updated
Was this helpful?