Designing an Agentic Image Crawler

A product page offers the same bottle in blue and green. Its gallery contains photos of both, plus a logo and a sale banner. I can find every image address on the page. But which photo actually belongs to the selected blue bottle in this market? And will that answer still be right next week?

A fictional product page shows a selected blue bottle, a green option, and a mixed gallery of product photos, a logo, and a promotion.

That is the problem I want to solve. An image address is a lead, not a catalog fact. To turn it into a useful record, I need to know what product and variant the page showed, where it was offered, and why I think this photo belongs to it. If I cannot tell, I would rather say unknown than put the green bottle in the blue bottle’s record.

Start with a small, honest result

I would begin with one approved source and one market, not a nationwide fleet. The first output is a reviewable association: this product, this observed variant, this market, this candidate image, and the page evidence that connects them. That is deliberately different from a list of image addresses or a folder of downloaded files.

What I haveWhat it meansWhat is still missing
Image addressA page exposed a possible asset.Proof that it belongs to this variant and market.
Accepted associationThe match passed the evidence check.Image bytes, if the catalog actually needs a file.
Downloaded fileAn authorized asset worker retrieved the bytes.The file alone does not prove the product match or reuse rights.

The simplest version needs an approved source list, a way to discover product pages, a page worker, an evidence check, and a place to keep accepted records and unresolved cases. It also needs a small set of hand-labeled pages so I can count wrong matches and missing products. More pages fetched is not success if the matches are wrong.

Approved source and market pages flow through page workers to an evidence gate, which sends supported associations to a catalog and uncertain cases to review.

Read that overview from left to right. The worker gathers the page and its gallery. The evidence gate asks whether the selected product, variant, image, and market are actually connected. A supported association enters a versioned catalog. An ambiguous one stays out and goes to review. Downloading image bytes is a separate, permission-dependent step.

Let the page decide how much machinery it needs

I would not send every page to a browser or every image to a large language model (LLM). A publisher feed or an application programming interface (API) may already supply product and variant information. On a stable page, a Cascading Style Sheets (CSS) or XML Path Language (XPath) selector and structured product fields may be enough. If the gallery appears only after a click or scroll, a bounded browser interaction can expose it. Rendering helps me see the image; it does not tell me which variant owns it.

This is where Crawl4AI can help as a page worker. Its result can include HyperText Markup Language (HTML), page-wide image candidates in result.media["images"], links, Markdown, and structured extraction output. I would combine those surfaces with the observed variant selection, not accept a media score or alternative text as a match. An image might live on a separate content delivery network (CDN), so an external image address is not automatically irrelevant.

When I only need a product description for a model, I can remove navigation, advertising, headers, and footers with excluded_tags, or generate filtered Markdown with PruningContentFilterLXML. I would save the permitted page and gallery evidence first. A text filter can remove the very image link or variant label the decision depends on. In a small synthetic Crawl4AI 0.9.5 check, filtered Markdown lost a gallery link while result.media["images"] retained it. I would measure both the tokens saved and the evidence lost before choosing a filter.

Give the agent the exceptions, not the keys

Now imagine a product page where a selector finds only the logo. I would record an UNKNOWN_TEMPLATE or GALLERY_NOT_RENDERED failure, the page’s source and market, and the permitted snapshot. I would not mark the product as empty or ask a model to invent a photo.

An agent could inspect that saved observation and propose a better selector, an approved gallery click, or a review case. The application checks approved hosts, request limits, rights, and data-handling rules before doing anything on the web. A blocked source stays blocked. The model cannot add its own host or run arbitrary generated scripts against a publisher.

A clockwise four-step loop shows observing a gap, proposing one evidenced action, checking source and budget policy, and executing only approved work before validating the result.

There are two useful model paths, and I would keep them separate. For a changed but repeatable layout, Crawl4AI documents a schema-generation utility that can propose CSS or XPath selectors from captured HTML. I would test the proposed rule on other products, colors, and layouts, then reuse a validated rule without another model call on every page. For a genuinely ambiguous page, an LLM may instead suggest one image-to-variant match from a small, approved slice of the page. It must cite observed evidence; the validator checks that the variant and image were actually present. A well-formed JavaScript Object Notation (JSON) response is not proof.

The distinction matters at scale. If a site redesign breaks thousands of pages that share one template, I want one grouped repair, not thousands of independent model calls. A proposed repair is versioned, replayed against labeled pages, reviewed, and rolled out cautiously. If it still cannot distinguish blue from green, the association remains unknown. Ordinary extraction keeps running for unaffected sources.

Freshness means checking the right thing again

A crawler that got the blue bottle right once can still be wrong next week. The source may change the gallery, the market offering, or the image behind an unchanged address. I would track when the page, the association, and any downloaded asset were last verified separately. A Crawl4AI cache hit is not a new observation of the publisher, and a fresh product page does not prove that an image served by another host is unchanged.

The scheduler needs a due date for each approved source and page class, plus a shared request budget for each host. Product launches or trustworthy feed changes can move a check earlier. Quiet pages still need an audit sample. If a host is down or its request budget prevents a deadline, the record becomes visibly overdue, not magically current. A single missing image on one fetch is not enough to delete a previously accepted association; I would verify removals and preserve the history. Rights withdrawal follows its own policy and may require immediate suppression.

Only after a small pilot tells me how many pages are due, how many require rendering, and how long those renders take would I size more workers. For illustration, if a million pages were due in a day and retries added 20% more attempts, the average would be about 14 page attempts per second. That says nothing about a particular site’s allowed rate or the peak load. A distributed queue, shared host limits, and perhaps Kubernetes should be responses to measured bottlenecks, not the starting definition of success.

Put the whole design together

Here is how those parts fit together. The evidence gate separates a candidate image from a supported product-variant match, while the review path handles cases the page cannot settle.

Complete proposed image-crawler architecture: approved sources feed a due frontier and shared host policy, followed by ordinary page or Crawl4AI acquisition, saved observations, evidence validation, a versioned catalog, optional permitted asset retrieval, and a separate review and repair path with monitoring.

Follow the blue bottle through it: a scheduled, approved page passes the host check; a lightweight response or a Crawl4AI browser worker captures the selected variant and gallery; the evidence gate decides whether the blue photo has enough support. If so, the catalog keeps the association and its provenance. If not, the system records the gap for review. If someone actually needs image files, a separate worker can retrieve them only when permitted. A reviewed rule can help later pages, but it cannot rewrite past observations or bypass the evidence gate.

My first evaluation would compare the simple deterministic approach with targeted browser interactions and model-assisted exceptions on the same labeled pages. I would report correct and incorrect variant matches, missed eligible products, overdue records, time to repair a changed layout, browser time, model calls, and review effort. I would also test duplicate jobs, a failed worker, and a burst of template failures. That tells me whether the extra machinery improves the catalog or just makes the crawler busier.

Every complexity needs to be earned. The job is not to collect the largest image gallery. It is to make a product-image claim that I can inspect, update, and, when the evidence is missing, decline to make.