Skip to main content

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:
  1. Search Provider: Queries search engines (Serper, SearXNG)
  2. Content Scraper: Extracts clean content from web pages (Firecrawl)
  3. Reranker: Improves result relevance (Jina, Cohere)

Configuration

1

Choose Search Provider

Configure one of the supported search providers:
2

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
3

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
4

Enable in Agent Configuration

Ensure web search is available for agents:
# librechat.yaml
endpoints:
  agents:
    capabilities:
      - web_search

Enable for an Agent

1

Open Agent Builder

Create a new agent or edit an existing one.
2

Enable Web Search

Toggle Web Search in the capabilities section.
3

Configure API Keys (if user-provided)

If using user-provided authentication:
  1. Click the key icon next to Web Search
  2. Enter required API keys:
    • Search provider (Serper or SearXNG)
    • Content scraper (Firecrawl)
    • Reranker (Jina or Cohere)

Example Queries

What are the latest developments in AI regulation?

Authentication Types

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.

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

  • 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

Build docs developers (and LLMs) love