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
- I created an
intent_script
calledsearch_on_google
- When I say “Search with Google [query]”, Assist:
- routes the query to the
google_search
agent viaconversation.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.