Skip to content

feat: add Gemini as web search backend (google_search grounding)#13268

Open
SpectreMercury wants to merge 1 commit into
NousResearch:mainfrom
SpectreMercury:feat/gemini-web-search-backend
Open

feat: add Gemini as web search backend (google_search grounding)#13268
SpectreMercury wants to merge 1 commit into
NousResearch:mainfrom
SpectreMercury:feat/gemini-web-search-backend

Conversation

@SpectreMercury

@SpectreMercury SpectreMercury commented Apr 21, 2026

Copy link
Copy Markdown

Summary

Adds "gemini" as a new web search backend that uses Gemini API's native google_search grounding tool. This provides web search without requiring any third-party API key — it reuses the existing GOOGLE_API_KEY or GEMINI_API_KEY already configured for the LLM provider.

Motivation

Currently, web_search requires a third-party search API key (Firecrawl, Tavily, Exa, or Parallel). Users who choose Gemini as their LLM provider already have a Google API key, but can't use it for web search. Gemini's native Google Search grounding provides high-quality web search results at no additional cost.

How it works

  • Calls Gemini native API with tools: [{"google_search": {}}]
  • Gemini automatically generates search queries, searches Google, and returns grounded responses with source URLs
  • Uses gemini-2.5-flash for search (fast and cost-effective)
  • Returns results in the same normalized format as other backends

Changes

  • tools/web_tools.py: Add _gemini_search() function, register "gemini" backend in _get_backend() and _is_backend_available()
  • hermes_cli/tools_config.py: Add "Google Gemini" as a search provider option in hermes tools setup wizard

Configuration

# config.yaml
web:
  backend: "gemini"
# .env — same key used for the LLM provider
GOOGLE_API_KEY=your_key_here

When web.backend is unset, Gemini is auto-selected if GOOGLE_API_KEY is present (highest priority in the fallback chain since it doesn't need an additional API key).

Test plan

  • hermes tools → select "Google Gemini" as web backend
  • hermes chat -q "What happened in tech news today?" → should return grounded results
  • hermes doctor → web check passes with only GOOGLE_API_KEY set
  • Existing backends (Firecrawl, Tavily, etc.) unaffected

Adds "gemini" as a new web search backend that uses Gemini API's
native google_search grounding tool. This provides web search
capability without requiring any third-party API key — it uses the
existing GOOGLE_API_KEY or GEMINI_API_KEY already configured for the
LLM provider.

How it works:
- Calls Gemini native API with `tools: [{"google_search": {}}]`
- Gemini automatically generates search queries, searches Google,
  and returns grounded responses with source URLs
- Uses gemini-2.5-flash for search (fast and cost-effective)
- Returns results in the same normalized format as other backends

Changes:
- web_tools.py: Add _gemini_search() function, register "gemini"
  backend in _get_backend() and _is_backend_available()
- tools_config.py: Add "Google Gemini" as a search provider option
  in `hermes tools` setup wizard

Configuration:
  # config.yaml
  web:
    backend: "gemini"

  # .env (same key used for the LLM provider)
  GOOGLE_API_KEY=your_key_here

When web.backend is "auto" or unset, Gemini is auto-selected if
GOOGLE_API_KEY is present (highest priority since it's free and
doesn't need an additional API key).
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets tool/web Web search and extraction provider/gemini Google Gemini (AI Studio, Cloud Code) labels Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have provider/gemini Google Gemini (AI Studio, Cloud Code) tool/web Web search and extraction type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants