Netweir 0.6.0 is on PyPI. The last post promised two things: more page types, and pages split into chunks for retrieval. Both are here, and so is the third thing on the roadmap: an AI agent can now read the web through Netweir.

pip install -U netweir

A page, in pieces you can embed

Netweir has turned pages into clean Markdown for a while. What you couldn’t do was hand that Markdown to an embedding model, because a long article is one string far too big for it. Now:

for chunk in page.chunks(1000):
    chunk.headings  # ('Guide', 'Install')
    chunk.text      # '## Install\n\nRun the installer...'
    chunk.id        # 'bd0d75a5b00504ff2a46d322c479820e'

The cuts follow the page’s own headings, and each chunk keeps the path of headings above it, so “Install” still knows it belongs to “Guide”. Code blocks and tables stay whole while they fit. Menus and footers stay out, because only the main content is chunked.

The id is the part I’d point at. It’s a hash of the URL, the headings and the text, so it comes out the same on next week’s crawl. Edit one section and only that section’s ids change. Your pipeline can skip re-embedding everything else.

to_langchain() and to_llamaindex() hand chunks straight to either. Netweir won’t embed them or store vectors; that’s what the tools you already use are for. And it’s cheap: on a 1 MB article, chunking costs 0.3 ms more than the Markdown alone.

A docs site, chunked, in one command

netweir crawl docs --url https://example.com/docs/ -o docs.jsonl

It stays under /docs/, skips the blog and the pricing page, and writes one record per page with its URL, title and chunks. That’s an index for a support bot in one line. Each record says where it came from through netweir.page_url(), a new field you can add to any Item.

An AI agent that reads the web through Netweir

pip install 'netweir[mcp]'
claude mcp add netweir -- netweir mcp

netweir mcp is a Model Context Protocol server. Claude Code, Claude Desktop, Cursor and other MCP clients can start it, and the agent gets five tools: read_page for Markdown, chunks, extract for the auto types, select for a CSS selector, and links. Each one fetches the way Chrome does, so where a plain HTTP client gets a block page, the agent usually gets what a person would. With browser=true, Chrome itself loads it.

The server opens no port. It runs only while your client runs it, and it fetches only http and https URLs, never file:. Which tools an agent may call is your client’s decision. The MCP guide has the setup for each client, and what to watch for when an agent reads pages you don’t control.

Your own fields, read by Claude

Auto-extraction covers products, jobs, articles and the rest, and costs nothing. But a bakery’s loaf, a council’s bin days or a festival line-up fit no type. Describe what you want instead:

from netweir import llm

llm.extract(page, {
    "name": "the loaf's name",
    "weight": "its weight, with the unit",
    "keeps": "how long it keeps",
})
# {'name': 'Sourdough loaf', 'weight': 'about 800 g', 'keeps': 'three days in a bread bin'}

Give it a pydantic model and you get a validated instance back. The answer comes back in your schema’s shape, so there’s no free text to parse.

It runs on your key, not mine. pip install 'netweir[llm]', set ANTHROPIC_API_KEY, and each call goes from your machine to Anthropic’s API, or to Bedrock or Vertex if you pass that client. Netweir has no key or service of its own, and nothing calls a model unless you call llm.extract.

Five more page types

netweir.auto now reads:

  • BusinessPlace: a restaurant’s, dentist’s or hotel’s address, phone and opening hours, one entry a day.
  • RealEstate: price, bedrooms, bathrooms and floor area. £1,250 pcm comes back as a monthly rent.
  • SocialMediaPost: one post’s text, date, hashtags, media and reactions, and what the page says about its author.
  • Serp: a search engine’s organic results, with the engine’s redirect links unwrapped. A shop’s own search page doesn’t pass for one.
  • PageContent: any page’s main text, kept apart from its header, footer and sidebar.

The browser can go back

Pages in Chrome get go_back(), go_forward() and reload(). press("ControlOrMeta+a") presses key combos, which is Meta on a page that claims to be a Mac and Control elsewhere, just as a person’s fingers would. And drag(source, target) drags, whether the page wants HTML5 drag and drop or a plain mouse on a slider.

Fixes

  • A crawl’s checkpoint saved each request’s proxy password, so the file held it. It now keeps the proxy masked, finds the login again from the crawl’s own proxies on resume, and scrubs the passwords out of checkpoints written by older versions when it opens them.
  • On Windows, Ctrl-C to cancel a crawl could also stop chrome-headless-shell. It runs in a hidden console of its own now.
  • netweir fetch --browser read some pages in the wrong charset.

Python 3.11 and up

Python 3.10 reached the end of its life this month, so 0.6 needs 3.11 or later. If you’re on 3.10, pip keeps you on 0.5 and nothing breaks.

What’s next

More of the browser: finding elements by their text or role, saving a page as a PDF, tracing, and replaying a HAR file. After that, more engines, Firefox and WebKit, but only once they can be driven as quietly as Chrome is today.

Every change is on the changelog. If a page chunks badly or an agent can’t read something it should, open an issue with the URL.