An agent that reads the web needs more than an HTTP client. It needs a dependable path from a URL to content that the model can reason over, with enough diagnostics to explain failures.
Raw HTML usually contains navigation, scripts, styling, consent interfaces, and repeated page furniture. Cleaning that material before it reaches a model can reduce unnecessary input, but extraction quality matters more than simply producing the fewest tokens.
What makes agent scraping different
Traditional scraping often targets known fields with selectors. An agent more often needs the meaningful page content, its semantic structure, and provenance that can be cited later.
Evaluate three properties together:
- Content fidelity: headings, tables, lists, links, and code should survive when they are relevant.
- Operational visibility: the client should distinguish navigation time, cleaning time, and total time rather than expose only a single opaque latency.
- Failure semantics: blocked, timed-out, unsupported, and empty pages should be explicit outcomes your agent can handle.
Integration pattern: MCP
Model Context Protocol lets compatible clients call external tools using a shared protocol. It is useful when the agent environment already understands MCP and you want web access to be configured rather than coded into every workflow.
Use the connector distributed with the product you choose, confirm its tool schema, and pin the executable or release you deploy. Do not assume an unofficial package name is current.
Integration pattern: REST
For a custom agent, wrap the API in a small function and keep the full response available for logging:
import requests
def scrape_url(url: str, api_key: str) -> str:
response = requests.post(
"https://purify.verifly.pro/api/v1/scrape",
json={"url": url},
headers={"Authorization": f"Bearer {api_key}"},
)
response.raise_for_status()
result = response.json()
# Diagnostics are nested under result["tokens"] and result["timing"]:
# original_estimate, cleaned_estimate, savings_percent
# total_ms, navigation_ms, cleaning_ms
return result["content"]The current Purify contract uses content for the cleaned page. It does not use the legacy markdown field. Token diagnostics live under tokens, and timing diagnostics live under timing.
Integration pattern: a browser you operate
Running Playwright or another browser directly gives you control over sessions, network behavior, and rendering. It also makes your team responsible for browser lifecycle, capacity, retries, and extraction logic.
This can be the right choice when pages require a specialized authenticated session or precise browser instrumentation. For public pages and general agent reading, an API or self-hosted extraction service may be simpler to operate.
What to optimize for
Content retention
Create a review sheet for each fixture. Mark whether the result preserved the title, main argument, lists, tables, code, citations, and important metadata. Also mark unexpected navigation, footer, advertising, or duplicate text.
Do not score only by token reduction. A result that is compact because it removed the answer is a failed extraction.
Token diagnostics
Purify reports tokens.original_estimate, tokens.cleaned_estimate, and tokens.savings_percent. Treat these as response diagnostics for that request, not a universal promise for other URLs.
To estimate model cost, use the cleaned estimate from your own fixture set and the current price published by your selected model provider. Avoid copying a static cost table into an architecture decision; model pricing changes.
Timing diagnostics
Use timing.total_ms, timing.navigation_ms, and timing.cleaning_ms to understand where time was spent. Collect a distribution over your own sources and region instead of comparing one-off screenshots from different environments.
Reliability
Your agent may receive any URL a user provides. Test inaccessible pages, redirects, non-HTML content, client-rendered pages, malformed markup, and rate-limit responses. The calling agent should be able to say it could not read a page instead of inventing its contents.
A practical selection process
- Collect representative URLs and expected content notes.
- Run each candidate with equivalent rendering and timeout settings.
- Save raw responses and exact version information.
- Review both missing content and retained noise.
- Measure errors and timing over repeated runs in your environment.
- Confirm the deployment, license, and data boundary with current official documentation.
Cross-vendor figures previously published in this article did not include a reproducibility manifest and have been removed. This guide intentionally avoids competitor price and concurrency claims; verify those directly before purchase.
The best API is the one that preserves the content your agent needs, fails in a way your application can understand, and fits the operating model your team is prepared to own.