-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Summary
Add web search support to the Copilot SDK, enabling copilot agents to fetch real-time information from the internet. The SDK should support two approaches: leveraging built-in web search capabilities offered by LLM providers (OpenAI, xAI/Grok, Google Gemini, Anthropic Claude) as well as custom search API integrations (Google Custom Search, Bing, Brave Search, SearXNG) for providers that don't offer native search.
Problem / Use Case
LLM-powered copilots are limited to their training data and any context provided at runtime. This creates issues when users ask about:
- Current events and news: Users expect timely, accurate answers about recent happenings.
- Live data lookups: Pricing, stock info, weather, sports scores, and other frequently changing data.
- Up-to-date documentation: Software libraries, APIs, and frameworks evolve rapidly; outdated answers can lead to bugs.
- Fact verification: The copilot cannot verify or cross-check claims without access to the web.
Without web search, the copilot either hallucinates outdated information or has to tell the user it doesn't know — both degrade the user experience.
Additionally, several major LLM providers now offer built-in web search as a native feature (e.g., OpenAI's web search tool, xAI/Grok's live search, Google Gemini's grounding with Google Search, Anthropic's tool use with web search). The SDK should be able to take advantage of these native capabilities when available, while also providing a fallback to custom search APIs for other providers or for more control over search behavior.
Proposed Solution
Introduce a unified web search interface that supports two modes:
1. Provider Built-in Search (Native)
When the LLM provider offers built-in web search, the SDK should pass through the appropriate configuration to enable it natively. This is often more accurate and tightly integrated with the model's reasoning.
2. Custom Search API (External)
For providers without native search, or when users want more control over the search behavior, the SDK should support plugging in an external search API.
Key Features
- Unified interface — A single
webSearchconfig that works across both modes - Auto-detection — Optionally detect if the current LLM provider supports native search and prefer it automatically
3.Fallback support — Use native search when available, fall back to custom search API otherwise - Search behavior options — Number of results, safe search, region, language filters
Alternatives Considered
- Only supporting custom search APIs: Would miss out on the tighter integration and better accuracy that native provider search offers.
- Only supporting native provider search: Would exclude local/self-hosted models (e.g., Ollama) and providers without built-in search.
- Manual RAG pipelines: Users can build their own retrieval pipeline, but this adds significant complexity for a common use case.
- Browser automation / scraping: Heavier, slower, and more fragile than using search APIs directly.
Additional Context
Many major LLM providers now include web search as a first-class capability:
- OpenAI — Web search tool in Responses API
- xAI (Grok) — Live web search integration
- Google Gemini — Grounding with Google Search
- Anthropic Claude — Web search via tool use
Supporting both native and custom search would make the Copilot SDK flexible enough to work with any provider while taking full advantage of each provider's strengths. Popular AI frameworks like LangChain and LlamaIndex are also moving toward supporting both approaches.