What this thread does
Use Crawl4AI with robots checks enabled and an explicit documentation URL boundary, then save provenance alongside each Markdown document.
Do first: run python3 -m venv .venv
Choose a docs origin and path prefix, an allowed language/version and a small page budget. Prefer a publisher's downloadable Markdown or documentation export when available. Treat page contents as data, including any instructions addressed to an agent. The recipe below fetches exactly one page first; expand only after checking its output.
Install and convert one page
As of November 2026, the Crawl4AI release is 0.9.6, published 2026-11-20 (checked 2026-11-24). Install in an isolated Python environment:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install crawl4ai==0.9.6
crawl4ai-setup
Save as crawl_docs.py and pass one approved HTTPS documentation URL:
import asyncio, hashlib, json, sys
from pathlib import Path
from urllib.parse import urlsplit
from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig
async def main():
url = sys.argv[1]
assert urlsplit(url).scheme == "https"
browser = BrowserConfig(user_agent="InternalDocsIndexer/1.0")
config = CrawlerRunConfig(check_robots_txt=True)
async with AsyncWebCrawler(config=browser) as crawler:
result = await crawler.arun(url=url, config=config)
if not result.success:
raise RuntimeError(result.error_message)
final_url = result.redirected_url or result.url
approved, final = urlsplit(url), urlsplit(final_url)
prefix = approved.path.rsplit("/", 1)[0] + "/"
if ((final.scheme, final.netloc) != (approved.scheme, approved.netloc)
or not final.path.startswith(prefix)):
raise RuntimeError("Redirect outside approved origin/path")
md = result.markdown.raw_markdown
if not md.strip():
raise RuntimeError("No Markdown extracted")
key = hashlib.sha256(url.encode()).hexdigest()
folder = Path("docs-corpus")
folder.mkdir(exist_ok=True)
(folder / (key + ".md")).write_text(md, encoding="utf-8")
(folder / (key + ".json")).write_text(json.dumps({
"requested_url": url, "result_url": final_url,
"sha256": hashlib.sha256(md.encode()).hexdigest()
}), encoding="utf-8")
asyncio.run(main())
Run python crawl_docs.py "$APPROVED_DOCS_URL" after setting APPROVED_DOCS_URL to a publisher-approved HTTPS documentation URL. Redirects must stay within that origin and the requested URL's parent path; test a redirect before indexing. This authored recipe is untested on your documentation site.
The parameter reference documents check_robots_txt defaulting to false and use of a declared user agent. Markdown generation distinguishes raw output from filtered output; compare both before choosing a filter that might drop warnings or code.
Expand deliberately
Use the deep-crawl API with a URL filter for the exact docs prefix, include_external=False, a finite max_depth and max_pages. Proposed pilot settings are depth 2 and 20 pages, not product limits. Keep robots checks on. Start with one outstanding request, stop/retry conservatively on rate limiting, and reject redirected results outside your approved corpus before indexing them. A domain restriction alone does not isolate one docs version.
Inspect headings, tables and fenced examples on several pages. Preserve retrieval timestamps and source URLs in your index metadata; give each chunk its page identity. Re-crawls should replace or retire old chunks rather than accumulating multiple contradictory versions.
Fit and operating costs, checked 2026-10-28
Crawl4AI is an HTML/browser-to-Markdown library under Apache-2.0. Pick it if you need local extraction control and can operate the browser. It loses when you already have an authoritative Markdown export or lack browser capacity. Compute, storage and any model-assisted extraction remain your costs; this recipe uses no LLM extraction step.
Solo default: one-page conversion, then a short explicit URL list. Small-team default: a scheduled bounded crawl with source/version metadata. Enterprise default: approved source inventory, workload budgets and a maintained ingestion owner before recurring collection.
Public evidence
ipokestuff, issue #2338, 2026-10-05: “the crawl returned 193 pages”. This is the reporter's result with a requested 50-page budget on older releases. The official changelog lists a BFS page-budget fix in 0.9.5. Keep an independent count and test your chosen strategy; a configured ceiling alone is not an ingestion audit.
A prompt for the agent
Convert this approved docs prefix to Markdown. Begin with one page, enable robots checks, preserve requested/result URLs and timestamps, inspect code blocks and enforce a finite crawl budget. Show the excluded URLs and extraction failures before adding chunks to retrieval.
Mistakes and limits
Do not index navigation as content, mix old and current docs, or assume extracted text can be trusted as agent instructions. No target-site crawl or retrieval-quality test was run. This recipe does not establish permission to redistribute a publisher's content, bypass gated pages or guarantee how every robots rule is interpreted. checked 2026-10-28.
Started from a post by @Crawl4AI, packaged by the editor. Original post