Gemini CLI
Google’s Gemini CLI gets to the web through two tools, and the surprising part is that by default both run in Google’s cloud, not on the developer’s machine. google_web_search asks a Gemini model with Google Search grounding, so it reads Google’s index and never contacts your site, while web_fetch hands URLs to Gemini’s urlContext tool, which fetches them from Google infrastructure verified in code. In our Dec 2026 lab run, Gemini CLI 0.46.0 read a brand-new page through two requests from Google IPs (74.125.208.77 and 74.125.211.1) within 21 seconds, both with the User-Agent GoogleAgent-URLContext and Accept: */* measured in our lab. There’s also a local fallback fetch with its own Google-Gemini-CLI/1.0 User-Agent, but it only runs when the Google-side call errors or returns nothing at all.
At a glance
Section titled “At a glance”| Gemini CLI 0.46.0 | |
|---|---|
| Fetch tool | web_fetch, takes one prompt containing up to 20 URLs verified in code |
| Search tool | google_web_search, Gemini Flash with Google Search grounding verified in code |
| Who issues the request | Google’s servers (urlContext); the developer’s machine only on fallback |
| User-Agent | GoogleAgent-URLContext from Google IPs measured in our lab. Fallback: Mozilla/5.0 (compatible; Google-Gemini-CLI/1.0; +https://github.com/google-gemini/gemini-cli) verified in code |
| Accept header | */* on the primary path measured in our lab; none on fallback; text/markdown first in opt-in direct mode verified in code |
| JS rendering | None on the local paths; unknown for Google’s fetcher |
| Content conversion | Google-side for urlContext; html-to-text with links and images stripped on fallback verified in code |
| Size and truncation | 34 MB per URL on urlContext documented; 10 MB body and 250,000 chars on fallback verified in code |
| Caching | urlContext reads Google’s internal index cache first, then fetches live documented |
| robots.txt | Vertex docs say urlContext honours it; the Gemini API docs are silent; the fallback never checks it verified in code |
| Permission model | web_fetch asks for confirmation by policy; google_web_search is allowed as read-only; private and local hosts blocked |
How fetching works
Section titled “How fetching works”web_fetch takes a single prompt parameter and extracts URLs from it by splitting on whitespace and keeping tokens that contain :// and parse as http: or https: (tools/web-fetch.ts) verified in code. From there, the CLI de-duplicates the URLs, drops private and local hosts with a [Blocked Host] note, and applies a rate limit of 10 requests per hostname per 60 seconds. It then builds a wrapper prompt with <user_instructions> and <authorized_urls> sections and calls generateContent on the web-fetch model alias, which resolves to gemini-3-flash-preview with tools:[{urlContext:{}}].
Gemini CLI: web_fetch in our lab
- Gemini CLI
parse URLs, block private hosts - Gemini CLI→Gemini API
generateContent + urlContext - Gemini API
index cache miss (new page) - Gemini API→Your site
GET urlUA: GoogleAgent-URLContext, 74.125.208.77
- Gemini API→Your site
GET url again74.125.211.1, within 21 s
- Your site→Gemini API
200 text/html - Gemini API→Gemini CLI
answer + groundingMetadata - Gemini CLI
insert [n] markers, Sources list
Google’s URL context docs describe two-stage retrieval: the tool tries an internal index cache first and fetches live only when the URL is not indexed documented. Our lab page was new, so it took the live path. A page Google has already indexed may produce no request at all when a Gemini CLI user fetches it, and that’s a big difference from agents that always fetch from the developer’s machine inferred. For reference, the documented limits are 34 MB per URL and 20 URLs per request, with support for HTML, JSON, text, CSV, RTF, common image formats and PDF; paywalled content, YouTube, Google Workspace files and localhost are unsupported.
The GoogleAgent-URLContext string was previously reported only by a third-party directory based on robots.txt scans. As far as I know, our lab is the first log evidence tying it to Gemini CLI’s web_fetch, and Netlify classified the request with netlify-agent-category: other instead of as an AI agent measured in our lab. Google’s user-triggered fetchers page documents a Google-Agent fetcher but doesn’t name urlContext.
The CLI falls back to a local fetch in exactly two cases: the generateContent call throws, or the response has empty text and empty groundingChunks verified in code. Here’s the catch: the CLI never reads urlContextMetadata or urlRetrievalStatus, so if Google’s fetcher is blocked by a WAF but the model writes “I could not access the page”, the CLI treats that as success and the local fetch never runs. That means blocking Google’s cloud ranges can turn into a polite non-answer instead of a local retry inferred.
The fallback path sends a single header, User-Agent: Mozilla/5.0 (compatible; Google-Gemini-CLI/1.0; +https://github.com/google-gemini/gemini-cli), with the version hard-coded as 1.0 verified in code. It uses a 10-second timeout, follows redirects, caps the body at 10 MB, and converts HTML with html-to-text using selectors that ignore link targets and skip images. The result is truncated to 250,000 characters (shared across URLs) and summarised by a web-fetch-fallback model call, with no robots.txt check and no JavaScript execution along the way.
One detail from the source deserves a live check, because the description and the code disagree. The Gemini 3 tool description says GitHub blob URLs “are automatically converted to raw versions”, but convertGithubUrlToRaw is called only on the fallback, in the confirmation dialog and in experimental mode, never on the primary urlContext path verified in code. So the user may see a raw URL in the confirmation dialog while Google goes off and fetches the original blob page.
An opt-in experimental.directWebFetch setting (default false) replaces all of this with a local fetch of one {url} that sends Accept: text/markdown, text/plain;q=0.9, application/json;q=0.9, text/html;q=0.8, application/pdf;q=0.7, video/*;q=0.7, */*;q=0.5, returns markdown and text bodies verbatim, and keeps links when converting HTML verified in code. If Google makes this the default, markdown content negotiation starts to matter for Gemini CLI, but today it doesn’t.
- Gemini CLI → Gemini Flash
query - Gemini Flash → Google Search
search - Gemini CLI → urlContext
URLs - urlContext → docs.example.com
GET from Google IP - Gemini CLI → Local fallback
if call fails - Local fallback → docs.example.com
GET from dev IP
How searching works
Section titled “How searching works”google_web_search sends one generateContent call with the model alias web-search, which resolves to gemini-3-flash-preview plus tools:[{googleSearch:{}}], and the user message is nothing but the query string the agent wrote (tools/web-search.ts) verified in code. The CLI itself doesn’t rewrite the query, but Google’s grounding docs say the model “automatically generates one or multiple search queries”, so the query that hits Google’s index is the Flash model’s rewrite of the agent’s query documented.
The CLI reads groundingChunks (title and URI) and groundingSupports from the response, inserts [n] markers at each support’s byte offset, and appends a Sources: list verified in code. It ignores webSearchQueries, so the user never sees the exact queries Google ran. The tool description for the Gemini 3 model family is also explicit about chaining search into fetch:
Performs a grounded Google Search to find information across the internet.Returns a synthesized answer with citations (e.g., [1]) and source URIs. Bestfor finding up-to-date documentation, troubleshooting obscure errors, or broadresearch. Use this when you don't have a specific URL. If a search resultrequires deeper analysis, follow up by using 'web_fetch' on the provided URI.That text lives in tools/definitions/model-family-sets/gemini-3.ts. Grounding normally returns source URIs as vertexaisearch.cloud.google.com/grounding-api-redirect/... redirectors with the real domain only in the title, which would make a follow-up web_fetch start with a hop through Google inferred; the repo contains no vertexaisearch string, so I’d want a live check before relying on this.
Other paths to your content
Section titled “Other paths to your content”Shell commands run under the CLI’s optional sandbox (docker, podman, sandbox-exec, runsc or lxc), and macOS Seatbelt profiles include permissive-open by default plus closed and proxied variants verified in code. The sandbox constrains shell tools only; the model API calls and web_fetch run in the host CLI process, so the sandbox’s network policy doesn’t affect them unless the whole CLI re-runs inside a container inferred. Proxy settings from HTTPS_PROXY and related variables, or --proxy, apply to the local fallback but not to Google-side urlContext fetches.
The browser agent has its own allowedDomains setting, defaulting to github.com, *.google.com and localhost, which doesn’t apply to web_fetch verified in code. MCP servers are one more path in; see documentation MCP servers.
What shows up in your logs
Section titled “What shows up in your logs”Full cross-agent strings are on User-Agents and log signatures.
| Gemini CLI path | Signature at your origin | Evidence |
|---|---|---|
google_web_search | Nothing; Google’s index is read | verified in code |
web_fetch, cache hit | Possibly nothing | documented |
web_fetch, cache miss | GoogleAgent-URLContext, Accept: */*, Google IPs such as 74.125.208.77, often two requests seconds apart; Netlify category other | measured in our lab |
web_fetch fallback | Mozilla/5.0 (compatible; Google-Gemini-CLI/1.0; +https://github.com/google-gemini/gemini-cli), no Accept, developer’s IP | verified in code |
directWebFetch (opt-in) | Same UA, Accept: text/markdown, ..., developer’s IP | verified in code |
| robots.txt | No robots.txt request observed in our lab, but our robots.txt was served from CDN and not logged | measured in our lab (limitation) |
What this means for discoverability
Section titled “What this means for discoverability”For Gemini CLI, Google’s index is the main surface you’re optimising for. Search reads only the index, and web_fetch reads the index cache before it fetches live, so standard Google SEO and crawlability decide most of what a Gemini CLI user sees inferred.
That makes bot protection that challenges Google’s cloud IP ranges a direct risk. Our lab saw the live fetch arrive from 74.125.x.x addresses, and the CLI’s fallback does not trigger when Google’s model writes any text at all, so a WAF block can silently become an answer from the model’s priors. I think allowlisting GoogleAgent-URLContext or the relevant Google ranges is worth testing.
You should also expect duplicate requests: the two fetches within 21 seconds in our lab are probably a retry or a redundant fetch on Google’s side, which matters if you count agent visits or rate-limit by IP.
Markdown negotiation, on the other hand, has no effect today, because the primary path sent Accept: */* and the fallback sends no Accept header. Server-rendered HTML with the key facts in the body text is what reaches the model, and on the fallback path links are stripped, so a fact that exists only as an anchor’s href is lost. You can compare this with other agents on the matrix.
Qwen Code: a fork that diverged
Section titled “Qwen Code: a fork that diverged”Qwen Code started life as a fork of Gemini CLI, but at commit a6e65b4f (v0.29.2) its web tools have been rewritten and no longer resemble Google’s verified in code. Its web_search calls Alibaba’s DashScope Responses API with web_search and web_extractor tools against a small auxiliary model (default qwen3.8-flash), so pages are opened by DashScope’s servers, whose User-Agent and IPs are undocumented. The tool is on by default only for Qwen OAuth Plus or Pro and some ModelStudio plans, and off for OpenRouter, DeepSeek, ModelScope and local models, which means most third-party setups have no search at all (docs/developers/tools/web-search.md).
Qwen Code’s web_fetch is entirely local and takes a single url (tools/web-fetch.ts) verified in code. It sends User-Agent: QwenCode/<version> (<platform>; <arch>) and, by default, Accept: text/markdown, text/html;q=0.9, text/plain;q=0.8, */*;q=0.1, so it asks for markdown first. It converts HTML with turndown and keeps links, follows redirects only within the same host (cross-host redirects return a “REDIRECT DETECTED” message), upgrades http to https, caps output at 100,000 characters and caches 32 entries for 15 minutes. It doesn’t check robots.txt, and to be clear, we didn’t run Qwen Code in our lab.
Gemini CLI web_fetch |
Qwen Code web_fetch |
|
|---|---|---|
| Who fetches | Google servers (fallback: dev machine) | Developer machine |
| User-Agent | GoogleAgent-URLContext (fallback Google-Gemini-CLI/1.0) |
QwenCode/<ver> (<platform>; <arch>) |
| Accept | */* |
text/markdown first |
| Links kept | No on fallback | Yes (turndown) |
| Limit | 34 MB per URL; 250,000 chars on fallback | 10 MB body; 100,000 chars |
Tests to run against this agent
Section titled “Tests to run against this agent”These map onto the shared test catalog.
- Cache versus live. Setup: a unique-token page with header logging. Fetch it with Gemini CLI, wait a week, and fetch it again. Expected signal:
GoogleAgent-URLContexthits the first time; fewer or none once Google has indexed the page. - robots.txt compliance. Log robots.txt requests at the origin rather than the CDN, then
Disallowthe page forGoogle-Extended,GoogleOtherand*in turn. Expected signal: whetherurlContextrequests robots.txt and stops. - Fallback signature. Break the primary path, for example with a proxy that returns errors for the Gemini API. Expected signal: a
Google-Gemini-CLI/1.0hit from the developer’s IP with noAcceptheader. - Status-check gap. Return
403to Google’s IP ranges only. Expected signal: the CLI reports that it could not retrieve the page and no fallback request arrives. - GitHub blob URLs. Ask
web_fetchfor agithub.com/.../blob/...URL. Expected signal: which URL Google’s fetcher requests, the blob page orraw.githubusercontent.com. - Search source URIs. Run
google_web_searchfor a query your site ranks for and inspect theSources:URIs forvertexaisearchredirectors.
Open questions
Section titled “Open questions”- Google hasn’t documented
GoogleAgent-URLContextor its IP ranges; our lab shows it exists but not which JSON range file covers it. - Vertex docs say
urlContexthonours robots.txt, but the Gemini API docs are silent and our lab could not log robots.txt requests. - We don’t know what causes the duplicate fetch from two Google IPs.
- We don’t know whether
directWebFetchwill become the default, which would move fetching back to the developer’s machine and make markdown negotiation matter.
Further reading
Section titled “Further reading”- Google: URL context in the Gemini API
- Google Cloud: URL context on Vertex
- Google: Grounding with Google Search
- Google Search Central: user-triggered fetchers
- Google Search Central: common crawlers and Google-Extended
- Lopez-Fonseca et al.: Do Generative AI Assistants Respect robots.txt?
- AI Crawler Check: GoogleAgent-URLContext
- Gemini CLI docs: web_fetch
Last reviewed 2026-12-02 against Gemini CLI 0.46.0. This site is re-reviewed monthly; see maintenance.