Overview
Web Search allows AI agents to search the internet, retrieve current information, and cite sources in their responses. This capability is essential for tasks requiring real-time data, news, research, or fact-checking.
How It Works
The web search system uses three components:
Search Provider : Queries search engines (Serper, SearXNG)
Content Scraper : Extracts clean content from web pages (Firecrawl)
Reranker : Improves result relevance (Jina, Cohere)
Configuration
Choose Search Provider
Configure one of the supported search providers: Serper (Recommended)
SearXNG (Self-Hosted)
Get an API key from serper.dev : # .env
SERPER_API_KEY = your-serper-key
# librechat.yaml
webSearch :
serperApiKey : '${SERPER_API_KEY}'
Use your own SearXNG instance: # .env
SEARXNG_INSTANCE_URL = https://your-searxng.com
SEARXNG_API_KEY = optional-api-key
# librechat.yaml
webSearch :
searxngInstanceUrl : '${SEARXNG_INSTANCE_URL}'
searxngApiKey : '${SEARXNG_API_KEY}'
Configure Content Scraper
Set up Firecrawl for extracting web content: # .env
FIRECRAWL_API_KEY = your-firecrawl-key
FIRECRAWL_API_URL = https://api.firecrawl.dev # Optional
# librechat.yaml
webSearch :
firecrawlApiKey : '${FIRECRAWL_API_KEY}'
firecrawlApiUrl : '${FIRECRAWL_API_URL}' # Optional
Configure Reranker (Required)
Choose a reranking service to improve result quality: # .env
JINA_API_KEY = your-jina-key
# librechat.yaml
webSearch :
jinaApiKey : '${JINA_API_KEY}'
# jinaApiUrl: 'https://api.jina.ai/v1/rerank' # Optional
# .env
COHERE_API_KEY = your-cohere-key
# librechat.yaml
webSearch :
cohereApiKey : '${COHERE_API_KEY}'
Enable in Agent Configuration
Ensure web search is available for agents: # librechat.yaml
endpoints :
agents :
capabilities :
- web_search
Using Web Search
Enable for an Agent
Open Agent Builder
Create a new agent or edit an existing one.
Enable Web Search
Toggle Web Search in the capabilities section.
Configure API Keys (if user-provided)
If using user-provided authentication:
Click the key icon next to Web Search
Enter required API keys:
Search provider (Serper or SearXNG)
Content scraper (Firecrawl)
Reranker (Jina or Cohere)
Example Queries
Current Events
Research
Fact-Checking
Product Research
What are the latest developments in AI regulation?
Find recent studies on the health effects of intermittent fasting.
Include peer-reviewed sources from the last 2 years.
Is it true that [claim]? Find reliable sources to verify.
Compare the top 3 project management tools for remote teams.
Include pricing, features, and user reviews.
Authentication Types
System-Provided
User-Provided
Mixed
Admin configures shared API keys: # .env
SERPER_API_KEY = system-key
FIRECRAWL_API_KEY = system-key
JINA_API_KEY = system-key
All users can use web search without individual keys. Users supply their own API keys:
Click the key icon in the agent builder
Enter API keys for each service
Keys are encrypted and stored securely
User-provided keys allow users to use their own API quotas and subscriptions.
Combine system and user-provided keys:
System provides some keys (e.g., search provider)
Users provide others (e.g., premium Firecrawl account)
Search Flow
Citations
Web search results include automatic citations:
According to recent research [1], intermittent fasting has shown...
Sources:
[1] "Health Effects of Intermittent Fasting" - Nature.com (2024)
Citations appear as numbered references inline and a source list at the end of the response.
Advanced Configuration
Custom Firecrawl URL
Use a self-hosted or custom Firecrawl instance:
# librechat.yaml
webSearch :
firecrawlApiUrl : 'https://your-firecrawl.com'
Custom Jina Endpoint
# librechat.yaml
webSearch :
jinaApiUrl : 'https://custom-jina.com/v1/rerank'
Troubleshooting
No search results returned
Verify all required API keys are configured
Check API key validity and quotas
Ensure network connectivity to search services
Review logs for specific error messages
Ensure reranker (Jina/Cohere) is configured
Try alternative search queries
Check if search provider has region restrictions
Content scraping can be slow for large pages
Firecrawl performance depends on target websites
Consider upgrading to premium API tiers
Monitor API usage in provider dashboards
Upgrade API plans if needed
Enable user-provided keys for distributed costs
Security Considerations
Search results come from external sources - treat as untrusted input
Content scrapers may access sensitive URLs if not properly configured
User-provided API keys are encrypted but should follow security best practices
Cost Optimization
Caching : Search results can be cached to reduce API calls
User-provided keys : Distribute API costs across users
Rate limiting : Configure limits in librechat.yaml
SearXNG : Self-host for unlimited free searches
Best Practices
Specific queries : Help the AI search more effectively with clear questions
Source verification : Ask the AI to cite specific sources
Recency : Specify time ranges when currency matters
Multiple sources : Request information from multiple sources for verification