Skip to main content

Overview

Avante.nvim includes web search tools that allow AI agents to search the internet for up-to-date information, documentation, and solutions. This is particularly useful when dealing with:
  • Latest framework updates and best practices
  • Recently discovered bugs and solutions
  • API documentation and examples
  • Current technology trends and recommendations
Web search is available as a tool that the AI can use in agentic mode. You must enable a web search provider and configure the appropriate API keys.

Supported Providers

Avante supports multiple web search providers:
  • Tavily (default) - AI-optimized search API
  • SerpAPI - Google Search API wrapper
  • Google - Programmable Search Engine
  • Kagi - Privacy-focused search
  • Brave Search - Privacy-focused search from Brave
  • SearXNG - Self-hosted metasearch engine

Configuration

Basic Setup

Configure the web search provider in your Avante setup:
require('avante').setup({
  web_search_engine = {
    provider = "tavily", -- tavily, serpapi, google, kagi, brave, or searxng
    proxy = nil, -- Optional proxy: "http://127.0.0.1:7890"
  },
})
provider
string
default:"tavily"
The web search provider to use. Options: tavily, serpapi, google, kagi, brave, searxng
proxy
string
Optional HTTP proxy URL for search requests. Useful in restricted networks.Example: "http://127.0.0.1:7890"

Provider Setup

Tavily (Default)

Tavily provides AI-optimized search results.
1

Get API Key

Sign up at tavily.com and get your API key.
2

Set Environment Variable

export TAVILY_API_KEY=your-tavily-api-key
3

Configure Avante

web_search_engine = {
  provider = "tavily",
}
Pros:
  • Optimized for AI applications
  • Returns clean, structured results
  • Fast response times

SerpAPI

SerpAPI provides Google Search results through their API.
1

Get API Key

Sign up at serpapi.com and get your API key.
2

Set Environment Variable

export SERPAPI_API_KEY=your-serpapi-api-key
3

Configure Avante

web_search_engine = {
  provider = "serpapi",
}
Pros:
  • Reliable Google Search results
  • Rich metadata and structured data
  • Supports many search engines

Google Programmable Search Engine

Use Google’s Programmable Search Engine for custom search.
1

Create Search Engine

  1. Go to Google Programmable Search Engine
  2. Create a new search engine
  3. Configure search scope (entire web or specific sites)
  4. Get your Search Engine ID
2

Get API Key

Get an API key from Google Cloud Console
3

Set Environment Variables

export GOOGLE_SEARCH_API_KEY=your-google-api-key
export GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id
4

Configure Avante

web_search_engine = {
  provider = "google",
}
Pros:
  • Direct Google Search integration
  • Customizable search scope
  • Free tier available

Kagi

Kagi is a privacy-focused search engine with an API.
1

Get API Token

  1. Subscribe to Kagi (requires paid plan)
  2. Go to Settings → API
  3. Generate an API token
2

Set Environment Variable

export KAGI_API_KEY=your-kagi-api-token
3

Configure Avante

web_search_engine = {
  provider = "kagi",
}
Pros:
  • Privacy-focused (no tracking)
  • High-quality results
  • Fast and ad-free
Cons:
  • Requires paid Kagi subscription

Brave Search offers a privacy-respecting search API.
1

Get API Key

  1. Go to Brave Search API Dashboard
  2. Sign up and create an API key
2

Set Environment Variable

export BRAVE_API_KEY=your-brave-api-key
3

Configure Avante

web_search_engine = {
  provider = "brave",
}
Pros:
  • Privacy-focused
  • Independent index (not Google)
  • Free tier available

SearXNG

SearXNG is a self-hosted metasearch engine.
1

Deploy SearXNG

Set up your own SearXNG instance or use a public one. See SearXNG docs for deployment.
2

Set Environment Variable

export SEARXNG_API_URL=https://your-searxng-instance.com
3

Configure Avante

web_search_engine = {
  provider = "searxng",
}
Pros:
  • Self-hosted (full control)
  • No API costs
  • Privacy-focused
  • Aggregates multiple search engines
Cons:
  • Requires hosting infrastructure
  • More complex setup
Once configured, the AI can automatically use web search in agentic mode:

Automatic Usage

What are the new features in React 19?
The AI will:
  1. Recognize it needs current information
  2. Use the web_search tool automatically
  3. Search for “React 19 new features”
  4. Incorporate findings into the response

Manual Tool Control

You can control tool usage through permissions:
require('avante').setup({
  behaviour = {
    auto_approve_tool_permissions = { "web_search" }, -- Auto-approve web search
    -- OR
    auto_approve_tool_permissions = false, -- Prompt for all tools
  },
})

Proxy Configuration

If you’re behind a corporate proxy or firewall:
require('avante').setup({
  web_search_engine = {
    provider = "tavily",
    proxy = "http://proxy.company.com:8080",
  },
})
Supported proxy formats:
  • HTTP: http://proxy:port
  • HTTPS: https://proxy:port
  • With auth: http://user:pass@proxy:port
To disable the web search tool:
require('avante').setup({
  disabled_tools = { "web_search" },
})
See LLM Tools for more on tool management.

Response Formatting

Web search results are automatically formatted and integrated into the AI’s response. The AI will:
  1. Parse search results
  2. Extract relevant information
  3. Cite sources when applicable
  4. Synthesize findings into a coherent answer
The AI typically provides source URLs in its response, allowing you to verify information.

Best Practices

Choose the Right Provider

Use Tavily for AI tasks, SerpAPI for Google results, or Kagi for privacy.

Monitor API Usage

Web search can be expensive. Monitor your API usage and costs.

Verify Results

Always verify critical information from web searches, especially for security-sensitive code.

Use for Documentation

Web search is excellent for finding official docs and recent API changes.

Troubleshooting

  1. Verify environment variable is set: echo $TAVILY_API_KEY
  2. Check provider is configured correctly
  3. Ensure you have internet connectivity
  4. Verify API key is valid (not expired)
  5. Check API quota hasn’t been exceeded
  1. Verify proxy URL format is correct
  2. Test proxy with curl: curl -x http://proxy:port https://google.com
  3. Check if proxy requires authentication
  4. Ensure proxy allows HTTPS connections
  1. Check your API plan limits
  2. Reduce search frequency
  3. Consider upgrading your plan
  4. Use caching if possible
  1. Try a different provider
  2. Rephrase your question to be more specific
  3. For Google CSE, adjust your search engine settings

Example Use Cases

Prompt: “How do I use the new async/await syntax in Python 3.12?”The AI will search for Python 3.12 documentation and provide current information.

LLM Tools

Learn about all available AI tools

Tool Permissions

Configure tool approval settings

Build docs developers (and LLMs) love