Skip to content

feat(ai): fetch page text with the Crawl4AI service #3887

Description

@dan-petty

Problem

No code in src fetches the text of a page for a model. firecrawl_search in src/devops_cli/ai/common_tools.py returns titles, URLs and descriptions. Once the Crawl4AI service runs, the project needs one client for it. A model chooses the page URL, so the client is an SSRF and prompt-injection boundary (SECURITY.md rules 2 and 11).

Expected

Setting crawl4ai.url with no default, and credential crawl4ai.api_token (from the token issue). A function that sends POST {crawl4ai.url}/md with the JSON body {"url": <page>, "f": "fit"} and the bearer token, through http_client(level=EgressLevel.PRIVATE). It checks the page URL first (scheme http or https; refuse hosts that is_non_public_ip and is_cloud_metadata_name of devops_cli.core.validation refuse). It caps the text in size and returns a typed result with the source URL, the fetch date and a truncated flag. It counts devops_cli_crawl4ai_fetches_total{result} (ok, the HTTP status, or error) and logs a failure without the token or the page query. With crawl4ai.url empty, it raises an error that names the setting. k8s/devops/configmap.example.yaml and the settings docs name the cluster value http://crawl4ai.devops.svc.cluster.local:11235.

Acceptance criteria

  • Tests with the HTTP fake (tests/support/fakes/http.py) fail on the base: a good call sends the bearer header and the body; a page URL with a private IP literal, a metadata name or a file: scheme is refused before any request; the text is cut at the cap with truncated true; HTTP 401, 403, 429 and 504 each give the counter label and a typed error; an empty setting raises an error that names crawl4ai.url.
  • The response shape of /md is read from deploy/docker/server.py at v0.9.5 and fixed in a test fixture. The issue's PR cites the line.
  • The generated settings and metrics docs (README.md) list the new setting and the counter.
  • No hand-written IP or regex check: the test names the existing predicates it relies on.

Existing tool considered

The project's http_client and its egress levels; the existing predicates of devops_cli.core.validation; Crawl4AI's /md endpoint. Rejected: the Crawl4AI Python package in-process (it brings Playwright and Chromium into the Service image); pydantic-ai web_fetch_tool (the project removed its own copy; it fetches without a browser, so JavaScript pages fail).

Related

Depends on the token issue for the credential name. Feeds the fetch_page tool issue and the devops ai fetch-page issue. Related: #3877, #3243.

Activity

  1. added
    source/agent
    type/feature
    scope/ai
    status/new
    value/high
    effort/medium
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/ai. The (ai) scope of the title gives the scope.
    • Priority: P2-Medium. Needed for the AI fetch-page workflow but blocked on the service deployment and token issue.
    • Value: High. Enables the model to read full page text, a core capability for the AI tools.
    • Effort: Medium. One client function with validation, metrics, settings, and a test suite; no new service or schema.
    • Related: feat(k8s): run Crawl4AI 0.9.5 in namespace devops #3884, which asks for a different change. Both concern Crawl4AI page fetching; #3884 delivers the k8s service, the candidate delivers the Python client that calls it.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 7, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 7, 2026
  5. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-07 12:23 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/aisource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions