Skip to main content

Crawl4AI web acquisition

Agentstration provides an optional AEP extension that exposes a self-hosted Crawl4AI service as governed Tools. It is an acquisition provider for Flow composition; it does not create or own Knowledge Sources and is not required by the executable default.

Requirements and activation​

Run Crawl4AI 0.9.0 or newer and enable its API authentication. This baseline retains Crawl4AI's secure request boundary and SSRF protections.

Aspire uses managed provisioning by default when the extension is enabled. It starts the pinned Crawl4AI container, creates a persisted Aspire secret parameter, injects it into Crawl4AI's supported CRAWL4AI_API_TOKEN environment variable and the extension's protected configuration, and waits for Crawl4AI readiness before starting the extension. Aspire masks the parameter in its dashboard and persists it in AppHost user secrets. This avoids host bind mounts so Windows AppHosts can target a Linux Docker daemon running in WSL. The AppHost disables implicit development-certificate HTTPS termination for non-ASP.NET resources; HTTPS must be configured explicitly for any such resource that needs it. Crawl4AI is HTTP-only, opts out of development-certificate trust, and retains a read-only root filesystem:

Crawl4AI__Enabled=true
Crawl4AI__Provisioning=Managed
Crawl4AI__AllowedDomains__0=docs.example.com

The managed image defaults to unclecode/crawl4ai:0.9.4; Crawl4AI:Image and Crawl4AI:ImageTag allow an explicit operator override. The container is not created while Enabled is false, so Docker remains optional for the default topology.

Use external provisioning when Crawl4AI is administered independently. The endpoint is then required, and an optional protected token file can be supplied to the extension:

Crawl4AI__Enabled=true
Crawl4AI__Provisioning=External
Crawl4AI__Endpoint=https://crawler.example.net
Crawl4AI__ApiTokenFile=C:\protected\crawl4ai.token
Crawl4AI__AllowedDomains__0=docs.example.com

Enabled and Provisioning are consumed by AppHost. The acquisition limits and destination policy are passed to the extension. A manually launched extension uses the extension settings directly without those two AppHost controls. Crawl4AI:ApiToken is reserved for orchestrator-managed secret injection; prefer ApiTokenFile for a manually hosted or external deployment.

The extension sends a minimal { "urls": ["…"] } request to Crawl4AI. Flow or Agent input cannot set browser arguments, execute JavaScript, supply cookies or headers, choose a proxy, or override the configured endpoint.

Governed Tool contributions​

ContributionMCP ToolPurpose
crawl4ai.web.fetchweb_fetchAcquire one page.
crawl4ai.web.crawlweb_crawlAcquire a breadth-first page set within configured depth and count limits.
crawl4ai.content.extractcontent_extractProduce normalized text from previously acquired HTML or text.
crawl4ai.content.readcontent_readRead one bounded base64 chunk from temporary content.
crawl4ai.content.deletecontent_deleteIdempotently remove temporary content.

Contribution IDs use the crawl4ai. prefix, and the bundle's required-Tool declarations and binding placeholders use those exact IDs. Semantic capabilities such as web.crawl remain provider-neutral. Materialized Tool names additionally include the exact paired provider identity, so separate registrations do not collide at the same ownership scope. ToolSet, Flow, and Profile names use the crawl4ai- prefix. The Console catalog links the readable extension name and keeps the pairing identity out of list text; the exact provider remains available on details pages.

Earlier preview manifests used unprefixed Tool contribution IDs. Existing immutable bundle installations are not renamed or upgraded automatically; use a fresh installation to evaluate the revised manifest and update any custom binding keys.

Paired enrollment materializes these as extension-managed Tools and enables the three required by the bundle: crawl4ai.web.crawl, crawl4ai.content.read, and crawl4ai.content.delete. The other declared Tools remain disabled; an unavailable contribution badge can therefore mean disabled rather than a failed extension connection. Their managed configuration remains read-only. Tool availability does not grant execution rights: Agents and Flows still consume only their explicitly assigned capabilities and ToolSets.

The MCP schemas expose these stable arguments and results:

ToolInputsResult
web_fetchurl; optional correlationIdcorrelationId and one content reference.
web_crawlstartUrl; optional maximumDepth, maximumPages, correlationIdApplied bounds, ordered page references, one normalized corpus reference, and truncated.
content_extractcontentReference; optional correlationIdA separate normalized text/plain content reference; source URL and media type are resolved from the opaque reference.
content_readcontentReference, offset; optional maximumBytesBase64 chunk, original offset, and endOfContent.
content_deletecontentReferencetrue after the idempotent deletion attempt.

