Use case Answer-engine research

How to capture Google AI Mode
grounding queries

When Google AI Mode decides a question needs the live web, it writes its own Google searches, runs them, and cites a handful of domains. Not every prompt triggers a search. When one does, the searches tell you which queries your pages need to show up for. Here is how to see them, with code and with Moose.

Watch Moose do it Show me the code
Chat Workflows
Hi, Moosehttps://himoose.com
New chat
Home Inbox Context Visibility Workflows Audio Chats Artifact Library Connections
Recents
Sam SamPremium
Capture AI Mode grounding … New chat Share
Capture AI Mode grounding queries
What prompt do you want Google AI Mode grounding queries for?
best payroll software for a 20 person company
Checking Gemini grounding queries…
Google AI Mode grounding queries

Gemini used 6 Google grounding queries while grounding this prompt.

Prompt

best payroll software for a 20 person company

Grounding queries
  • best payroll software for small business 2026
  • payroll software pricing 20 employees per month
  • top rated payroll providers small business reviews
  • payroll software with benefits administration small business
  • best payroll software for startups official pricing
  • small business payroll software comparison features
Cited sources
  • forbes.com
  • nerdwallet.com
  • g2.com
  • capterra.com
  • businessnewsdaily.com
  • pcmag.com
  • techrepublic.com
  • usnews.com
  • softwareadvice.com
Grounded response
Enter the prompt you want to inspect with Google AI Mode grounding queries…
Quick start Google AI Mode g… GPT-5.6 Luna Send
Hi, Moose 0.3.281 Beta Need help?
A recreation of a real run. One prompt in, the query set and the cited domains out.
The definition

What is a grounding query?

A grounding query is a Google search the model writes for itself before it answers you. It reads your prompt, judges whether searching would make the answer better, and if it would, writes one or more searches of its own and runs them. It never looks up the sentence you typed.

When it does search, two things come back and both are recoverable: the queries it wrote, and the domains it cited. One tells you what was searched, the other who was cited. When it does not search, that is worth knowing too: the model answered from what it already knew.

What the user typed
best payroll software for a 20 person company
1 prompt
What Google searched for
best payroll software for small business 2026
payroll software pricing 20 employees per month
top rated payroll providers small business reviews
payroll software with benefits administration small business
best payroll software for startups official pricing
small business payroll software comparison features
6 grounding queries
Who got cited
forbes.com nerdwallet.com g2.com capterra.com businessnewsdaily.com pcmag.com techrepublic.com usnews.com softwareadvice.com
9 domains
Without Moose

How to capture grounding queries with code

This one is not a scraping problem. A grounded response comes back as a list of steps, and one of them, google_search_call, holds the exact queries the model ran. About thirty lines gets you one capture. The work is in running it for many prompts over time.

gemini api
# grounding.py · the queries Google wrote for itself

import os, json
from google import genai

PROMPT = "best payroll software for a 20 person company"

client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])

interaction = client.interactions.create(
    model="gemini-3.6-flash",
    input=PROMPT,
    # search is opt-in here. the model still decides
    # on its own whether this prompt needs it.
    tools=[{"type": "google_search"}],
)

queries, sources = [], []
for step in interaction.steps:
    if step.type == "google_search_call":
        queries += step.arguments["queries"]
    if step.type == "model_output":
        for block in step.content:
            # citations hang off spans of the answer text
            for a in (block.annotations or []):
                if a.type == "url_citation":
                    sources.append(a.title)

print(json.dumps({
    "prompt":  PROMPT,
    "queries": queries,      # empty means it never searched
    "sources": sorted(set(sources)),
}, indent=2))
// grounding.mjs · same call, node

import { GoogleGenAI } from '@google/genai';

const PROMPT = 'best payroll software for a 20 person company';

const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const interaction = await client.interactions.create({
  model: 'gemini-3.6-flash',
  input: PROMPT,
  // search is opt-in here. the model still decides
  // on its own whether this prompt needs it.
  tools: [{ type: 'google_search' }],
});

const queries = [];
const sources = [];

for (const step of interaction.steps) {
  if (step.type === 'google_search_call')
    queries.push(...step.arguments.queries);
  if (step.type === 'model_output')
    for (const block of step.content)
      // citations hang off spans of the answer text
      for (const a of block.annotations ?? [])
        if (a.type === 'url_citation') sources.push(a.title);
}

console.log(JSON.stringify({
  prompt: PROMPT,
  queries,                        // empty means it never searched
  sources: [...new Set(sources)].sort(),
}, null, 2));
What you build after that
Many prompts, on a schedule

A capture is one prompt at one moment. The useful version is fifty prompts on a schedule, deduplicated and compared with last month.

Search does not always fire

The model decides whether the prompt needs the web. When it decides no, there is no search step at all and nothing tells you why. You have to detect the empty case and decide whether it is a retry or a real finding.

Citations are not a list

Sources arrive as annotations pinned to character ranges in the answer rather than as a list. Getting to the nine domains means walking every annotation and deduplicating.

You pay per query, not per prompt

On Gemini 3 models each search the model runs is billed separately, so a prompt that grounds six times costs six searches.

You need to keep the history

Queries only mean something next to the last capture, so you end up maintaining a database as well as a script.

With Moose

With Moose, you ask in chat

Same call, same field, without the plumbing. Moose keeps every run, so you can see what changed since last month.

01
Open a chat and ask

Type "capture AI Mode grounding queries", or use the quick start chip in the composer. No key to paste.

02
Give it the prompt

A question your buyer would type. Moose runs it grounded and pulls the queries and the cited domains out of the response.

03
Keep the run

Queries and sources land in your library, exportable, and diffable against every earlier capture of the same prompt.

Grounding capture is on the managed plan only

Same as fan-out capture. The run has to go straight to Google with search grounding enabled, and routed access through OpenRouter strips the grounding metadata before it reaches you. On BYOK plans, everything else in Moose still works, including the instant visibility check across five AI search engines. This one feature does not.

What to do with them

What to do with the queries

The real query set
Six searches behind one question

Those searches decide which pages get retrieved and read, so they matter more than the exact phrasing your buyer typed.

The qualifiers
The qualifiers that made it in

Company size, price, integration, industry: whichever qualifier appears in the grounding queries is the one Google thinks the answer depends on. Build the page around those.

The citations
Who is being cited

Same prompt, same nine sites, week after week. If you are not one of them, that is the gap. If you are, keep that page current.

The trend
Track it over time

Queries change as the index and the model change. A query that appears several weeks running is a topic worth a page.

Fan-out and grounding, side by side

Both engines decompose your question before searching. What they expose, how many searches they run, and how you get at them are all different.

ChatGPT fan-out
How you get itDrive a logged-in browser and read the search tool calls out of a private stream
Typical countTen to fifteen searches on a comparison prompt
What they look likesite: queries naming brands the model already trusts
StabilityUndocumented payload that has changed before
Read the fan-out page
Google AI Mode grounding
How you get itA documented step on a grounded API response, if the model chose to search
Typical countTwo to eight, depending on how contested the answer is
What they look likePlain keyword searches, plus citations pinned to the answer text
StabilityDocumented, though the response shape has changed with the API before
You are on this page

Questions people ask

Are these literally the queries AI Mode runs?

The queries come from Gemini's grounding metadata, which is the same search-grounding machinery AI Mode is built on, run through the public API. In practice the query sets look like what AI Mode produces, but it is not a recording of google.com/aimode itself, so treat it as a close proxy.

Why did I only get two queries back?

Because the model decided two were enough. Narrow, local or well-worn questions ground with one or two searches. Broad comparison questions often pull six or more. A prompt that grounds heavily is one where the answer is still contested.

Do the queries change if I run the same prompt again?

Yes, at the edges. The core searches are stable, the long tail moves, and the cited domains move faster than the queries. Run the same prompt on a schedule and watch what enters and leaves.

Why is there no clean list of cited sources?

Because Google does not return one. Citations come back attached to spans of the answer text, each with a URL and a title that is usually just the domain. Moose walks every annotation, deduplicates, and shows you the domains.

Should I write a page per grounding query?

Usually not. Six queries around one buying question are better served by one strong page that covers all six. The query set tells you what has to be on the page: pricing, the size qualifier, the comparison, the independent review angle.

More things to ask Moose

All use cases
Managed plan feature

See the searches behind
the answer.

Download Hi, Moose, open a chat, and ask. Grounding capture needs the managed plan. The app is free to install and the visibility checks are free to run.