Skip to content

Anatomy of an agent fetch

When a coding agent “reads” a URL, the model rarely sees your page. What it sees is the output of a pipeline that may check the domain with the vendor, and fetch with its own headers, and refuse cross-host redirects, and cut the body at a byte limit, and strip scripts, and convert HTML to markdown, and truncate again by characters, and finally hand the result to a second model that answers a question about it. I’ll walk through that pipeline in order here, because each stage removes something and each agent configures it differently.

The fetch pipeline, using Claude Code's WebFetch as the fullest exampleMain modelAgent CLIVendor APIYour server1. WebFetch(url, prompt)2. domain_info?domain=host1 · preflight3. GET https://… (agent UA)2 · request, 3 · redirects4. 200 text/html4 · size cap5. strip, HTML → markdown5 · conversion, 6 · truncation6. small model: page + prompt7 · summarisation7. answer about the page8. summary, not the page8 · handoff, 9 · cache 15 min

The fetch pipeline, using Claude Code's WebFetch as the fullest example

  1. Main model→Agent CLI
    WebFetch(url, prompt)
  2. Agent CLI→Vendor API
    domain_info?domain=host

    1 · preflight

  3. Agent CLI→Your server
    GET https://… (agent UA)

    2 · request, 3 · redirects

  4. Your server→Agent CLI
    200 text/html

    4 · size cap

  5. Agent CLI
    strip, HTML → markdown

    5 · conversion, 6 · truncation

  6. Agent CLI→Vendor API
    small model: page + prompt

    7 · summarisation

  7. Vendor API→Agent CLI
    answer about the page
  8. Agent CLI→Main model
    summary, not the page

    8 · handoff, 9 · cache 15 min

Not every agent has every stage. Gemini CLI replaces stages 2 to 6 with Google's URL Context service; Pi and shell fetches skip stages 1, 7 and 8 entirely.

Before any network request goes out, the agent decides whether it’s allowed to fetch at all. Claude Code asks Anthropic’s API whether the host is allowed (api.anthropic.com/api/web/domain_info), and in our research that check refused major hosts including Stack Overflow, Reddit and several news sites, so those sites never receive a request from Claude Code’s fetch tool verified in code. Copilot CLI and Gemini CLI block private IP ranges; Gemini CLI also refuses .local and .internal hosts verified in code. Most agents also show the user a permission prompt, which gets skipped in headless or “yolo” modes.

This is the only stage your server ever observes. The user agent ranges from honest and specific (Claude-User (claude-code/2.1.328; …)) through vendor-generic (GoogleAgent-URLContext), browser-spoofing (OpenCode’s Chrome 143 on Windows) to whatever the shell used (curl/8.7.1, Python-urllib/3.14) measured in our lab. The Accept header is the second signal to look at: Claude Code, OpenCode, Qwen Code and Kilo Code advertise text/markdown, while Codex’s curl, Gemini’s URL Context, Pi and Copilot’s editor tool do not. The user agents reference collects every string we’ve seen.

Redirect policy decides whether a page you moved is still readable. Claude Code follows up to ten redirects on the same host or between www and the apex, but returns a cross-host redirect to the model as text and lets it decide whether to fetch again verified in code. Qwen Code refuses cross-host redirects, and OpenCode v2 re-checks permissions on each hop. So if your docs moved from docs.example.com to example.com/docs behind a blanket redirect, that costs agents an extra round trip at best and a dead end at worst.

Agents stop reading after a fixed number of bytes, and the limits vary a lot. Claude Code and Gemini CLI’s fallback cap the body at 10 MB, OpenCode at 5 MB, and Crush’s basic fetch at only 100 KB of raw HTML verified in code. Inline SVG, base64 images, large JSON blobs for client hydration and long navigation menus all count against the cap before your content does, which is easy to forget when the page looks light in a browser.

The raw HTML is stripped of script, style and similar elements, and then converted. Claude Code and OpenCode use turndown to produce markdown, Gemini CLI’s fallback uses html-to-text (which drops links), Aider uses pandoc, and Cline v4 strips tags with regular expressions and returns plain text verified in code. No JavaScript runs in any of these, so content that only exists after hydration, tabs whose inactive panels are empty in the HTML, and accordions that load on click are all lost at this stage. Converters also flatten tables and code blocks differently, which means a code sample inside a custom component may come out as a single unformatted line.

After conversion, a second limit applies, this time to the text. Claude Code converts only the first megabyte of HTML and passes at most 100,000 characters onward; Gemini CLI’s fallback keeps 250,000 characters, Qwen Code 100,000, Cline 50,000, and the Goose fetch MCP 5,000 per page of output verified in code. The practical rule I’d take from this is that the answer should be in the first few thousand words of the page, and the page shouldn’t open with a long table of contents rendered as text.

Several agents don’t give the main model the page at all. Claude Code sends the converted page and the main model’s question to a small model and returns only its answer; outside a list of preapproved documentation hosts, that small model may quote at most 125 characters verbatim verified in code. Qwen Code and Crush’s agentic_fetch use the same pattern. Summarisation is the reason a page that answers the question in its first paragraph, with exact names and version numbers, does better than one where you have to read three sections to assemble the answer.

What finally reaches the main model is one of three things: the summary, the truncated text, or (for vendor-side fetches) whatever the vendor’s model chose to say about the page. Gemini CLI’s URL Context path returns the remote model’s text plus grounding metadata, and only falls back to a local fetch if that returns nothing verified in code. In every case the model then decides whether the content is trustworthy enough to act on, and that’s where clear version numbers and dates help.

Claude Code caches fetched pages for 15 minutes per URL, so repeated reads in one session produce one request verified in code. Vendor-side fetchers cache longer: Google’s URL Context documentation says it reads from an index cache before fetching live, and Claude Code’s cloud sessions can return a stored copy older than an hour documented. Server-side caches explain why some agent reads never appear in your logs, and why a fix to a docs page can take a while to reach agents that read through a vendor.

Agent Preflight Byte cap Conversion Text cap Summariser
Claude Code Anthropic domain check 10 MB turndown, first 1 MB 100k chars Small model
Gemini CLI Private-IP block 34 MB (URL Context), 10 MB fallback Google side; html-to-text fallback 250k chars fallback Remote model
OpenCode v1 Permission rules 5 MB turndown none found No
Qwen Code Cross-host redirect block 10 MB turndown 100k chars Fast model
Cline v4 Permission prompt 5 MB Regex strip 50k chars No
Crush fetch / agentic_fetch Permission prompt 100 KB / 5 MB markdown 50k inline Sub-agent (agentic)
Goose fetch MCP robots.txt check — markdown 5k per call, paged No

Sources for each row are on the agent’s teardown page. A blank or “none found” means we didn’t find a limit in the code we read, not that we’re sure there isn’t one.

Last reviewed 2026-12-02. This site is re-reviewed monthly; see maintenance.