The web_search tool empowers agents to retrieve, analyze, and synthesize information from the live web. It goes beyond simple keyword matching by employing a multi-stage process: searching, scraping full content, semantically re-ranking results, and finally generating a sourced answer.
Use web_search when you need to:
- Access Real-Time Data: Find information about events, prices, or releases that occurred recently.
- Verify Facts: Cross-reference internal knowledge with external sources.
- Broaden Research: Explore topics outside of your internal knowledge base.
- Find Documentation: Look up the latest API references or technical guides that might not be in your training data.
Reranking & QualityThis tool doesn’t just return a list of links. It fetches the actual content of the top results and uses a specialized “reranker” model to score them based on how well they answer the specific user query. This ensures high-quality, relevant answers even if the initial search keywords were imperfect.
The tool accepts the following parameters:
| Parameter | Type | Required | Description |
|---|
query | string | Yes | The search query to send to the web browser. Be specific for best results. |
time_range | string | No | Filter results by time. Options: day, month, year, none (default). Only use this if the user explicitly requests a timeframe. |
Output Structure
The tool returns a JSON object containing the synthesized response and the sources used.
{
"query": "latest advancements in solid state batteries 2024",
"response": "The user is asking about recent advancements in solid-state batteries. I need to find information from 2024 specifically. Looking at the search results, I see several relevant articles...\n\nRecent advancements in solid-state batteries in 2024 have focused on improving energy density and charging speeds. Toyota has announced a breakthrough claiming a range of 745 miles and a 10-minute charge time <web_citation url=\"https://example.com/toyota-news\" title=\"Toyota News\">[1]</web_citation>. Meanwhile, QuantumScape has begun shipping prototypes to automotive partners <web_citation url=\"https://example.com/quantumscape-update\" title=\"QuantumScape Update\">[2]</web_citation>.",
"sources": [
{
"rank": 1,
"title": "Toyota's Solid State Battery Roadmap",
"url": "https://example.com/toyota-news",
"snippet": "Toyota aims to commercialize the technology by 2027...",
"rerank_score": 0.92,
"used_in_response": true
},
// ... other sources
],
"sources_used": [1, 2],
"model": "claude-3-7-sonnet-20250219-thinking",
"reranker": "llm_multimodal_tool_calling_binary_reranker::gpt-4o-mini",
"total_results": 15,
"reranked_results": 5,
"execution_id": "call_zIsjIkJwvPrJTz2GbIRGg8DE"
}
Response Fields
| Field | Description |
|---|
response | The natural language answer generated by the model, including inline citations and potentially a “Reflection” block where the model plans its answer. |
sources | A list of the web pages that were analyzed. Includes the url, title, snippet, and a rerank_score indicating relevance. |
sources_used | An array of integers corresponding to the rank of the sources that were explicitly cited in the response. |
model | The LLM used to generate the response. |
reranker | The model used to re-order search results by relevance. |
execution_id | The unique identifier for this tool execution. |
Example Usage
Basic Search
Input:
{
"query": "current price of bitcoin"
}
Result:
The agent will return the current price sourced from a financial news site or exchange data found on the web.
Time-Filtered Search
Input:
{
"query": "earthquake in japan",
"time_range": "day"
}
Result:
The agent restricts results to the past 24 hours, ensuring the information is about recent events rather than historical ones.
How It Works
- Search: The tool queries a search engine to get a broad set of initial results.
- Scrape: It visits the top URLs to extract the full text content, not just the search snippet.
- Rerank: A specialized “reranker” model compares the user’s query against the full text of each page to determine which ones are truly relevant.
- Generate: The most relevant chunks of text are passed to an LLM, which synthesizes the final answer and adds citations.
ConfigurationJust like the RAG tool, the models used for generation and reranking in Web Search respect the settings configured in your User Preferences under the RAG section.