response_type=markdown and Adaptive Stealth Mode (mode=auto)
How it works
- Crawl finds the pages. Crawl starts at one URL, follows links on the same domain, and keeps the URLs that match
include_patterns. - Batch fetches every page as markdown. One Batch job runs every URL with
response_type=markdownandmode=auto. Headings, lists, links and tables stay; scripts and styling go. - Your code chunks by headings. Each
#to######heading starts a new chunk, and the chunk keeps its heading path (Product > Description) as context. Text before the first heading, usually site navigation, is skipped. - Your embedding model indexes the chunks. Every chunk becomes a vector in your store, with its URL and heading as metadata.
- Search returns the best chunks. A question is embedded the same way, and the closest chunks go into your LLM prompt.
Ask your AI agent
With the Zenrows MCP server connected to Claude, Cursor or any MCP client, paste this prompt. Your agent picks the right Zenrows tools and settings on its own.Build the index
Install the Zenrows SDK withpip install zenrows. The script crawls three product pages, fetches them as markdown, chunks them and searches them. Raise max_items to index a whole site.
Python (SDK)
embed() function above is a dependency-free stand-in so the script runs as pasted. It matches words, not meaning: swap it for a real embedding model before you rely on the results.
Example output
Description section, which lists “95% Organic Cotton / 5% Spandex”.
Plug in your embedding model and vector store
These two snippets are one choice among many: use the embedding model and vector database your stack already has. Keep the chunk’surl and heading as metadata, so every answer can cite its source.
An embedding model. Replace embed() with a call to your provider. With OpenAI (pip install openai, OPENAI_API_KEY set):
Python
store and search() with your database. With Chroma (pip install chromadb), passing the vectors from embed():
Python
Customize it
Troubleshooting
- The crawl keeps fewer pages than expected:
include_patternsalso decides which links Crawl opens. Add the patterns of the listing or index pages that link to your content, or remove the patterns and useexclude_patternsinstead. - Chunks contain menus and footers: they sit under a heading inside the page template. Drop chunks whose heading matches template sections, or filter lines that are only links.
- Answers cite the wrong page: chunks are too large and mix topics. Lower
max_charsso each chunk covers one idea. - Some Batch tasks failed: rerun only the failures with
job.retry_failed(). Successful results carry over.
Related recipes
Turn any web page into LLM-ready markdown
How
response_type=markdown works on one page.Map every URL on a website
Run Crawl on its own to list a site’s pages.
Build a research agent with live web data
Let an LLM read the web on demand instead of from an index.
Scrape a list of URLs
Send thousands of URLs as one Batch job.