2.0 KiB
2.0 KiB
name, description
| name | description |
|---|---|
| web-content-acquisition | Use when fetching a URL's content headlessly (page or doc). |
Fetching URL content headlessly
Class: turn a URL into the document's actual text. Do not open a GUI browser to look at it — in a headless CLI there is no window to show. Pick the cheapest reliable retrieval and validate each one.
Method order (cheapest first; confirm each works before moving on)
- Shared doc → no-JS export endpoint (works for anyone-with-link Google Docs/Sheets/Slides; no JS, no login).
- Docs:
https://docs.google.com/document/d/<ID>/export?format=txt(alsodocx,pdf) - Sheets:
https://docs.google.com/spreadsheets/d/<ID>/export?format=csv - Success signal: HTTP 200,
content-type: text/plain, or a redirect to*.googleusercontent.comwith real bytes back. A login/consent redirect instead = private doc → go to 2/3.
- Docs:
- web_extract — only when
web.extract_backendis a content backend (firecrawl / tavily / keenable / exa / parallel). A search-only backend (e.g. brave-free) cannot fetch page content and errors out; that is a config gap, not a dead end — point the backend at a content provider and it works. - Browser (agent-browser) — for interactive/JS-only pages, or when the user needs the editable UI. Getting a runnable browser on this Termux/Android host is non-trivial — see
references/setup-termux.md, and prefer 1/2 whenever the content is reachable without it.
Standing gotchas (this host)
- No
/tmp. Write downloads and exports to the scratch dir ($BH_AGENT_WORKSPACEor~/.hermes/cache/scratch); acurl -o /tmp/...will fail with a write error. os.platform()here isandroid; binaries and tools that assumelinux, or a platform they don't ship, mis-resolve. Check what actually runs rather than what the name says.
After fetching
- Present the content. Offer the interactive editor path only if the user genuinely must edit (that needs their own Google login) — and say up front that the headless CLI has no GUI to display the editor in.