Skip to content

Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.

fix: wire semaphore_count into auto-created MemoryAdaptiveDispatcher (#1927)

hafezparastd3c92ee3dfa0
diff --git a/crawl4ai/async_webcrawler.py b/crawl4ai/async_webcrawler.py
index 36b999fd..68d1f2a5 100644
--- a/crawl4ai/async_webcrawler.py
+++ b/crawl4ai/async_webcrawler.py
@@ -1029,7 +1029,9 @@ class AsyncWebCrawler:
primary_cfg = config[0] if isinstance(config, list) else config
mean_delay = getattr(primary_cfg, "mean_delay", 0.1)
max_range = getattr(primary_cfg, "max_range", 0.3)
+ max_session_permit = max(1, int(getattr(primary_cfg, "semaphore_count", 5) or 5))
dispatcher = MemoryAdaptiveDispatcher(
+ max_session_permit=max_session_permit,
rate_limiter=RateLimiter(
base_delay=(mean_delay, mean_delay + max_range),
max_delay=60.0,