A content reference contains reference, sourceUrl, mediaType, length, sha256, links, and scalar metadata. Tool-specific optional values remain optional in the generated JSON Schema; configured ceilings always take precedence over smaller caller-requested crawl and read bounds.

Fetch and crawl results never embed the acquired document. Each result returns opaque references with source URL, media type, byte length, lowercase SHA-256 digest, accepted links, bounded scalar metadata, and correlation ID. A crawl additionally returns one text/markdown corpus reference containing the normalized pages separated by their canonical source URLs. The corpus is subject to the same per-content byte limit, so an oversized site fails explicitly instead of crossing the extension boundary unbounded. A reference begins with crawl4ai-content: but its remaining value is opaque.

content_read accepts the reference, a zero-based byte offset, and an optional bounded byte count. It returns the same offset, base64 content, and an end-of-content flag. Callers advance the offset by the decoded byte count.

Data Source acquisition Flow composition​

A typical site acquisition Flow is:

Data Source identity, resolved profile evidence, and acquisition parameters
-> route to the selected acquisition ToolSet
-> web_crawl and select its opaque normalized corpus reference
-> StagedArtifact create
-> repeat content_read -> StagedArtifact write
-> StagedArtifact seal
-> content_delete
-> Storage Flow
-> bounded publishable Artifact manifest

The temporary Crawl4AI reference is not an Agentstration StagedArtifact. It is intentionally local to the extension and expires. A Flow must transfer content through the governed staging Tools before handing it to a remote Agent, another Flow, or durable storage. On retry, content_delete is safe to repeat; an expired reference requires acquisition to restart.

The extension contributes the crawl4ai-web Data Source Profile bundle. The bundle contains the exact ToolSet, bounded chunk-transfer Flow, datasource.acquisition/v1 Flow, and Data Source Profile needed by this composition. Successful enrollment installs it through host-owned handlers at the exact extension-registration scope and retains immutable governance and installation evidence.

A resource conflict during application stops installation, records a failed bundle with diagnostics, and prevents enrollment from becoming available. Retrying enrollment after resolving the conflict reuses resources already installed by that bundle without duplicating their identities or published versions.

Failures retain the inventory of resources already created, including a Flow draft whose publication was interrupted. A retry verifies that evidence before completing missing publications. Re-enrollment of an installed bundle also checks the recorded inventory against the actual resources; identity, owner, version, generation, or definition drift produces an extension_bundle_* conflict and a degraded installation, without adopting or replacing the changed resource.

The Console distinguishes available, unavailable, not-materialized, and conflicting Tool contributions. Managed-resource links retain the owner scope and destination Console context. Data Source Profile lists and details distinguish the extension version from the bundle version and retain their read-only explanation while the extension is offline or unenrolled.

The resulting durable Artifact is independent of Knowledge. A Knowledge Source may later bind this Data Source and preserve the corpus unchanged through knowledge-projection-builtin, or apply an explicit artifact.transform/v1 Flow before projection.

Limits and destination policy​

SettingDefaultConstraint
AllowedDomainsnoneRequired; exact domains and their subdomains are accepted.
AllowedPorts80, 443Every requested and returned URL must use an allowed port.
AllowedMediaTypestext/html, text/markdownAccepted normalized content variants returned by Crawl4AI.
AllowPrivateAddressesfalseEnables approved RFC1918, shared-address, or IPv6 ULA targets; unsafe special ranges remain blocked.
MaximumDepth3Operator ceiling, from 0 through 10.
MaximumPages25Operator ceiling, from 1 through 500.
RequestTimeoutSeconds60Per Crawl4AI request, from 1 through 600 seconds.
MaximumResponseBytes8 MiBMaximum upstream JSON response.
MaximumContentBytes4 MiBMaximum UTF-8 content for one acquired page.
MaximumLinksPerPage250Maximum link candidates processed per page.
MaximumReadChunkBytes64 KiBMaximum decoded content returned by one read.
ContentRetentionMinutes60Sliding temporary-content retention, at most seven days.
MaximumSpoolBytes256 MiBTotal extension-local temporary content ceiling.

Every DNS result must satisfy the destination policy. The final URL reported by Crawl4AI is checked again, so a redirect cannot escape the allowlist. Crawl4AI itself must also retain its secure request boundary; this extension does not weaken or replace the crawler's SSRF controls.

/health reports extension liveness. /health/ready additionally probes the configured Crawl4AI service and returns 503 while it is unavailable. Acquisition errors expose stable crawl4ai_* codes and bounded diagnostics without returning credentials or complete upstream responses.