LLM Agent for Google Search with Assist in Home Assistant

Since Google Generative AI now supports live web search, I created a second conversation agent in Home Assistant — I call it google_search — dedicated only to online queries.

Meanwhile, my main agent handles home automation commands.



How it works

  1. I created an intent_script called search_on_google
  2. When I say “Search with Google [query]”, Assist:
  • routes the query to the google_search agent via conversation.process
  • extracts the LLM response from response.speech.plain.speech
  • reads it aloud as speech

intent script

search_on_google:
  description: >
    # This is your search tool for the Google Search System.
    # Returns:
    #   speech: 'Textual answer generated by the Google Search assistant'
    # Voice Assistant Tips:
    #   Use this intent to ask the assistant anything via Google.
    #   Just provide a clear query.
    #   Say: "search on google [your query]"
    #   Example: "search on google what's the current value of Bitcoin"
    #   The assistant will search and speak the answer for your human.
    #   You can also trigger it programmatically like:
    #     search_on_google{"query": "what's the current value of Bitcoin"}
    parameters:
      query: # The question or search term for Google
        required: true
    action:
      - action: conversation.process
        metadata: {}
        data:
          text: "{{ query }}"
          agent_id: conversation.google_search
        response_variable: response_text
      - stop: ""
        response_variable: response_text
    speech:
      text: >
        that's what i found for you:
        {{ action_response.response.speech.plain.speech if action_response.response.speech.plain.speech is defined else "sorry, no results." }

and on config/custom_sentences/en/slot_types.yaml

# config/custom_sentences/en/slot_types.yaml
lists:

query:
  wildcard: true

And in the system prompt of Google Generative AI (main assistant):

# Google Search:
- When the user says "search with Google [query]", use:
  intent: search_on_google
- The query must be textual, clear, and complete.
- The assistant should reply with a spoken summary of the search result.
- Valid examples:
  - "Search with Google the meaning of entropy"
  - "Search with Google what's the value of Bitcoin"
- If the query is empty or too generic, ask the user to rephrase it.

Now, when I say “search with Google [anything]”, I get the response generated by the google_search agent.


If a fixed phrase will be used to start the search, you can get by with a single automation.
Here’s my version:

triggers:
  - command:
      - search with google {srch}
    trigger: conversation
conditions: []
actions:
  - action: conversation.process
    metadata: {}
    data:
      agent_id: conversation.google_generative_ai
      text: >-
        Search for {{ trigger.slots.srch }} and provide a concise summary.
    response_variable: goo
  - set_conversation_response: "{{ goo.response.speech.plain.speech }}"
mode: single

I don’t use any additional instructions in the agent’s promt , only the personality description and the style of responses