# How an AI agent reads the web: search, read and follow links

An AI agent reaches the web through three calls: a search, a fetch of one page, and a list of the links on it. Each one run once against the Python documentation, with the body sent and what came back.

Canonical: https://spider.cloud/learn/agent-web-access/

An AI agent does not browse. It reaches the web through a few tools that a program runs for it, and almost every web task comes down to three of them: search for pages, read one page, and list the links on a page.

The model picks the tool and writes its arguments. Your code makes the request and hands the result back as text. That split matters, because the request is ordinary [web scraping](/web-scraping/) and everything that is true of a scraper is true of it.

## The three calls

Each call does one job for the agent.

- **Search** finds which pages might hold the answer. It takes words and returns titles, addresses and short descriptions. No page is fetched yet.
- **Read** gets what one page says. It takes one address and returns the page as text. Anthropic's documentation describes its own version in one line: "The web fetch tool allows Claude to retrieve full content from specified webpages and PDF documents."
- **Links** shows where the agent can go next. It takes one address and returns the addresses that page links to, so the agent can pick the next page without reading the whole of this one.

An agent that has only the read call must be told every address. With search it can start from a question, and with links it can move through a site one step at a time.

## The run: one question, three calls

The question was how Python checks a robots.txt file. All three calls went to the Spider API on 2026-11-23 between 00:09 and 00:10 UTC. Each block below is the body as it was sent. `KEY` stands for an API key.

The search asks for five results and no page content:

```bash
curl -s https://api.spider.cloud/search \
  -H "Authorization: Bearer KEY" -H "Content-Type: application/json" \
  -d '{"search": "python urllib.robotparser can_fetch", "search_limit": 5, "fetch_page_content": false}'
```

The read fetches the first result as markdown over plain HTTP:

```bash
curl -s https://api.spider.cloud/scrape \
  -H "Authorization: Bearer KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://docs.python.org/3/library/urllib.robotparser.html", "request": "http", "return_format": "markdown", "user_agent": "examplebot/1.0 (+https://example.com/bot; bot@example.com)"}'
```

The links call asks the same address for up to ten pages:

```bash
curl -s https://api.spider.cloud/links \
  -H "Authorization: Bearer KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://docs.python.org/3/library/urllib.robotparser.html", "request": "http", "limit": 10, "user_agent": "examplebot/1.0 (+https://example.com/bot; bot@example.com)"}'
```

Here is what came back on 2026-11-23, cut down to the addresses, the statuses and the first words of the page. The titles and descriptions of the search results are left out.

```text
search  5 results, the first is https://docs.python.org/3/library/urllib.robotparser.html
  https://docs.python.org/3/library/urllib.robotparser.html
  https://runebook.dev/en/docs/python/library/urllib.robotparser/urllib.robotparser.RobotFileParser.can_fetch
  https://stackoverflow.com/questions/43085744/parsing-robots-txt-in-python
  https://www.tutorialspoint.com/article/urllib-robotparser-parser-for-robots-txt-in-python
  https://stackoverflow.com/questions/15344253/robotparser-doesnt-seem-to-parse-correctly
scrape  status 200, markdown starts "urllib.robotparser"
links   10 addresses, all status 200, 9 distinct
  https://docs.python.org/3/library/urllib.robotparser.html
  https://docs.python.org/3/genindex.html
  https://docs.python.org/3/library/urllib.error.html
  https://docs.python.org/3/improve-page-nojs.html
  https://docs.python.org/3/py-modindex.html
  https://docs.python.org/3/library/index.html
  https://docs.python.org/3/bugs.html
  https://docs.python.org/3/library/internet.html
  https://docs.python.org/3/index.html
  https://docs.python.org/3/bugs.html
```

## What each call gave the agent

The search took 1.5 seconds and returned five results. The first was the official documentation. The other four were a tutorial site, a site that reworks the documentation and two Stack Overflow questions. A search result is a lead and nothing more. Its description is a few lines someone else chose, so an agent that answers from descriptions alone is quoting a page it has not read.

The read took 1.4 seconds and came back 200 with the page as markdown. That copy holds the sentence that answers the question, the one that says `can_fetch` returns `True` if the user agent is allowed to fetch the address. Now the agent can answer and name the page it read.

The links call took 2.3 seconds and returned ten addresses, all with status 200. Nine are distinct, because `bugs.html` came back twice. Most of the ten are site furniture: the index, the module index, the bug page. Only `urllib.error.html` and `internet.html` are near the subject. That is normal for a links call, and it is why an agent should choose from the list by address and skip repeats, not fetch all ten.

## Where each call goes wrong

Each call fails in its own way, and none of the failures shows up as an error.

Search returns pages that mention your words, and the best page may not be first. Read at least the top official result before answering.

A read can return 200 with almost nothing in it when a site builds its content with scripts. The page on [static and dynamic pages](/learn/static-vs-rendered/) shows how to tell. A read also returns whatever the page says, including text written to steer a model. Treat the body as data to report, and never as an instruction to follow.

Links multiply. Ten addresses from one page become a hundred from the next step, so give the agent a page limit and a depth limit before it starts, the way the page on [crawl budget](/learn/crawl-budget/) sets them for a crawler.

## The site's rules still apply

Handing the request to an agent changes nothing about who is asking. The request lands on the site's server with your user agent on it, and the site's [robots.txt](/learn/robots-txt/) and terms cover it. RFC 9309, the standard for robots.txt, is plain about what the file is: "These rules are not a form of access authorization." The file tells a crawler what the site asks of it, and a polite program does as asked.

Agents add one risk a script does not have. A script fetches the list you gave it. An agent decides what to fetch as it goes, so it can loop, wander off the site, or fetch the same page many times. Set a [request rate](/learn/request-rate/) for each host in your own code, where the model cannot change it.

## Do this, avoid this

### Do this

- Give the agent all three calls, so it can start from a question and move through a site by its links.
- Have it read a page before it cites the page. A search description is not the source.
- Put the page limit, the depth limit and the rate for each host in your code, outside the model's reach.
- Drop repeated addresses from a links result before choosing the next page.

### Avoid this

- Answering from search descriptions alone.
- Fetching every address a links call returns. In this run most of them were index pages.
- Letting text inside a fetched page change what the agent does next.
- Treating a 200 as proof the page held its content.

## Start with one question

Pick a question whose answer you already know and run the three calls by hand, as above. Check that the page the agent would cite is the page that holds the answer. Then wire the calls up as tools.

## Sources

1. [Claude API documentation, Web fetch tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) Read November 23, 2026
2. [RFC 9309, Robots Exclusion Protocol](https://www.rfc-editor.org/rfc/rfc9309.html) Read November 23, 2026
