How is scraping for AI different from classic scraping?
Classic scraping fills a database: you want every field of every row, and size does not matter much. Scraping for an AI agent fills a context window: you want what answers the question, in plain text, at the fewest tokens, and often right now rather than overnight. Agents also act: they log in, click and fill forms, which a crawler never does.
What are the four ways to give an agent the web?
| Way | What the model gets | Use it when | Measured |
|---|---|---|---|
| Read | The passages of a page or PDF that answer | The agent has a URL and a question | 94.5% fewer tokens on 8 long pages |
| Search | Sentences from live results, with sources | The agent needs to find pages first | 86.3% fewer tokens for one question |
| Extract | Rows from a known kind of site, by code | Jobs, stores, reviews, filings, news | 98.4% fewer tokens for 50 filings |
| Browse | A ranked view of the page, then the changes | Logins, clicks, forms | 19× fewer tokens over 3 tasks |
How do you handle JavaScript pages, PDFs and logins?
- JavaScript pages: render them in a real browser, then read the text; remember which sites need it so the next read goes straight there.
- PDFs and Office files: parse the text layer, run OCR when a scan has none, and return the passages that answer; a 152-page annual report came to 1,277 tokens for one question instead of 140,355.
- Logins: use saved sessions or a secrets vault, so the model never sees a password, and ask a person before anything that pays, sends or deletes.
How do you stay polite and legal?
Respect robots.txt, keep the request rate low, and stop when a site challenges you instead of trying to get around it. Identify your agent honestly; signed agent identity lets sites see who is browsing. You are responsible for the sites you read and the data you keep: check the site's terms, avoid personal data you do not need, and redact what you keep. This is not legal advice.
Should you build it or use an API?
A scraper for an AI agent needs rendering, boilerplate removal, a ranker, parsers for PDFs and Office files, OCR, change detection, a browser with approvals and code for the sites you read most. Build it when scraping is your product; use an API when it is a step in your agent. The comparison of seven says when each one is the better pick, including when it is not us.