Modules
Advanced Modules
Platform overview, module architecture, and how modules compose
4 min read
The orchestrator
client.crawl() is the high-level orchestrator that chains discovery, fetching, and optional extraction into a single call:
result = client.crawl(
"https://example.com",
max_depth=2,
extract_schema={"title": "css:h1", "content": "css:article"},
)
It calls webgrph.crawl() for discovery, evadr.fetch() for each page, and kolektr.page() for extraction — all in one synchronous call. Use client.crawl_stream() (TypeScript and Java: crawlStream(), Go: CrawlStream()) for progress events.
The 3 low-level methods
Behind the orchestrator, KLOAKD has three low-level methods for fine-grained control:
| Method | Module | Returns | Use case |
|--------|--------|---------|----------|
| evadr.fetch() | Evadr | Raw HTML + artifact | Get a single page with anti-bot bypass |
| webgrph.crawl() | Webgrph | Page hierarchy | Map an entire site (the SDK waits for it) |
| kolektr.page() | Kolektr | Structured records | Extract data from a single page |
See Choosing an Approach for guidance.
Advanced modules
Beyond the 3 core methods, KLOAKD has 4 specialized modules for advanced use cases:
| Module | Role | SDK namespace |
|--------|------|---------------|
| Skanyr | A stored, searchable copy of a crawled site: its resources, APIs and changes | client.skanyr |
| Nexus | AI strategy engine — analyze a site and decide the optimal extraction approach | client.nexus |
| Parlyr | Conversational NLP — turn natural language prompts into extraction plans | client.parlyr |
| Fetchyr | Logins & authentication — handle login flows, MFA, form detect and fill | client.fetchyr |
Artifact chaining
The key to KLOAKD's efficiency is artifact reuse. When evadr.fetch() retrieves a page, it stores the result as an artifact. Every subsequent module can reference that artifact instead of re-fetching.
evadr.fetch(url) → artifact_id: "art-abc123"
kolektr.page(url, fetch_artifact_id=artifact_id) → reuses the fetched HTML
A login session works the same way: fetchyr.authenticate(), an auth-chain discovery or a login session from your own account gives a session artifact that evadr.fetch(), kolektr.page() and webgrph.crawl() accept as session_artifact_id.
Composition patterns
Fetch → Extract
page = client.evadr.fetch("https://example.com")
data = client.kolektr.page("https://example.com", fetch_artifact_id=page.artifact_id)
Crawl → Extract (batch)
Use client.crawl() with extract_schema for a one-call solution:
result = client.crawl(
"https://example.com",
max_depth=2,
extract_schema={"title": "css:h1", "content": "css:article"},
)
for page in result.pages:
print(f"{page.url}: {page.structured_data}")
For a job that runs on the server and whose rows you download as JSON, NDJSON or CSV, start a crawl-extract job (webgrph.crawl_extract in the SDKs from 0.7.0).
Or use the low-level webgrph.crawl() + kolektr.page() manually:
crawl = client.webgrph.crawl("https://example.com", max_depth=2) # waits for the crawl
for page in crawl.pages:
data = client.kolektr.page(page.url, schema={"title": "css:h1"})
Fetchyr → Extract (authenticated)
client.fetchyr.store_credentials("acme", username="user@example.com", password="secret")
session = client.fetchyr.authenticate("acme", target_url="https://example.com/login")
data = client.kolektr.page(
"https://example.com/dashboard",
session_artifact_id=session.artifact_id,
)
Crawl → detected APIs → Kolektr (API data)
client.webgrph.crawl("https://example.com", max_depth=1) # runs the API detectors
apis = client.webgrph.detected_apis("https://example.com")
data = client.kolektr.get_api_data("https://example.com/api/v1/products")
Error model
All errors inherit from a base KloakdError class:
| Error | HTTP | When |
|-------|------|------|
| AuthenticationError | 401 | Invalid API key |
| PaymentRequiredError | 402 | The plan's last payment failed |
| ForbiddenError | 403 | Not allowed, for example another organisation's ID |
| NotEntitledError | 403 | The plan doesn't include this (not_entitled, tier_access_denied); a kind of ForbiddenError |
| QuotaExceededError | 429 | GB allocation and top-ups used up (gb_exhausted) |
| RateLimitError | 429 | A request-rate limit where one applies, or a test key's quota (includes retry_after) |
| ConcurrencyLimitError | 409 | concurrent_limit: all of your plan's work slots stayed in use, on a route that cannot queue (concurrent work) |
| UpstreamError | 502 | The request could not be run or handed to a job |
| BillingUnavailableError | 503 | Usage could not be checked; retry after retry_after |
| JobFailedError / JobTimeoutError | — | A handed-off fetch failed, or ran past the poll timeout |
| ApiError | 4xx/5xx | Other errors |
A fetch or extraction that could not get the page is not an error: the API answers 200 with success: false and the reason in error, so check success on every result. 422 is a request body that failed validation.
See Error Reference for full details.
Retry policy
All SDKs retry with exponential backoff:
- Retried:
429rate_limitedand503billing_unavailableon any method;500,502,503,504and network errors only forGET,HEADandDELETE(aPOSTmay already have done the work) - Not retried:
400,401,402,403,404,409,422,429gb_exhausted, and a test key's used-up quota 429and503honour theRetry-Afterheader (orretry_afterin the body), up to 60 s- Otherwise
1 s × 2^attempt, capped at 60 s - Default: 3 retries
