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 example
- Main model→Agent CLI
WebFetch(url, prompt) - Agent CLI→Vendor API
domain_info?domain=host1 · preflight
- Agent CLI→Your server
GET https://… (agent UA)2 · request, 3 · redirects
- Your server→Agent CLI
200 text/html4 · size cap
- Agent CLI
strip, HTML → markdown5 · conversion, 6 · truncation
- Agent CLI→Vendor API
small model: page + prompt7 · summarisation
- Vendor API→Agent CLI
answer about the page - Agent CLI→Main model
summary, not the page8 · handoff, 9 · cache 15 min
Stage 1: permission and preflight
Section titled “Stage 1: permission and preflight”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.
Stage 2: the request itself
Section titled “Stage 2: the request itself”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.
Stage 3: redirects
Section titled “Stage 3: redirects”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.
Stage 4: the byte cap
Section titled “Stage 4: the byte cap”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.
Stage 5: cleaning and conversion
Section titled “Stage 5: cleaning and conversion”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.
Stage 6: character truncation
Section titled “Stage 6: character truncation”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.
Stage 7: summarisation by a second model
Section titled “Stage 7: summarisation by a second model”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.
Stage 8: handoff to the main model
Section titled “Stage 8: handoff to the main model”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.
Stage 9: caching
Section titled “Stage 9: caching”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.
Stage limits by agent
Section titled “Stage limits by agent”| 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.