Replacing smolagents' VisitWebpageTool with a custom fetch layer to beat anti-bot pages

InsideDebt6345 · reddit · 2026-09-10

A developer found Hugging Face smolagents' built-in VisitWebpageTool breaks on protected/JS-heavy pages — a Walmart product page returned 'Robot or human?' bot-check text that the agent then reasoned over as real content. The fix: define a custom fetchpage(url) tool with the tool decorator, document it well in the docstring (smolagents builds the tool description from it at runtime), register it in the CodeAgent tools list, and prompt the agent to use it for all retrievals. Using ZenRows (or any trusted retrieval backend) as the fetch layer gives Markdown from dynamic and protected pages without maintaining your own browser/proxy stack.

Original post →

More from coding & agent

coding & agent channel →