<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shahan Chowdhury on Medium]]></title>
        <description><![CDATA[Stories by Shahan Chowdhury on Medium]]></description>
        <link>https://medium.com/@codewithshahan?source=rss-f63fe8afc87------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*r_8KfC6qKRD6poO4HYXKNQ.jpeg</url>
            <title>Stories by Shahan Chowdhury on Medium</title>
            <link>https://medium.com/@codewithshahan?source=rss-f63fe8afc87------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:49:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@codewithshahan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Build a Self-Healing Web Data Pipeline with Bright Data and Node.js]]></title>
            <link>https://javascript.plainenglish.io/how-to-build-a-self-healing-web-data-pipeline-with-bright-data-and-node-js-d833427c4784?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/d833427c4784</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 18:49:29 GMT</pubDate>
            <atom:updated>2026-09-20T10:21:11.470Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>A practical guide to extracting, validating, and serving changing web data to AI agents/apps and RAG workflows.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*HJVRum-Cx6z9OMH3Lly9KA.png" /><figcaption>Image by <a href="https://medium.com/u/f63fe8afc87">Shahan Chowdhury</a></figcaption></figure><p>A scraper can succeed and still give you bad data.</p><p>A website can change its HTML, a selector can stop matching, or a scraper can return a partial record without throwing an obvious error. Your scraper may still report success while your application quietly stores <a href="https://javascript.plainenglish.io/how-to-bypass-anti-bot-walls-for-production-ready-apps-7de5bf0891b7">incorrect data.</a></p><p>That’s the problem this guide solves.</p><h3>🏗️ What we’re building</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9SP81YTite_bYzFlvbwdA.png" /><figcaption>Image by author: public raw web data → structured JSON → feed apps/AI agent/RAG</figcaption></figure><ul><li><strong>A Texas real-estate tracker</strong> that collects live <a href="https://www.har.com/">HAR.com</a> listings, filters them by city and bedrooms, and detects price changes over time.</li><li><strong>A reusable pipeline</strong> that separates web extraction from our application logic.</li><li><strong>A self-healing workflow</strong> that lets us repair the scraper without rewriting the Node.js pipeline when the target site’s structure changes.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8PpUoJnSgUs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8PpUoJnSgUs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8PpUoJnSgUs%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b20e11d22ee5b98f5bb6aa212120472/href">https://medium.com/media/2b20e11d22ee5b98f5bb6aa212120472/href</a></iframe><p>Concretely, we’ll build a Node.js pipeline that uses Bright Data<strong> </strong><a href="https://get.brightdata.com/ai-web-scraper-studio"><strong>Scraper Studio</strong></a> for web extraction while our application handles normalization, validation, deduplication, snapshots, and change detection.</p><p><em>🔎 Build your first prompt-based scraper in minutes using </em><a href="https://get.brightdata.com/ai-web-scraper-studio"><em>Scraper Studio AI Agent for Free.</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vt8sVwyvoyc63n97yUoTJQ.png" /></figure><p>Then we’ll point our pipeline at a real Texas real-estate domain, track listings across multiple runs, deliberately break the scraper, and repair it <a href="https://www.reddit.com/r/webdev/comments/1b8umsq/why_are_devs_obsessed_with_separation_of_concerns/">without changing the pipeline itself</a>.</p><p>🔗 The complete source code is available in my <a href="https://github.com/codewithshahan/self-healing-ai-data-pipeline">GitHub repository</a>. You can also download <a href="https://codewithshahan.gumroad.com/l/self-healing-web-data-pipeline"><strong>The Web Data Pipeline</strong></a> handbook for free:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*79yzclKp9xnR5xUyxyYuxg.png" /><figcaption>The Web Data Pipeline handbook</figcaption></figure><h3>1. The Web Data Pipeline Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2hO_z4KFpB42XBa2KN05sQ.png" /><figcaption>Data pipeline blueprint illustration by <a href="https://medium.com/u/f63fe8afc87">Shahan Chowdhury</a></figcaption></figure><p>Our project divides responsibilities into two layers:</p><ul><li><strong>The Infrastructure Layer. </strong>It handles proxies, browser fingerprints, CAPTCHAs, and heavy JavaScript rendering to turn unpredictable HTML into stateless structured data.</li><li><strong>The Pipeline Layer (Node.js App).</strong> It owns the application logic, validation, data state, and historical comparisons.</li></ul><p>For this guide specifically, the final outline looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2isEh06kdWWZkpl1" /><figcaption>Reusable data pipeline final architecture</figcaption></figure><p>Therefore, by following this <a href="https://en.wikipedia.org/wiki/Separation_of_concerns"><em>Separation of Concerns (SoC)</em></a><em> </em>principle, <strong><em>the same </em></strong><a href="https://www.reddit.com/r/dataengineering/comments/1ko8u01/best_practices_for_reusing_data_pipelines_across/"><strong><em>pipeline can be reused</em></strong></a><strong><em> </em></strong>for e-commerce, crypto rates, travel listings, job boards, and competitor/financial data monitoring; the list goes on.</p><h4>Two Non-negotiable Data Pipeline Rules</h4><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*VgtcY_UWpEpgtGIv" /></figure><p>In a scalable data pipeline, <em>neither </em>layer should depend on the other’s internal implementation details.</p><p>We achieve that with two rules.</p><p><strong>RULE 1: The stable data contract is the boundary</strong></p><p>Our Node.js application should NEVER depend on the target website&#39;s HTML or DOM structure.</p><p>Instead, the extraction layer produces data that conforms to a stable contract. The extraction adapter knows about the external source; our application knows about the contract.</p><p>For example, our application can work with:</p><pre>{<br>  &quot;address&quot;: &quot;string&quot;,<br>  &quot;price&quot;: 305000,<br>  &quot;bedrooms&quot;: 4<br>}</pre><p>It doesn&#39;t need to know whether those values came from a CSS selector, an AI-generated scraper, or another extraction system.</p><p>This is the practical idea behind the <a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><strong>Dependency Inversion Principle (DIP)</strong></a> and the <a href="https://scotthannen.org/blog/2024/07/29/hexagonal-ports-and-adapters-architecture-i.html"><strong>Ports and Adapters (Hexagonal)</strong></a><strong> </strong>approach: keep volatile external systems away from the core application logic.</p><blockquote><em>Grab my book: </em><a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><strong><em>Clean Code Zero to One</em></strong></a><em> to master those skills.</em></blockquote><p>Later, we&#39;ll implement this boundary with an adapter that maps source-specific data into our stable contract.</p><p><strong>RULE 2: The pipeline must be payload-agnostic</strong></p><p>A common mistake is coupling the processing pipeline to one specific dataset. For example, hardcoding the entire pipeline around:</p><pre>{<br>  &quot;address&quot;: &quot;string&quot;,<br>  &quot;price&quot;: &quot;number&quot;<br>}</pre><p>works for real estate, but becomes a problem when the same system needs to process products, jobs, news, or financial data.</p><p>The pipeline should therefore remain independent of <em>specific </em>payload keys. Its job is to handle common operations such as:</p><pre>ingest → normalize → validate → deduplicate → store → compare</pre><p>Source-specific rules belong in the adapter and validation level. That way, changing the data source does not require cloning the entire pipeline.</p><h3>2. Why Traditional Web Scrapers Break</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mOoorrKC6IIV5m6q" /></figure><p>When an AI industry or quantitative hedge fund needs to track market trends or competitor headcount shifts across platforms, they aren’t looking for <em>static web pages</em>; rather, they are hunting for massive, continuous datasets to feed predictive analytics systems, RAG engines, or LLM applications.</p><p>However, modern <em>Web Application Firewalls (WAFs)</em> like <a href="https://www.cloudflare.com/cloudflare-vs-akamai/">Cloudflare or Akamai</a> frequently issue “soft bans&quot;, returning fake HTTP 200 OKresponses that contain CAPTCHAs instead of data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*Y9Pr9zxoNGoIdoOEr5XP6Q.png" /><figcaption>Amazon’s HTTP 200 OK “soft trap”</figcaption></figure><p>Furthermore, the traditional scraper is a victim of three primary forces: <strong><em>fragile selectors, silent failures, and aggressive anti-bot systems</em>. </strong>When a dev writes a Playwright or Puppeteer script, they often rely on specific DOM paths. If the target site updates its UI, that selector vanishes.</p><p>Worst of all are the silent failures. The scraper doesn’t crash; it simply returns <em>null </em>for the price while successfully extracting the address. Your database is now being poisoned with partial records, a far more dangerous outcome than a hard crash.</p><h4>2.1. The extraction problem</h4><p>Anti-bot defenses can create another failure mode. Even when your headers look clean, making <em>too many requests</em> per second or scraping too aggressively from a single IP can trigger a site’s edge defenses. Instead of allowing the request to reach the site’s internal systems, the CDN can reject it with responses such as 503 Slow Down or 503 Service Unavailable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1OT-lDFIr9QKjBEBGKFGZA.png" /><figcaption>503 service unavailable</figcaption></figure><p>A managed scraper API, such as the <a href="https://get.brightdata.com/bypass-antibot-walls">Web Unlocker</a> or the <a href="https://get.brightdata.com/codewithshahan-scraping-browser">Scraping Browser API</a>, can auto-fix the 503 error. But getting past the security layer is only the <strong><em>first half of the problem</em></strong>.</p><p>Even when a handcrafted scraper successfully retrieves the page, the output may still be a messy, unstructured collection of nested strings. That output is difficult to reuse reliably across applications, AI agents, vector databases, and analytics systems.</p><p>You do not rise to the level of your application goals; you fall to the level of your data collection infrastructure.</p><p>The goal is therefore changing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mFSf6OLR98lEeZrR" /><figcaption>Static script vs Managed infrastructure illustration by <a href="https://medium.com/u/f63fe8afc87">Shahan Chowdhury</a></figcaption></figure><p>We are moving away from treating a scraper as a <strong><em>“static script”</em></strong> that we write and toward treating it as a <strong><em>“managed infrastructure”</em></strong> that we describe.</p><p>This change allows us to stop worrying about how the data is pulled and start focusing on what the data represents to our application logic.</p><h4>2.2. Turning a web page into structured data</h4><p>To see this transformation in practice, consider tracking the US real estate market using a <a href="https://www.zillow.com/seattle-wa/">Zillow Seattle</a> search page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4oz-gyAdPD-_NV4e" /></figure><p>This raw page contains property cards, filtering dropdowns, and pagination elements. Our backend application cannot consume this visual presentation directly. It requires a structured payload closer to this:</p><pre>{<br>  &quot;price&quot;: 1450000,<br>  &quot;bathrooms&quot;: 2,<br>  &quot;square_feet&quot;: 2230,<br>  &quot;address&quot;: &quot;2714 10th Avenue W&quot;,<br>  &quot;city&quot;: &quot;Seattle&quot;,<br>  &quot;zip_code&quot;: &quot;98119&quot;,<br>  &quot;status&quot;: &quot;Active&quot;<br>}</pre><p>That transformation is the first data engineering problem: turning a human-facing webpage into a reliable data payload.</p><p>To solve this, a traditional Playwright scraper might locate an element like this:</p><pre>const price = await page<br>.locator(&#39;[data-test=&quot;property-card-price&quot;]&#39;)<br>.textContent();</pre><p>Or perhaps the developer finds a class in the current HTML:</p><pre>const price = await page<br>.locator(&#39;.property-card-price&#39;)<br>.textContent();  </pre><p>Both approaches may work today. But they tightly couple the scraper to the site’s current HTML structure. When that structure changes, the selectors stop matching. Even worse, the scraper might not throw an obvious runtime error; it will simply pass silent null values down your pipeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NUu7k3ImmyTekE9P" /></figure><pre>{<br>  &quot;price&quot;: null,<br>  &quot;bedrooms&quot;: 4,<br>  &quot;bathrooms&quot;: 2<br>}</pre><p>Fortunately, <strong>that is manageable for <em>one </em>page</strong>. It becomes much harder when a traditional scraper needs to collect thousands of records.</p><h4>2.3. Scaling beyond a single page</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5eZjM_QvXWI5Qvsk1FH9hQ.png" /></figure><p>One property page is not the real challenge. A real estate or e-commerce application needs thousands of listings across cities, ZIP codes, and neighborhoods. Now the scraper has to deal with pagination, filtering, changing page structures, and thousands of individual records.</p><p>At this point, the HTML document is no longer the product. <strong>The data is the product.</strong></p><p>And that data still isn’t useful until we decide how the application will consume it. Instead of keeping raw HTML, we may want:</p><ul><li>JSON</li><li>CSV</li><li>database records</li><li>Data API responses</li><li>Webhook events</li><li>object storage</li></ul><p>The important question becomes:</p><blockquote><strong><em>How can I reliably turn changing web pages into structured data that our software can use?</em></strong></blockquote><p>This is where the responsibilities of the scraper and the application need to separate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x96XoccRuP5w7UXFIm0_fQ.png" /><figcaption>Scaling beyond a single page → Application</figcaption></figure><h4>2.4. From extracted data to application logic</h4><p>Once we start collecting useful data, a <em>completely </em>different set of engineering questions appears. These questions determine whether our system is simply collecting data or actually producing useful application logic.</p><p>For instance:</p><ul><li>Which records are new?</li><li>Which records changed?</li><li>What changed between two runs?</li><li>Can we reuse the same pipeline for another target or application?</li><li>How do we identify meaningful changes in historical data?</li></ul><p>Eventually, a user might ask:</p><p><em>“Find 3 bedroom houses under my budget that recently dropped in price and explain which ones look like the best opportunities.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W0vTS32eWn0If35W" /></figure><p>A scraper cannot answer that question. It only extracts today’s price and doesn’t know what that price was yesterday or whether the change is significant.</p><p>But our application does.</p><p>A scraper, even an advanced extraction system such as Scraper Studio, is very good at turning changing web pages into structured data, but they are <em>inherently </em>stateless.</p><p>This distinction becomes much clearer with this example. Our pipeline could determine:</p><p><em>“This product lost 31.27% of its value compared with yesterday and crossed a critical risk threshold.”</em></p><p>To achieve this, our application needs to remember yesterday’s price, compare the two values, calculate the change, and decide what that change means.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RgnXB4Agzvpa8rQtgckhNQ.png" /></figure><p>Ultimately, the real business value is <em>rarely </em>the raw extraction itself. It comes from the intelligence built around the data.</p><h4>2.5. The maintenance loop</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fhtIFCvzAlfsCFSx" /></figure><p>At this point, you might wonder why we don’t simply clone this existing repo and move on.</p><p>Because the goal isn’t just to make one scraper work. I want you to understand how the mechanism works under the hood and build each part yourself.</p><p>If you rely entirely on AI automation loops without understanding what happens underneath, you’ll eventually be lost in the ocean. You will stop working on the actual application and start debugging the extraction infrastructure again.</p><p>This creates a <strong>maintenance loop</strong>: an expensive cycle where developers spend hours debugging proxy routing, browser behavior, selectors, and DOM mutations instead of shipping application features.</p><h3>3. The Rise of Self-Healing AI-Native Scrapers</h3><p>To break the “maintenance loop&quot;, let’s compare the <strong><em>three most common approaches</em></strong><em> </em>developers use today:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9G6SJxIPJJnUT_FY" /></figure><ol><li><strong>DIY (</strong><a href="https://playwright.dev/"><strong>Playwright</strong></a><strong> / </strong><a href="https://www.scrapy.org/"><strong>Scrapy</strong></a><strong>).</strong> Take Weeks. You <a href="https://www.alekseialeinikov.com/en/blog/topics/programming/scraper-studio-vs-apify-vs-diy-2026">write the crawler</a>, wire up proxies, run headless browsers, handle queues, retries, and anti-bot.</li><li><a href="https://apify.com/"><strong>Apify</strong></a><strong>.</strong> Take days to weeks. You <a href="https://use-apify.com/docs/what-is-apify/apify-actors">build your own actor</a>, meaning writing the crawler, integrating a proxy, handling retries, and packaging it as an actor. Using a third-party actor from the <a href="https://apify.com/store">Apify Store</a> is faster, but you do not own the code.</li><li><a href="https://get.brightdata.com/ai-web-scraper-studio"><strong>Scraper Studio</strong></a><strong>.</strong> Take minutes per site. Describe the data you need in plain English, and its AI Agent can generate a scraper and output schema. You can then test and modify the generated JavaScript in the built-in IDE, or work with Bright Data through its CLI and <a href="https://docs.brightdata.com/quickstart-coding-agent">coding-agent</a> (Claude/Cursor) integrations by installing <a href="https://github.com/brightdata/skills">Bright Data skills</a> via npx skills add brightdata/skills.</li></ol><p>The important difference is <strong><em>how much of the extraction infrastructure you have to build and maintain yourself.</em></strong></p><h4>3.1. The Self-Healing Advantage</h4><p>Bright data has a unique one-click Self‑Healing feature for updating an existing scraper when its extraction logic becomes outdated. Plus, it’s AI-assisted scraper generation takes few minutes to crawl.</p><p><strong><em>Try generating your first </em></strong><a href="https://get.brightdata.com/ai-web-scraper-studio"><strong><em>prompt-based scraper using Scraper Studio here</em></strong></a><strong><em>.</em></strong></p><p>For example, without writing Playwright project and manually designing selectors, you can describe a task like</p><p>“Extract the property address, price, bedrooms, bathrooms, square footage, city, ZIP code, and listing status from this real-estate website.”</p><p>The AI agent will generate the scraper and <a href="https://docs.brightdata.com/products/scraper-studio/input-and-output-schema">schema</a>, which we can test and refine before running it. Scraper Studio can then be triggered through its interface, API, or scheduled runs.</p><p>If you don&#39;t like IDE, you can also run <a href="https://docs.brightdata.com/products/scraper-studio/build-with-the-cli">Bright Data CLI</a> locally. We’ll use that later when we deliberately break the scraper and repair it.</p><p>When a target site is redesigned and a scraper begins returning null or missing fields, you fix it in place using bdata scraper heal or using the built-in IDE&#39;s “Self-Healing&quot; feature like this:</p><pre>bdata scraper heal &lt;COLLECTOR_ID&gt; \<br>  &quot;The price field is returning null after the page redesign. \<br>   Extract the current price and currency from the new page structure.&quot;</pre><p>Because this process preserves the stable Collector ID, every API trigger, schedule, and integration keeps working without a single line of code being changed in our application layer.</p><p>This converts the <strong><em>“Maintenance Loop”</em></strong> from a hours-long engineering hurdle into a five-minute terminal command.</p><h4>3.2. Why Scraper Studio Fits Our Architecture</h4><p>At the beginning of this guide, we established two rules:</p><ol><li>The application trusts a stable data contract.</li><li>The pipeline remains payload-agnostic.</li></ol><p>Scraper Studio fits underneath those rules.</p><p><strong>We are not giving up control of our application</strong>. Our Node.js pipeline still owns the stable data contract. The extraction layer can change while the application layer remains stable.</p><p>That’s exactly the separation we designed in Section 1.</p><h4>3.2. What About Cost, Scale, and Concurrency</h4><p>Cost also depends on what the scraper properly loads. Bright Data currently lists <strong>5,000 page loads per month </strong>in the <a href="https://get.brightdata.com/ai-web-scraper-studio">free Scraper Studio tier</a> and <strong><em>$1.50 per 1,000 page loads on pay-as-you-go </em></strong>plan with unlimited concurrency.</p><p>Keep in mind that a page load is not necessarily the same as one output record. A single page can produce multiple records, so pagination and navigation behavior matter when estimating usage and cost.</p><p>We’ll see why this matters when we build the Texas real-estate tracker.</p><p>The main thing is, offloading these complexities means we don’t have to build, manage, or scale proxy pools and headless browsers ourselves. That gives us the architecture we really want.</p><p>Now let’s build it.</p><h3>4. Project Setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fC4NCtMOPw29domh" /></figure><p>Before building the pipeline logic, let’s create a small Node.js application that will eventually consume our scraped data.</p><p>We’ll keep the project modular so the same structure can be reused with other data sources later.</p><p>Open your terminal and create the project:</p><pre>mkdir self-healing-ai-data-pipeline<br>cd self-healing-ai-data-pipeline<br>git init<br>npm init -y</pre><p>Install the dependencies:</p><pre>npm install express dotenv<br>npm install -D nodemon</pre><p>Then open the project in VS Code:</p><pre>code .</pre><p>We’ll build the application incrementally instead of creating a large codebase upfront.</p><h4>Configure package.json</h4><p>Open package.json and configure the scripts and ECMAScript Module support:</p><pre>{<br>  &quot;type&quot;: &quot;module&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;node src/server.js&quot;,<br>    &quot;dev&quot;: &quot;nodemon src/server.js&quot;<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4030dr11aFtAjAP4" /></figure><p>The &quot;type&quot;: &quot;module&quot; setting allows us to use modern import and export syntax throughout the project.</p><h4>Add Environment Variables</h4><p>Create a .env file in the project root:</p><pre>PORT=3000<br>BRIGHTDATA_API_TOKEN=your_api_token<br>BRIGHTDATA_COLLECTOR_ID=your_collector_id</pre><p>We’ll use the Bright Data credentials later when we connect the application to Scraper Studio.</p><p>Also create a .gitignore file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*BdGYaEIYcXOknCoU" /></figure><pre>node_modules/<br>.env<br>.DS_Store<br>data/*.tmp</pre><p>This keeps local dependencies, environment variables, and temporary files out of Git.</p><h4>Create the Node.js Server</h4><p>Now create the following file: src/server.js</p><p>Add the initial server:</p><pre>import express from &quot;express&quot;;<br>import dotenv from &quot;dotenv&quot;;<br><br>dotenv.config();<br><br>const app = express();<br>const PORT = process.env.PORT || 3000;<br>app.get(&quot;/&quot;, (req, res) =&gt; {<br>  res.json({<br>    message: &quot;Self-healing AI Data Pipeline is Activated!&quot;<br>  });<br>});<br>app.listen(PORT, () =&gt; {<br>  console.log(`Pipeline running on port ${PORT}`);<br>});</pre><p>Start the development server:</p><pre>npm run dev</pre><p>You should see:</p><pre>Pipeline running on port 3000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qcZxxoWQg4bXufZi" /></figure><p>Open http://localhost:3000 in your browser.</p><p>You should get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*W5Qeb_Dwj3n-dY47" /></figure><pre>{<br>  &quot;message&quot;: &quot;Self-healing AI Data Pipeline is Activated!&quot;<br>}</pre><p>We are now ready to step away from the text editor and construct our remote infrastructure producer. No! Not yet; we need to build our house first: the pipeline prototype.</p><h3>5. Building the Pipeline Prototype</h3><p>Now that the Node.js application is running, let’s build the processing layer that sits behind it.</p><p>The goal is to keep this layer independent of any specific website or dataset. Instead of hardcoding fields such as bedrooms, symbol, or salary, we&#39;ll translate different source formats into one small internal contract:</p><pre>id<br>value<br>label</pre><p>The source-specific code will live in an adapter. The pipeline itself will only process this common structure.</p><h4>5.1 Design the Prototype Structure</h4><p>Create the required directories and modules:</p><p><strong>macOS/Linux:</strong></p><pre>mkdir -p src/api src/collectors src/pipeline src/storage/snapshots<br>mv src/server.js src/api/server.js<br>touch src/pipeline/normalize.js src/pipeline/validate.js src/pipeline/deduplicate.js src/pipeline/index.js src/collectors/mock.js</pre><p><strong>Windows PowerShell:</strong></p><pre>New-Item -ItemType Directory -Force src/api, src/collectors, src/pipeline, src/storage/snapshots<br>Move-Item -Path src/server.js -Destination src/api/server.js -Force<br><br>&#39;normalize.js&#39;, &#39;validate.js&#39;, &#39;deduplicate.js&#39;, &#39;index.js&#39; | ForEach-Object {<br>  New-Item -ItemType File -Force &quot;src/pipeline/$_&quot;<br>}<br><br>New-Item -ItemType File -Force src/collectors/mock.js</pre><p>Because the server has moved, update the development script in package.json:</p><pre>&quot;dev&quot;: &quot;nodemon src/api/server.js&quot;</pre><p>Our project now looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*QWEC_nMzbT9SgX50" /></figure><pre>self-healing-ai-data-pipeline/<br>├── src/<br>│   ├── api/<br>│   │   └── server.js<br>│   ├── collectors/<br>│   │   └── mock.js<br>│   ├── pipeline/<br>│   │   ├── normalize.js<br>│   │   ├── validate.js<br>│   │   ├── deduplicate.js<br>│   │   └── index.js<br>│   └── storage/<br>│       └── snapshots/<br>├── .env<br>├── .gitignore<br>└── package.json</pre><h4>5.2 Normalize the Data</h4><p>The normalizer converts messy source values into the types expected by our internal contract.</p><p>For example, a scraper might return $502,000 as a string. Our application should receive 502000 as a number.</p><p>Open:</p><p>src/pipeline/normalize.js</p><p>Add:</p><pre>/**<br> * Strips formatting artifacts and typecasts values to strict numeric floats.<br> */<br><br>export function toNumber(value) {<br>  if (value === null || value === undefined) return null;<br>  const cleaned = String(value).replace(/,/g, &quot;&quot;).replace(/[^0-9.]/g, &quot;&quot;);<br>  if (!cleaned) return null;<br>  const number = Number(cleaned);<br>  return Number.isFinite(number) ? number : null;<br>}<br><br>/**<br> * Normalizes an individual raw payload token into our unified application envelope.<br> */<br><br>export function normalizeRecord(record, index) {<br>  return {<br>    id: record.id ?? `entity-${index + 1}`,<br>    value: toNumber(record.value),<br>    label: typeof record.label === &quot;string&quot; ? record.label.replace(/\s+/g, &quot; &quot;).trim() : &quot;Untitled Entry&quot;,<br>    captured_at: new Date().toISOString()<br>  };<br>}<br><br>export function normalizeCollection(records) {<br>  if (!Array.isArray(records)) return [];<br>  return records.map((record, index) =&gt; normalizeRecord(record, index));<br>}</pre><p>The key part is that the rest of the application no longer needs to understand how the original value was formatted.</p><h4>5.3 Validate the Contract</h4><p>Normalization gives us a consistent shape, but consistent shape does not necessarily mean valid data.</p><p>The validator acts as the integrity gate before records continue through the pipeline.</p><p>Open:</p><p>src/pipeline/validate.js</p><p>Add:</p><pre>/**<br> * Evaluates core schema boundaries for an individual normalized record.<br>*/<br><br>export function validateRecord(record) {<br>  const infractions = [];<br><br>  if (!record.id || record.id.startsWith(&quot;entity-&quot;)) {<br>    infractions.push(&quot;Contract Failure: Missing primary unique identification parameter.&quot;);<br>  }<br>  if (record.value === null || record.value &lt;= 0) {<br>    infractions.push(&quot;Contract Failure: Invalid or zero numeric metric value.&quot;);<br>  }<br><br>  return {<br>    valid: infractions.length === 0,<br>    errors: infractions<br>  };<br>}<br><br>export function validateCollection(records) {<br>  if (!Array.isArray(records)) return [];<br>  return records.map((record) =&gt; ({<br>    record,<br>    ...validateRecord(record)<br>  }));<br>}</pre><p>Invalid records are not allowed to silently continue. Instead, the validation result tells us which records passed and which need attention.</p><h4>5.4 Remove Duplicate Records</h4><p>Next, we need to prevent the same entity from appearing multiple times in a collection.</p><p>Open: src/pipeline/deduplicate.js</p><p>Add:</p><pre>/**<br> * Filters out duplicate records from the collection using our unique identifier.<br>*/<br><br>export function deduplicateCollection(records) {<br>  if (!Array.isArray(records)) return [];<br>  const uniqueKeys = new Set();<br><br>  return records.filter((record) =&gt; {<br>    if (uniqueKeys.has(record.id)) return false;<br>    uniqueKeys.add(record.id);<br>    return true;<br>  });<br>}</pre><p>The Set gives us a simple in-memory lookup for identifiers we&#39;ve already seen.</p><h4>5.5 Compose the Pipeline</h4><p>Now combine the individual processing stages into one entry point.</p><p>Open: src/pipeline/index.js</p><p>Add:</p><pre>import { normalizeCollection } from &quot;./normalize.js&quot;;<br>import { deduplicateCollection } from &quot;./deduplicate.js&quot;;<br>import { validateCollection } from &quot;./validate.js&quot;;<br><br>/**<br> * Runs raw extraction arrays through our universal processing middle tier.<br> */<br>export function processRawIngestion(rawData) {<br>  const normalized = normalizeCollection(rawData);<br>  const unique = deduplicateCollection(normalized);<br>  const validationReport = validateCollection(unique);<br><br>  const cleanRecords = validationReport.filter(item =&gt; item.valid).map(item =&gt; item.record);<br>  const quarantineRecords = validationReport.filter(item =&gt; !item.valid);<br><br>  return {<br>    pipeline_state: quarantineRecords.length &gt; 0 ? &quot;WARNING&quot; : &quot;HEALTHY&quot;,<br>    telemetry: {<br>      raw_processed: normalized.length,<br>      purged_duplicates: normalized.length - unique.length,<br>      passed_compliance: cleanRecords.length,<br>      failed_compliance: quarantineRecords.length<br>    },<br>    data: cleanRecords,<br>    quarantine: quarantineRecords<br>  };<br>}</pre><p>Our processing flow is now:</p><pre>Raw Data<br>   ↓<br>Normalize<br>   ↓<br>Deduplicate<br>   ↓<br>Validate<br>   ↓<br>Clean Records + Quarantine</pre><p>This is deliberately small. Each stage has one responsibility, and the pipeline does not know where the data originally came from.</p><h4>5.6 Test Multiple Data Sources</h4><p>Now let’s prove that idea. Create three small mock datasets in: src/collectors/mock.js</p><p>Each source uses completely different field names:</p><pre>// Test Datasets mimicking HAR, Yahoo Finance, and RemoteOK raw fields<br><br>const rawHarPayload = [{ &quot;id&quot;: &quot;har-992&quot;, &quot;price&quot;: &quot;$502,000&quot;, &quot;address&quot;: &quot;2623 Pomeran Dr&quot; }];<br>const rawYahooPayload = [{ &quot;symbol&quot;: &quot;AAPL&quot;, &quot;price&quot;: &quot;$234.12&quot;, &quot;company_name&quot;: &quot;Apple Inc.&quot; }];<br>const rawRemoteOkPayload = [{ &quot;job_id&quot;: &quot;remote-77&quot;, &quot;salary&quot;: &quot;$185,000&quot;, &quot;position&quot;: &quot;Software Engineer&quot; }];<br><br>/**<br> * Universal Source Adapter Layer translating source-specific <br>fields to our pipeline interface<br> */<br><br>export function getAdaptedMockSource(source) {<br>  if (source === &quot;har&quot;) {<br>    return rawHarPayload.map(item =&gt; ({ id: item.id, value: item.price, label: item.address }));<br>  }<br>  if (source === &quot;yahoo&quot;) {<br>    return rawYahooPayload.map(item =&gt; ({ id: item.symbol, value: item.price, label: item.company_name }));<br>  }<br>  if (source === &quot;remoteok&quot;) {<br>    return rawRemoteOkPayload.map(item =&gt; ({ id: item.job_id, value: item.salary, label: item.position }));<br>  }<br>  return null;<br>}</pre><p>Notice what happened here.</p><p>HAR uses price and address.</p><p>Yahoo Finance uses symbol and company_name.</p><p>RemoteOK uses salary and position.</p><p>The pipeline doesn’t care.</p><p>The adapter translates each source into:</p><pre>{<br>  &quot;id&quot;: &quot;...&quot;,<br>  &quot;value&quot;: &quot;...&quot;,<br>  &quot;label&quot;: &quot;...&quot;<br>}</pre><p>That is the Adapter Strategy we designed earlier in action.</p><h4>5.7 Connect the Pipeline to Express</h4><p>Now expose the pipeline through a small test endpoint.</p><p>Open: src/api/server.js</p><p>Replace the initial server with:</p><pre>import express from &quot;express&quot;;<br>import dotenv from &quot;dotenv&quot;;<br>import { getAdaptedMockSource } from &quot;../collectors/mock.js&quot;;<br>import { processRawIngestion } from &quot;../pipeline/index.js&quot;;<br><br>dotenv.config();<br><br>const app = express();<br>app.use(express.json());<br><br>const PORT = process.env.PORT || 3000;<br><br>app.get(&quot;/api/pipeline/test-mock&quot;, (req, res) =&gt; {<br>  const source = req.query.source; // har, yahoo, or remoteok<br>  const adaptedPayload = getAdaptedMockSource(source);<br><br>  if (!adaptedPayload) {<br>    return res.status(400).json({ error: &quot;Invalid source flag configuration.&quot; });<br>  }<br><br>  try {<br>    const processingResult = processRawIngestion(adaptedPayload);<br>    res.json({<br>      status: &quot;success&quot;,<br>      pipeline_telemetry: processingResult.telemetry,<br>      results: processingResult.data<br>    });<br>  } catch (err) {<br>    res.status(500).json({ error: err.message });<br>  }<br>});<br><br>app.listen(PORT, () =&gt; console.log(`Pipeline server online on port: ${PORT}`));<br><br></pre><h4>5.8 Test the Prototype</h4><p>Start the server:</p><pre>npm run dev</pre><p>Then test each source:</p><pre>curl &quot;http://localhost:3000/api/pipeline/test-mock?source=har&quot;</pre><pre>curl &quot;http://localhost:3000/api/pipeline/test-mock?source=yahoo&quot;</pre><pre>curl &quot;http://localhost:3000/api/pipeline/test-mock?source=remoteok&quot;</pre><p>Each request passes through the same pipeline.</p><p>For example, the “Remoteok” request produces a normalized record similar to:</p><pre>{<br>  &quot;status&quot;: &quot;success&quot;,<br>  &quot;pipeline_telemetry&quot;: {<br>    &quot;raw_processed&quot;: 1,<br>    &quot;purged_duplicates&quot;: 0,<br>    &quot;passed_compliance&quot;: 1,<br>    &quot;failed_compliance&quot;: 0<br>  },<br>  &quot;results&quot;: [<br>    {<br>      &quot;id&quot;: &quot;remote-77&quot;,<br>      &quot;value&quot;: 18500,<br>      &quot;label&quot;: &quot;Software engineer&quot;<br>    }<br>  ]<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*UyvOLGCAuAMHOVvv" /><figcaption>Terminal output: prototype testing</figcaption></figure><p>We’ve now proven the core architectural idea: <strong>different source payloads can enter the same processing pipeline without changing the pipeline code.</strong></p><p>The adapter handles source-specific structure. The pipeline handles application-level processing.</p><p>That separation will become vital when we replace these mock collectors with real web data.</p><h4>5.9 Commit the Prototype</h4><p>The prototype is working, so commit the current state:</p><pre>git add .<br>git commit -m &quot;Add reusable pipeline prototype with mock sources&quot;</pre><p>We now have a working processing core.</p><p>Next, we’ll replace the mock source with the real web-data extraction layer.</p><h3>6. Teaching Our Pipeline to Remember</h3><p>Our business goal is not just to collect the current state of a website. We want to track how that state changes over time.</p><p>Look at a simple example:</p><p><strong>Yesterday:</strong> House A — $500,000<br><strong>Today:</strong> House A — $450,000</p><p>How does the scraper know the price dropped?</p><p><strong>It doesn’t.</strong></p><p>A scraper normally sees the current page. Remembering what happened during previous runs is the responsibility of our application.</p><h4>6.1. Why a Scraper Run Is Stateless</h4><p>As we discussed this concept earlier, a scraper sees the current state of a page:</p><pre>House A → $450,000</pre><p>The previous crawl is not automatically available to the next run.</p><p>This is where our pipeline needs to add state. We’ll store the result of the previous run as a local snapshot. When a new run completes, we’ll compare the new dataset against that snapshot.</p><p>The basic flow looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*yAQr3qz7mtt_BPEN" /></figure><pre>Current Run<br>     ↓<br>Processed Records<br>     ↓<br>latest_snapshot.json<br>     ↑<br>Previous Run<br>     ↓<br>Compare<br>     ↓<br>Created / Updated / Removed</pre><ul><li><strong>Created:</strong> A new listing appeared.</li><li><strong>Updated:</strong> An existing listing changed, such as a price drop.</li><li><strong>Removed:</strong> A previously tracked listing is no longer present.</li></ul><p>For these comparisons, we’ll use JavaScript Map objects later in the pipeline. This gives us linear O(N) comparison work rather than repeatedly scanning the entire dataset for every record.</p><p>We don’t need a database server for this prototype. A local JSON snapshot is enough to demonstrate the state-management layer before introducing more infrastructure.</p><h4>6.2. Create Local Snapshot Storage</h4><p>The storage directory already exists from our project structure. Now create the snapshot module:</p><pre>mkdir -p src/storage/snapshots<br>touch src/pipeline/snapshot.js</pre><p>Open src/pipeline/snapshot.js.</p><p>We’ll use Node.js’s native asynchronous fs/promises API to read and write the snapshot file.</p><p>Add:</p><pre>import fs from &quot;node:fs/promises&quot;;<br>import path from &quot;node:path&quot;;<br><br>const snapshotDir = path.join(<br>  process.cwd(),<br>  &quot;src&quot;,<br>  &quot;storage&quot;,<br>  &quot;snapshots&quot;<br>);<br><br>const snapshotFile = path.join(<br>  snapshotDir,<br>  &quot;latest_snapshot.json&quot;<br>);<br><br>/**<br> * Saves the processed dataset to local disk.<br> */<br>export async function saveSnapshot(records) {<br>  try {<br>    await fs.mkdir(snapshotDir, { recursive: true });<br><br>    await fs.writeFile(<br>      snapshotFile,<br>      JSON.stringify(records, null, 2),<br>      &quot;utf8&quot;<br>    );<br><br>    return true;<br>  } catch (err) {<br>    console.error(<br>      `[Snapshot Write Failure] Disk IO stalled: ${err.message}`<br>    );<br><br>    return false;<br>  }<br>}<br><br>/**<br> * Loads the previous snapshot into memory.<br> */<br>export async function loadSnapshot() {<br>  try {<br>    const rawBuffer = await fs.readFile(<br>      snapshotFile,<br>      &quot;utf8&quot;<br>    );<br><br>    return JSON.parse(rawBuffer);<br>  } catch (notFoundError) {<br>    // Return an empty array when no previous snapshot exists.<br>    return [];<br>  }<br>}</pre><p>There are only two duties here:</p><p>saveSnapshot() writes the latest processed records to disk.</p><p>loadSnapshot() retrieves the previous snapshot when the next pipeline run starts.</p><p>On the first run, there is no previous snapshot, so loadSnapshot() simply returns an empty array.</p><h4>6.3. Test Snapshot Persistence</h4><p>Before using snapshots for change detection, let’s verify that our storage layer can actually write and read data.</p><p>Open:</p><p>src/api/server.js</p><p>For this isolated storage test, use:</p><pre>import express from &quot;express&quot;;<br>import dotenv from &quot;dotenv&quot;;<br>import { saveSnapshot } from &quot;../pipeline/snapshot.js&quot;;<br><br>dotenv.config();<br><br>const app = express();<br>app.use(express.json());<br><br>const PORT = process.env.PORT || 3000;<br><br>app.get(&quot;/health&quot;, (req, res) =&gt; res.json({ status: &quot;ok&quot; }));<br><br>// Snapshot Persistence Verification Route<br>app.post(&quot;/api/save&quot;, async (req, res) =&gt; {<br>  const records = req.body.records;<br><br>  if (!Array.isArray(records)) {<br>    return res.status(400).json({<br>      error: &quot;Invalid Payload: Input must be a &#39;records&#39; array.&quot;<br>    });<br>  }<br><br>  // Basic inline mapping to standardize test elements instantly inside server context<br>  const standardized = records.map((item, idx) =&gt; ({<br>    id: item.id ?? `id-${idx + 1}`,<br>    value: Number(<br>      String(item.value ?? item.price ?? &quot;&quot;)<br>        .replace(/[^0-9.]/g, &quot;&quot;)<br>    ),<br>    label: item.label ?? item.address ?? &quot;Untitled Entry&quot;<br>  }));<br><br>  const successfullySaved = await saveSnapshot(standardized);<br><br>  if (!successfullySaved) {<br>    return res.status(500).json({<br>      error: &quot;Failed to persist snapshot container to disk.&quot;<br>    });<br>  }<br><br>  res.json({<br>    message: &quot;Snapshot saved successfully.&quot;,<br>    record_count: standardized.length<br>  });<br>});<br><br>app.listen(PORT, () =&gt;<br>  console.log(`Pipeline server listening on port: ${PORT}`)<br>);</pre><p>Reload the program:</p><pre>npm run dev</pre><p>Open a second PowerShell window and create a test payload:</p><pre>$TestData = @{<br>  records = @(<br>    @{<br>      id = &quot;123&quot;<br>      price = &quot;$450,000&quot;<br>      address = &quot;2623 Pomeran Dr&quot;<br>    }<br>  )<br>} | ConvertTo-Json -Depth 10 -Compress</pre><p>Send it to the local endpoint:</p><pre>Invoke-RestMethod `<br>  -Uri &quot;http://127.0.0.1:3000/api/save&quot; `<br>  -Method POST `<br>  -Headers @{&quot;Content-Type&quot;=&quot;application/json&quot;} `<br>  -Body $TestData</pre><p>You should receive a successful response confirming that the snapshot was saved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*1Nd30frdHBuFDO9i" /></figure><p>Now verify the actual file on disk:</p><pre>Get-Content .\src\storage\snapshots\latest_snapshot.json</pre><p>You should see the stored canonical record:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*vr37z5YxkRkapzkv" /><figcaption>Snapshot memory output inside src/snapshots/latest_snapshot.json</figcaption></figure><p>🧠😎 Our pipeline now has memory.</p><p>The scraper can continue to focus on extraction. The application owns the historical state.</p><p>And that gives us the missing piece for the next step: <strong>comparing two snapshots to determine exactly what changed.</strong></p><h3>7. Detecting Historical Changes</h3><p>Now that our pipeline can remember the previous run, we can finally answer the question we started with:</p><p><strong>What changed since the last crawl?</strong></p><p>Consider these two snapshots:</p><p><strong>Yesterday:</strong></p><pre>House A → $500,000<br>House B → $350,000</pre><p><strong>Today:</strong></p><pre>House A → $450,000<br>House B → $350,000<br>House C → $600,000</pre><p>A human can immediately spot three different states:</p><ul><li><strong>House A:</strong> The price changed from $500,000 to $450,000.</li><li><strong>House B:</strong> The value stayed unchanged.</li><li><strong>House C:</strong> A new listing appeared.</li></ul><p>Our pipeline needs to detect those states programmatically.</p><p>We’ll represent them with three arrays:</p><ul><li>created[] — records that exist today but not in the previous snapshot.</li><li>updated[] — records that exist in both snapshots but whose tracked value changed.</li><li>removed[] — records that existed previously but are missing from today&#39;s dataset.</li></ul><h4>7.1 Building the Dataset Comparison Engine</h4><p>Create:</p><p>src/pipeline/compare.js</p><p>We could compare every incoming record against every historical record using nested loops. That approach can reach O(N²) time complexity as the dataset grows.</p><p>Instead, we’ll index both datasets by their unique IDs using JavaScript Map.</p><p>Building the maps takes O(N), and each lookup is approximately O(1), allowing the overall comparison to remain O(N).</p><p>Add the following to src/pipeline/compare.js:</p><pre>/**<br> * Executes a delta analysis between two historical runs.<br> *<br> * @param {Array&lt;Object&gt;} yesterdayBaseline - Previous snapshot.<br> * @param {Array&lt;Object&gt;} todayIncoming - Current dataset.<br> * @returns {Object} Created, updated, and removed records.<br> */<br><br>export function computeHistoricalDelta(yesterdayBaseline, todayIncoming) {<br>  // Guard against malformed parameters to keep processing loops safe<br>  const baselineArray = Array.isArray(yesterdayBaseline) ? yesterdayBaseline : [];<br>  const incomingArray = Array.isArray(todayIncoming) ? todayIncoming : [];<br><br>  // Pre-index collections into highly efficient O(1) maps to avoid O(N^2) array scan stalls<br>  const baselineMap = new Map(baselineArray.map(item =&gt; [item.id, item]));<br>  const incomingMap = new Map(incomingArray.map(item =&gt; [item.id, item]));<br><br>  const created = [];<br>  const updated = [];<br>  const removed = [];<br><br>  // Stage 1: Isolate additions and modifications by scanning today&#39;s fresh input keys<br>  for (const [id, incomingItem] of incomingMap.entries()) {<br>    const historicalItem = baselineMap.get(id);<br><br>    // If item doesn&#39;t exist in baseline, it&#39;s a new lifecycle record<br>    if (!historicalItem) {<br>      created.push(incomingItem);<br>      continue;<br>    }<br><br>    // Identify value metric variance since the previous system sweep<br>    if (incomingItem.value !== historicalItem.value) {<br>      const numericDelta = incomingItem.value - historicalItem.value;<br><br>      // Senior Practice: Guard against division-by-zero crashes if historical value is 0<br>      const baseDivisor = historicalItem.value === 0 ? 1 : historicalItem.value;<br>      const percentageShift = (numericDelta / baseDivisor) * 100;<br><br>      updated.push({<br>        id,<br>        label: incomingItem.label,<br>        previous_value: historicalItem.value,<br>        current_value: incomingItem.value,<br>        delta: numericDelta,<br>        // Safely invoke toFixed now that non-finite Infinity properties are blocked<br>        percent_change: Number(percentageShift.toFixed(2))<br>      });<br>    }<br>  }<br><br>  // Stage 2: Isolate deletions by verifying which historical items are missing today<br>  for (const [id, historicalItem] of baselineMap.entries()) {<br>    if (!incomingMap.has(id)) {<br>      removed.push(historicalItem);<br>    }<br>  }<br><br>  return { created, updated, removed };<br>}</pre><p>The algorithm has two passes. The first scans today’s records to find <strong>created</strong> and <strong>updated</strong> entries.</p><p>The second scans yesterday’s records to find <strong>removed</strong> entries.</p><p>For our real estate tracker, this gives us a clean delta such as:</p><pre>{<br>  &quot;created&quot;: [&quot;House C&quot;],<br>  &quot;updated&quot;: [&quot;House A&quot;],<br>  &quot;removed&quot;: []<br>}</pre><p>The actual updated records also contain the previous value, current value, absolute delta, and percentage change. That information will become useful when we classify significant changes.</p><h4>7.2 Testing the Comparison Engine</h4><p>Let’s connect the comparison engine to a temporary Express endpoint and test it against two simulated crawl runs.</p><p>Open:</p><p>src/api/server.js</p><p>Use:</p><pre>import express from &quot;express&quot;;<br>import dotenv from &quot;dotenv&quot;;<br>import { saveSnapshot, loadSnapshot } from &quot;../pipeline/snapshot.js&quot;;<br>import { computeHistoricalDelta } from &quot;../pipeline/compare.js&quot;;<br><br>dotenv.config();<br><br>const app = express();<br>app.use(express.json());<br><br>const PORT = process.env.PORT || 3000;<br>app.get(&quot;/health&quot;, (req, res) =&gt; res.json({ status: &quot;ok&quot; }));<br><br>// Delta Analysis Local Verification Route<br>app.post(&quot;/api/analyze&quot;, async (req, res) =&gt; {<br>  const incomingRecords = req.body.records;<br>  if (!Array.isArray(incomingRecords)) {<br>    return res.status(400).json({ error: &quot;Invalid Payload: Must pass an array of &#39;records&#39;.&quot; });<br>  }<br><br>  try {<br>    // 1. Fetch yesterday&#39;s snapshot reference state from local disk storage<br>    const historicalBaseline = await loadSnapshot();<br>    // 2. Compute mutations across lifecycle boundaries via our comparison engine<br>    const deltaAnalysis = computeHistoricalDelta(historicalBaseline, incomingRecords);<br>    // 3. Update local snapshot file to save today&#39;s records as tomorrow&#39;s baseline<br>    await saveSnapshot(incomingRecords);<br>    res.json({<br>      created: deltaAnalysis.created.length,<br>      updated: deltaAnalysis.updated.length,<br>      removed: deltaAnalysis.removed.length,<br>      raw_deltas: deltaAnalysis<br>    });<br>  } catch (error) {<br>    res.status(500).json({ error: error.message });<br>  }<br>});<br><br>app.listen(PORT, () =&gt; console.log(`Pipeline running on port: ${PORT}`));</pre><p>Reload the server:</p><pre>npm run dev</pre><p>We’ll use PowerShell to mimic two separate crawl executions.</p><p>First, seed the snapshot with yesterday’s data:</p><pre>$BaselineData = @{<br>  records = @(<br>    @{ id = &quot;A&quot;; value = 500000; label = &quot;House A&quot; },<br>    @{ id = &quot;B&quot;; value = 350000; label = &quot;House B&quot; }<br>  )<br>} | ConvertTo-Json -Depth 5 -Compress</pre><p>Send it to the analysis endpoint:</p><pre>Invoke-RestMethod `<br>  -Uri &quot;http://127.0.0.1:3000/api/analyze&quot; `<br>  -Method POST `<br>  -Headers @{&quot;Content-Type&quot;=&quot;application/json&quot;} `<br>  -Body $BaselineData</pre><p>This creates our baseline snapshot.</p><p>Now recreate today’s crawl:</p><pre>$TodayData = @{<br>  records = @(<br>    @{ id = &quot;A&quot;; value = 450000; label = &quot;House A&quot; },<br>    @{ id = &quot;B&quot;; value = 350000; label = &quot;House B&quot; },<br>    @{ id = &quot;C&quot;; value = 600000; label = &quot;House C&quot; }<br>  )<br>} | ConvertTo-Json -Depth 5 -Compress</pre><p>Send it through the same endpoint:</p><pre>Invoke-RestMethod `<br>  -Uri &quot;http://127.0.0.1:3000/api/analyze&quot; `<br>  -Method POST `<br>  -Headers @{&quot;Content-Type&quot;=&quot;application/json&quot;} `<br>  -Body $TodayData</pre><h4>Success Result</h4><p>The backend loads the previous snapshot, compares it with today’s records, and then saves today’s dataset as the new baseline.</p><p>You should see counts similar to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*P8FmLL3uwuTGW8iN" /></figure><pre>created : 1<br>updated : 1<br>removed : 0</pre><p><strong><em>Note:</em></strong><em> I run the seeding scripts two times during local testing; that&#39;s why the terminal is showing “</em><em>created: 2&quot;</em></p><p>The detailed response should identify House C as created and House A as updated.</p><p>There’s an important detail here.</p><p>After the request finishes, today’s dataset becomes latest_snapshot.json.</p><p>That means the next execution will compare against <strong>today</strong>, not the original baseline.</p><p>This is what turns a simple file into a rolling state mechanism:</p><pre>Run 1<br>   ↓<br>Snapshot A<br><br>Run 2<br>   ↓<br>Compare against Snapshot A<br>   ↓<br>Save Snapshot B<br>Run 3<br>   ↓<br>Compare against Snapshot B<br>   ↓<br>Save Snapshot C</pre><p>Our pipeline can now detect historical changes.</p><p>But not every change deserves the same response.</p><p>A $5,000 price adjustment and a 90% price collapse are both technically updated events, but they shouldn&#39;t necessarily receive the same treatment.</p><p>That’s where event classification comes in.</p><h4>7.3 Classifying System Events</h4><p>For this prototype, we’ll classify value changes using configurable thresholds.</p><p>These numbers are our example thresholds, not universal rules:</p><ul><li>Under 15% —<strong> </strong><strong>MINOR:</strong> Small change that may not require immediate attention.</li><li>15% to under 30% —<strong> </strong><strong>MAJOR:</strong> Significant change worth monitoring.</li><li>30% or more downward — <strong>CRITICAL:</strong> Large negative change that should be investigated.</li></ul><p>A large change could be a genuine business event, but it could also indicate an upstream extraction problem. The classification layer doesn’t decide which one it is. It simply makes the change visible and machine-readable.</p><p>Go to: src/pipeline/classify.js</p><p>Add:</p><pre>/**<br> * Classifies calculated deltas into structured system events.<br> *<br> * @param {Object} deltas - Created, updated, and removed records.<br> * @returns {Array&lt;Object&gt;} Structured event timeline.<br> */<br><br>export function classifySystemEvents(deltas) {<br>  const alertsTimeline = [];<br><br>// Process value changes.<br>  for (const change of deltas.updated) {<br>    let severity = &quot;MINOR&quot;;<br>    let type = &quot;VALUE_MUTATED&quot;;<br>    const absoluteShift = Math.abs(<br>      change.percent_change<br>    );<br>    if (absoluteShift &gt;= 15 &amp;&amp; absoluteShift &lt; 30) {<br>      severity = &quot;MAJOR&quot;;<br>      type = &quot;SIGNIFICANT_VALUE_SHIFT&quot;;<br>    }<br>    if (change.percent_change &lt;= -30) {<br>      severity = &quot;CRITICAL&quot;;<br>      type = &quot;ANOMALOUS_VALUE_COLLAPSE&quot;;<br>    }<br>    alertsTimeline.push({<br>      id: change.id,<br>      type,<br>      severity,<br>      message: `${change.label} (ID: ${change.id}) shifted by ${change.percent_change}%.`,<br>      details: change<br>    });<br>  }<br>  // Process newly created records.<br>  for (const record of deltas.created) {<br>    alertsTimeline.push({<br>      id: record.id,<br>      type: &quot;RECORD_CREATED&quot;,<br>      severity: &quot;MINOR&quot;,<br>      message: `New entry mapped to tracking logs: ${record.label}`,<br>      details: record<br>    });<br>  }<br>  // Process removed records.<br>  for (const record of deltas.removed) {<br>    alertsTimeline.push({<br>      id: record.id,<br>      type: &quot;RECORD_DELETED&quot;,<br>      severity: &quot;MINOR&quot;,<br>      message: `Entry removed from upstream dataset: ${record.label}`,<br>      details: record<br>    });<br>  }<br>  return alertsTimeline;<br>}</pre><p>Now the pipeline doesn’t just say:</p><pre>House A changed.</pre><p>It can produce a structured event:</p><pre>{<br>  &quot;id&quot;: &quot;A&quot;,<br>  &quot;type&quot;: &quot;ANOMALOUS_VALUE_COLLAPSE&quot;,<br>  &quot;severity&quot;: &quot;CRITICAL&quot;<br>}</pre><p>That distinction becomes valuable when another system needs to consume these events.</p><h4>7.4 Connect Event Classification</h4><p>Now integrate the classifier into our Express endpoint.</p><p>Open:</p><p>src/api/server.js</p><p>Use:</p><pre>import express from &quot;express&quot;;<br>import dotenv from &quot;dotenv&quot;;<br>import { saveSnapshot, loadSnapshot } from &quot;../pipeline/snapshot.js&quot;;<br>import { computeHistoricalDelta } from &quot;../pipeline/compare.js&quot;;<br>import { classifySystemEvents } from &quot;../pipeline/classify.js&quot;;<br><br>dotenv.config();<br><br>const app = express();<br>app.use(express.json());<br><br>const PORT = process.env.PORT || 3000;<br><br>app.post(&quot;/api/events&quot;, async (req, res) =&gt; {<br>  const incomingRecords = req.body.records;<br>  if (!Array.isArray(incomingRecords)) {<br>    return res.status(400).json({<br>      error: &quot;Invalid Payload.&quot;<br>    });<br>  }<br>  try {<br>    const historicalBaseline = await loadSnapshot();<br>    const deltaAnalysis = computeHistoricalDelta(<br>      historicalBaseline,<br>      incomingRecords<br>    );<br>    const structuredAlertsTimeline =<br>      classifySystemEvents(deltaAnalysis);<br>    await saveSnapshot(incomingRecords);<br>    const criticalAnomaly =<br>      structuredAlertsTimeline.find(<br>        (event) =&gt; event.severity === &quot;CRITICAL&quot;<br>      );<br>    if (criticalAnomaly) {<br>      return res.json({<br>        severity: &quot;CRITICAL&quot;,<br>        message: `${criticalAnomaly.details.label} lost ${Math.abs(criticalAnomaly.details.percent_change)}% of its value.`,<br>        timeline: structuredAlertsTimeline<br>      });<br>    }<br>    res.json({<br>      severity: &quot;HEALTHY&quot;,<br>      message:<br>        &quot;Ingestion finalized with no critical anomalies registered.&quot;,<br>      timeline: structuredAlertsTimeline<br>    });<br>  } catch (error) {<br>    res.status(500).json({<br>      error: error.message<br>    });<br>  }<br>});<br><br>app.listen(PORT, () =&gt;<br>  console.log(`Event Classification server active on port: ${PORT}`)<br>);</pre><h4>7.5 Test Event Classification</h4><p>Let’s deliberately create a large negative change and see whether our classifier catches it.</p><p>Open:</p><p>src/storage/snapshots/latest_snapshot.json</p><p>Replace its contents with:</p><pre>[<br>  {<br>    &quot;id&quot;: &quot;A&quot;,<br>    &quot;value&quot;: 5000000,<br>    &quot;label&quot;: &quot;House A&quot;<br>  }<br>]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*3gVnyuOLs8S6UJvn" /></figure><p>Now create the test payload in PowerShell:</p><pre>$AnomalyTestData = @{<br>  records = @(<br>    @{ id = &quot;A&quot;; value = 325000; label = &quot;House A&quot; }<br>  )<br>} | ConvertTo-Json -Depth 5 -Compress</pre><p>Send it to /api/events:</p><pre>Invoke-RestMethod `<br>  -Uri &quot;http://127.0.0.1:3000/api/events&quot; `<br>  -Method POST `<br>  -Headers @{&quot;Content-Type&quot;=&quot;application/json&quot;} `<br>  -Body $AnomalyTestData</pre><p>The value changes from $5,000,000 to $325,000, which is a <strong>-93.5% change</strong>.</p><p>Because that is below our -30% threshold, the classifier should return a CRITICAL event. Have a look:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*buAymmY9SpXo2O6c" /></figure><p>Now run the same request again. This time, the result should no longer be critical.</p><p>Why?</p><p>Because the previous request already saved $325,000 as the latest snapshot. The second request is therefore comparing $325,000 against $325,000, producing no value change.</p><p>That’s the rolling state mechanism working as intended. Have a look:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*CuQRk5PAbyQoK2Y2" /></figure><p>We now have three important abilities:</p><pre>Extract<br>  ↓<br>Remember<br>  ↓<br>Compare<br>  ↓<br>Classify<br>  ↓<br>Machine-readable Events</pre><p>The pipeline can now detect when its data changes and distinguish ordinary updates from unusually large shifts.</p><p>The next challenge is more interesting: <strong>what happens when the scraper itself breaks?</strong></p><p>Let’s deliberately break the extraction layer and see whether the rest of our pipeline can detect the failure.</p><h3>8. Building a Reusable Collector Factory</h3><p>So far, our pipeline has been working with local datasets.</p><p>That was intentional. We first built and tested the processing layer independently from external extraction services. Now we can connect that pipeline to a real web data provider without mixing provider-specific logic into our application.</p><p>Our pipeline already knows how to:</p><ul><li>Normalize inconsistent values</li><li>Validate incoming records</li><li>Remove duplicates</li><li>Store historical snapshots</li><li>Compare datasets over time</li><li>Classify notable market changes</li></ul><p>The next step is to make the extraction layer replaceable.</p><p>If we change scraping providers later, the processing pipeline should not need to change.</p><h4>8.1 Designing the Collector Abstraction</h4><p>A common mistake is to put provider-specific code directly inside the main pipeline.</p><p>That creates a dependency like this:</p><pre>Node.js Pipeline<br>      ↓<br>Bright Data-specific code<br>      ↓<br>Bright Data API</pre><p>If we later switch providers, we have to modify the pipeline itself.</p><p>Instead, we’ll put an abstraction between the pipeline and the extraction provider:</p><pre>                  ┌─────────────────────┐<br>                  │   Node.js Pipeline  │<br>                  └──────────┬──────────┘<br>                             │<br>                    Collector Interface<br>                             │<br>              ┌──────────────┴──────────────┐<br>              │                             │<br>   ScraperStudioCollector          FirecrawlCollector<br>              │                             │<br>        Bright Data                    Firecrawl</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*iEhgs_fZcrIH6Yru" /></figure><p>The pipeline only needs one contract: <strong>Give the collector a target and receive structured records.</strong></p><p>The implementation behind that contract can change.</p><p>Our collector directory will look like this:</p><pre>src/<br>└── collectors/<br>    ├── BaseCollector.js<br>    ├── ScraperStudioCollector.js<br>    ├── FirecrawlCollector.js<br>     ...other collectors<br>    └── CollectorFactory.js</pre><p>This is the practical side of the <a href="https://angular.love/ports-and-adapters-vs-hexagonal-architecture-is-it-the-same-pattern"><strong>Port and Adapter</strong></a> pattern we introduced earlier: the application depends on an interface, while individual providers implement that interface.</p><h4>8.2 Building the Base Collector</h4><p>Create:</p><p>src/collectors/BaseCollector.js</p><p>This class defines the contract that every collector must follow.</p><pre>/**<br> * Abstract Base Collector Interface.<br> */<br>export class BaseCollector {<br>  /**<br>   * Programmatically retrieves raw, unsanitized extraction payload<br>   * arrays from a source target.<br>   *<br>   * @param {string} url - Target public website URL.<br>   * @returns {Promise&lt;Array&lt;Object&gt;&gt;} - Unnormalized data array.<br>   */<br>  async collect(url) {<br>    throw new Error(<br>      &quot;Architecture Violation: Method &#39;collect(url)&#39; must be implemented by subclass.&quot;<br>    );<br>  }<br>}</pre><p>The base class does not know anything about Bright Data, Firecrawl, Playwright, or any other extraction system.</p><p>It only defines the expected behavior.</p><p>Every concrete collector must implement collect(url).</p><h4>8.3 Defining the Primary Provider</h4><p>Our primary provider will be Bright Data Scraper Studio.</p><p>Create:</p><p>src/collectors/ScraperStudioCollector.js</p><pre>import { BaseCollector } from &quot;./BaseCollector.js&quot;;<br><br>/**<br> * Our primary provider (infrastructure layer).<br> */<br><br>export class ScraperStudioCollector extends BaseCollector {<br>  async collect(url) {<br>    // Provider-specific implementation will be added here.<br>    throw new Error(<br>      &quot;Bright Data Infrastructure Pipeline Placeholder. Activate via configuration parameters.&quot;<br>    );<br>  }<br>}</pre><p>For now, this is intentionally a placeholder.</p><p>We are testing the architecture before adding the external API implementation. This makes it easier to verify that the rest of the application does not depend on Bright Data-specific details.</p><h4>8.4 Adding a Secondary Provider</h4><p>Now let’s add a second collector to prove that the abstraction is not tied to one provider.</p><p>Create:</p><p>src/collectors/FirecrawlCollector.js</p><pre>import { BaseCollector } from &quot;./BaseCollector.js&quot;;<br><br>/**<br> * Alternative web crawler provider used to demonstrate<br> * multi-provider collector architecture.<br> */<br><br>export class FirecrawlCollector extends BaseCollector {<br>  async collect(url) {<br>    // Provider-specific implementation will be added here.<br>    throw new Error(<br>      &quot;Firecrawl Infrastructure Pipeline Placeholder. Activate via configuration parameters.&quot;<br>    );<br>  }<br>}</pre><p>Again, this is only an architectural placeholder.</p><p>The important part is that both providers expose the same collect(url) method.</p><p>The pipeline does not need to know which provider is behind it.</p><h4>8.5 Implementing the Collector Factory</h4><p>Now we need a single place that decides which provider to instantiate.</p><p>Create:</p><p>src/collectors/CollectorFactory.js</p><pre>import { ScraperStudioCollector } from &quot;./ScraperStudioCollector.js&quot;;<br>import { FirecrawlCollector } from &quot;./FirecrawlCollector.js&quot;;<br><br>export class CollectorFactory {<br>  /**<br>   * Instantiates a concrete data provider dynamically<br>   * based on the configured provider type.<br>   *<br>   * @param {string} providerType - Collector identifier.<br>   */<br><br>  static create(providerType) {<br>    const type = String(providerType).toUpperCase();<br>    if (type === &quot;SCRAPER_STUDIO&quot;) {<br>      return new ScraperStudioCollector();<br>    }<br>    if (type === &quot;FIRECRAWL&quot;) {<br>      return new FirecrawlCollector();<br>    }<br>    throw new Error(<br>      `Factory Exception: Unsupported collector provider type [${providerType}]`<br>    );<br>  }<br>}</pre><p>Now the application can request a collector without directly importing or constructing a provider.</p><p>For example:</p><pre>const collector = CollectorFactory.create(&quot;SCRAPER_STUDIO&quot;);</pre><p>Later, changing the configuration to:</p><pre>const collector = CollectorFactory.create(&quot;FIRECRAWL&quot;);</pre><p>changes the concrete implementation while keeping the pipeline interface the same.</p><p>That is the main benefit of the factory: provider selection is centralized instead of scattered throughout the application.</p><h4>8.6 Verifying the Architecture</h4><p>Before connecting real external services, let’s verify that the abstraction works at runtime.</p><p>Create:</p><p>src/testCollector.js</p><pre>import dotenv from &quot;dotenv&quot;;<br>import { CollectorFactory } from &quot;./collectors/CollectorFactory.js&quot;;<br><br>dotenv.config();<br><br>async function runSanityCheck() {<br>  console.log(&quot;======================================================================&quot;);<br>  console.log(&quot;           COLLECTOR ABSTRACTION ARCHITECTURE SANITY CHECK&quot;);<br>  console.log(&quot;======================================================================&quot;);<br>  try {<br>    // Test 1: Verify factory error mechanics on unsupported providers<br>    try {<br>      console.log(&quot;[Factory Test] Attempting to create an invalid provider...&quot;);<br>      CollectorFactory.create(&quot;UNKNOWN_PROVIDER&quot;);<br>    } catch (e) {<br>      console.log(<br>        `✅ Success: Factory correctly caught boundary exception -&gt; &quot;${e.message}&quot;`<br>      );<br>    }<br>    // Test 2: Verify dependency inversion polymorphism<br>    console.log(<br>      &quot;\n[Factory Test] Creating concrete Scraper Studio class polymorphically...&quot;<br>    );<br>    const collector = CollectorFactory.create(&quot;SCRAPER_STUDIO&quot;);<br>    console.log(<br>      `✅ Success: Instance verified. Class Name: ${collector.constructor.name}`<br>    );<br>    console.log(&quot;----------------------------------------------------------------------&quot;);<br>    console.log(&quot;Result Status: ARCHITECTURE CHECK PASSED.&quot;);<br>    console.log(&quot;======================================================================&quot;);<br>  } catch (err) {<br>    console.error(`❌ Unexpected Architecture Error: ${err.message}`);<br>  }<br>}<br><br>runSanityCheck();</pre><p>Save all modules. Run the verification script from your terminal:</p><pre>node src/testCollector.js</pre><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*INos8yHCUwNK6zxz" /></figure><p>The test verifies two important behaviors.</p><p>First, an unsupported provider is rejected at the factory boundary.</p><p>Second, the factory can create a concrete collector through the common abstraction.</p><p>We haven’t connected a real external provider yet. That’s deliberate.</p><p>The architecture is now ready for that integration without forcing provider-specific code into the processing pipeline.</p><p>Commit the current changes if you want:</p><pre>git add .<br>git commit -m &quot;add polymorphic collector factory layer + change detection&quot;</pre><p>The next step is where this abstraction becomes useful: we’ll replace the Scraper Studio placeholder with the <strong>real Bright Data integration</strong> and start feeding live web data into the pipeline.</p><h3>9. Generate the First Scraper with Scraper Studio AI Agent</h3><p>Our processing pipeline is ready. We now need to connect it to a real extraction source.</p><p>For this project, we’ll use Bright Data Scraper Studio&#39;s built-in Web IDE AI agent to generate the scraper and expose the resulting data to our Node.js pipeline.</p><p>Our target is a live Texas real-estate listing page on <a href="https://www.har.com/houston/realestate/for_sale">HAR.com</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Y758AQpW0QmYA7ms" /></figure><p>The goal isn’t to build a HAR.com-specific application.</p><p>We’re using real estate as the case study because it gives us a useful combination of structured fields, detail pages, pagination, and changing values such as property prices.</p><p>The processing pipeline remains independent of the source.</p><h4>Step 1: Initialize the Target URL</h4><p><a href="https://get.brightdata.com/scraping-browser-signup">Sign in to your Bright Data dashboard</a> and open <strong>Scraper Studio</strong> from the workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*ZEnP8zkrtE0qMQjD" /></figure><p>You’ll be prompted to enter a target URL.</p><p>For this project, enter: <a href="https://www.har.com/houston/realestate/for_sale">https://www.har.com/houston/realestate/for_sale</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*GP6bhcvou0RU6h1O" /></figure><p>Below the URL field, you’ll find an optional <strong>Add additional instructions</strong> field.</p><p>The AI agent can inspect the target and ask questions during the configuration process, but providing the extraction requirements upfront gives it a clearer starting point.</p><p>For our real-estate tracker, use this custom prompt:</p><pre>Collect property information from the listings.<br><br>Follow links from the search results page into individual property pages.<br>Extract:<br>- Price<br>- Address<br>- Bedrooms<br>- Full bathrooms<br>- Half bathrooms<br>- Square footage<br>- Lot size<br>- Property type<br>- MLS number<br>- Listing status<br>Handle pagination across multiple result pages.<br>Exclude advertisements, sponsored placements, and sidebar links.<br>Return a structured JSON array.</pre><p>After processing the target, Scraper Studio generates a proposed data schema as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Kf4wE4UFlTzekJZU" /></figure><p>Review the proposed fields before approving them.</p><p><strong><em>The Generated Schema Is Temporary:</em></strong></p><p>The schema generated by Scraper Studio describes the <strong>external source</strong>. It is not the same thing as the internal data contract we designed earlier.</p><p>Our Node.js pipeline should not care whether the scraper gets a value from a CSS selector, an AI-generated extraction rule, or a completely different provider. The external extraction layer can change. The internal contract should remain stable.This separation is what allows us to replace the extraction provider later without rewriting the processing pipeline.</p><h4>Step 2: Configure the Extraction Workflow</h4><p>If you don’t provide enough information in the additional instructions, Scraper Studio can guide you through an interactive configuration process.</p><p>Depending on the target, you may be asked whether you want to:</p><ol><li>Extract data from individual property pages</li><li>Extract data only from the listing page</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*X1fO8RQfl9UtHZC5" /></figure><p>For our use case, select “<strong>Extract data from individual property pages”</strong>.</p><p>The listing page gives us links to properties, while the individual pages contain richer property information.</p><p>Next, Scraper Studio can ask whether pagination should be handled. Select <strong>Yes</strong>. This tells the scraper that the collection should account for additional result pages rather than stopping at the first page.</p><p>After the page analysis finishes, Scraper Studio presents the proposed extraction fields as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*7-DmFJpT7BjoFtxj" /></figure><p>Review the fields and click <strong>Approve</strong>.</p><p>Now, we have our first functional scraper without writing the extraction logic ourselves. But we’re not going to treat the generated scraper as a black box.</p><p>The exciting part starts when we open the generated code.</p><h4>Step 3: Understanding the Scraper Studio Generated Workflow</h4><p>After approval, Scraper Studio opens the scraper inside its workspace editor.</p><p>The generated JavaScript is divided into two important parts:</p><ol><li><strong>Interaction code—controls</strong> navigation and crawling behavior</li><li><strong>Parser code—extracts</strong> structured information from the current page</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*hKUVeSQHN-zx-Pn7" /></figure><p>Understanding this distinction is useful because these two layers solve different problems.</p><p>The interaction layer decides <em>where the browser goes.</em> The parser decides <em>what data to extract from the page.</em></p><p><strong>1. Auditing the Interaction Code</strong></p><p>The interaction code controls browser navigation, pagination, and the movement between crawling stages. Let&#39;s demonstrate key ideas behind this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*6ugm_aWy-TIPSHvO" /></figure><p>FunctionResponsibilitynavigate()Opens the target URL in the browser session.parse()Passes the current page to the parser.rerun_stage()Runs another instance of a stage, useful for distributing pagination work.next_stage()Passes discovered URLs or data into another crawling stage.</p><p>The scraper isn’t necessarily limited to one long browser session walking through every page sequentially. Instead, the generated workflow can split work into separate stages.</p><p><strong>2. Auditing the Parser Code</strong></p><p>When the interaction layer calls parse(), Scraper Studio passes the current page to the parser.</p><p>The parser is responsible for turning page content into structured records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*PzYRcZQ-Bb_n25df" /></figure><p>One useful pattern you’ll see in generated parser code is converting matching elements into an array before mapping them into structured results.</p><p>For example, using .toArray().map() keeps the transformation in a single expression and produces a normal JavaScript array that can be passed into the next stage.</p><p>More importantly, notice what the parser is doing in our workflow. It doesn’t try to extract every property field from the search-result card.</p><p>Instead, it first discovers the property URLs. Those URLs can then become inputs to the next crawling stage.</p><p>This is precisely the kind of multi-stage workflow we want for our tracker. But our Node.js application doesn’t know how to start this scraper yet.</p><p>So the next step is to connect the Scraper Studio collector to our <strong>Collector abstraction</strong> through its API by replacing the placeholder implementation from the previous section with a real cloud collection request.</p><h3>10. Connecting Scraper Studio API to Node.js</h3><p>Unlike traditional scraping frameworks, Scraper Studio wraps the browser automation layer behind two HTTP endpoints:</p><p>POST /dca/trigger — Start a new collection job</p><p>GET /dca/dataset — Download the completed dataset</p><h4>10.1 Initiate by API</h4><p>Open your published scraper in the Scraper Studio workspace and open the <strong>Initiate by API</strong> tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*2dRnkYruj9fo3FbB" /></figure><p>You need <a href="https://docs.brightdata.com/products/scraper-studio/quickstart">two values</a>:</p><ul><li><strong>API Token:</strong> Your Bright Data API token from <a href="https://docs.brightdata.com/products/scraper-studio/quickstart">Account Settings</a>.</li><li><strong>Collector ID:</strong> The ID of your published Scraper Studio collector. You get this from your Scraper Studio Dashboard after creating the scraper (it will be an ID starting with c_ inside your scraper settings).</li></ul><p>Now open your local .env file and add the values:</p><pre>BRIGHTDATA_API_TOKEN=&quot;&quot;<br>BRIGHTDATA_COLLECTOR_ID=&quot;&quot;</pre><p>Keep these values private. Never commit your .env file to Git.</p><h4>10.2 Triggering Scraper Studio API from Node.js</h4><p>Create an isolated new file for testing scraper studio API; we will later connect with baseCollector:</p><pre>src/collectors/scraperStudio.js</pre><p>We will use Node.js’s built-in fetch() to send the request to Scraper Studio.</p><p>The function below starts a new collection job and returns the response from Bright Data:</p><pre>import dotenv from &quot;dotenv&quot;;<br>dotenv.config();<br><br>/**<br> * Dispatches an asynchronous trigger call to Scraper Studio&#39;s cloud queue.<br> * @param {string} targetUrl - The target URL to scrape.<br> * @returns {Promise&lt;Object&gt;} The asynchronous trigger response.<br> */<br><br>export async function triggerRemoteScraper(targetUrl) {<br>  const token = process.env.BRIGHTDATA_API_TOKEN;<br>  const collectorId = process.env.BRIGHTDATA_COLLECTOR_ID;<br>  if (!token || !collectorId) {<br>    throw new Error(<br>      &quot;Adapter Error: Missing valid Bright Data workspace credentials inside .env file.&quot;<br>    );<br>  }<br>  const triggerEndpoint = `https://api.brightdata.com/dca/trigger?collector=${collectorId}&amp;queue_next=1`;<br>  const parameterPayload = JSON.stringify([<br>    {<br>      url: targetUrl,<br>      max_page: 2 // Bound pagination limits during sandbox evaluation passes<br>    }<br>  ]);<br>  console.log(<br>    `[Cloud Post] Triggering remote automation collection for target: ${targetUrl}`<br>  );<br>  const response = await fetch(triggerEndpoint, {<br>    method: &quot;POST&quot;,<br>    headers: {<br>      Authorization: `Bearer ${token}`,<br>      &quot;Content-Type&quot;: &quot;application/json&quot;<br>    },<br>    body: parameterPayload<br>  });<br>  if (!response.ok) {<br>    throw new Error(<br>      `Cloud Trigger Rejection: HTTP status code [${response.status}]`<br>    );<br>  }<br>  return await response.json();<br>}</pre><p>Notice that we are not launching a browser from Node.js. Our application simply sends the target URL to Scraper Studio. The cloud service takes care of the browser automation and collection job.</p><p>The max_page value is also intentionally limited here. During development and testing, this prevents an accidental request from crawling hundreds or thousands of pages.</p><h4>10.3 Mounting the Express Route</h4><p>Next, connect the scraper trigger to our Express server.</p><p>Open:</p><pre>src/api/server.js</pre><p>Replace its contents with:</p><pre>import express from &quot;express&quot;;<br>import dotenv from &quot;dotenv&quot;;<br>import { triggerRemoteScraper } from &quot;../collectors/scraperStudio.js&quot;;<br>import { processRawIngestion } from &quot;../pipeline/index.js&quot;;<br><br>dotenv.config();<br><br>const app = express();<br>app.use(express.json());<br>const PORT = process.env.PORT || 3000;<br><br>app.get(&quot;/health&quot;, (req, res) =&gt; res.json({ status: &quot;ok&quot; }));<br>// Asynchronous Trigger Endpoint Route<br>app.get(&quot;/api/collect&quot;, async (req, res) =&gt; {<br>  const baselineUrl =<br>    &quot;https://www.har.com/houston/realestate/for_sale&quot;;<br>  const targetUrl = req.query.url || baselineUrl;<br>  try {<br>    const triggerReceipt = await triggerRemoteScraper(targetUrl);<br>    res.json(triggerReceipt);<br>  } catch (error) {<br>    res.status(500).json({ error: error.message });<br>  }<br>});<br><br>app.listen(PORT, () =&gt;<br>  console.log(`Pipeline Server actively running on port: ${PORT}`)<br>);</pre><p>The new /api/collect route gives us a simple way to trigger the cloud scraper from our local application. If no URL is provided, it uses our Houston real-estate page as the default.</p><p>You could also pass another URL through the query string.</p><h4>10.4 Verification Pass</h4><p>Start the development server:</p><pre>npm run dev</pre><p>You should see your server’s startup message in the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*T9RLlUy2vSw-KEUe" /></figure><p>Now open a second PowerShell or terminal window and run:</p><pre>curl &quot;http://127.0.0.1:3000/api/collect&quot;</pre><p>Your local Express server receives the request and calls the Scraper Studio API. If everything is configured correctly, Bright Data returns a successful trigger response as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*s2-vVxa6i-SeMeIJ" /></figure><p>This confirms that our Node.js application can communicate with Scraper Studio and start a real cloud collection job.</p><p>We have now moved from a local mock input to a real remote scraper.</p><h4>10.5 Open the Runs Tab</h4><p>After triggering the collector, open your Scraper Studio workspace and select the <strong>Runs</strong> tab.</p><p>You should see the collection job running there:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*X67PVEQJQFPA30X1" /></figure><p>The Runs page lets you monitor the collection and access the resulting dataset. Scraper Studio provides export formats such as:</p><ul><li>JSON</li><li>CSV</li><li>XLSX</li><li>NDJSON</li></ul><p>At this point, our Node.js application can successfully start a remote scraping job.</p><p>But we still have a problem.</p><p>We do not want a human to open Scraper Studio every time, wait for a run to finish, and manually download a file.</p><p>The next step is to bring the completed dataset back into our Node.js pipeline programmatically. That will let our application <strong>fetch, save, process, and analyze the data dynamically</strong>.</p><h3>11. Building a Texas Real Estate Delta Tracker CLI</h3><p>Every chapter up to this point built one isolated piece of the system: a stable contract, a pipeline that normalizes and validates anything shaped like { id, value, label }, a snapshot engine that gives the pipeline memory, a comparison engine that turns two snapshots into created / updated / removed, an event classifier that separates market noise from real anomalies, a polymorphic collector factory, and a live Scraper Studio trigger endpoint.</p><p>None of that is worth much until it survives contact with a real website.</p><p>This chapter is the <em>payoff</em>.</p><p>We will build a Texas real estate price tracker for Houston and Dallas cities. It will pull live listings from HAR.com through Scraper Studio and send them through the same pipeline we already built and tested.</p><p>The person running the tracker never needs to see a HAR.com URL, paste a property URL, or use the Collection API manually. They simply choose a city from a menu and watch real listings move through the pipeline.</p><p>There is no new architecture here. Only the pieces that genuinely need to change for real-world data will change.</p><p>Before connecting everything from Node.js, we must customize the scraper’s <strong>pagination logic</strong> in the real-world extraction workflow. This matters because a real website produces gigantic data than a small mock dataset. You will waste hours/reducing your valuable free credits for testing a single function if you don’t know how to handle pagination.</p><h4>11.1. How to Handle Pagination when Scraping</h4><p>Let&#39;s look at our generated har.com scraper’s interaction code on scraper studio IDE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*WwPrOKj0yl2LOIzU" /></figure><p><strong>So where’s the actual risk for a repeatable real-world testing workflow?</strong> It’s in what the “cap” is actually capping:</p><pre>const max_page = Math.min(input.max_page || 10, 84); <br>// HAR.com has 84 pages max (by default):</pre><p>At first glance, 84 looks like a safety limit. It is not.</p><p>It is simply the current maximum number of pages for this HAR.com search. Math.min(x, 84) prevents a request from asking for page 85, but it still allows a request to crawl all 84 pages.</p><p>There is another problem. If max_page is not supplied, the scraper falls back to 10. That sounds small until we look at what happens next.</p><p>Every property URL found on a search page becomes its own next_stage() call. In other words, every listing can create another browser job.</p><p>If a search page contains roughly 20 listings, the numbers quickly grow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*nWOLO400mXqaEDKE9qNzAg.png" /></figure><ul><li><strong>Unset (Default):</strong> 10 pages = <strong>200 results</strong></li><li><strong>Set to 50:</strong> 50 pages = <strong>1,000 results</strong></li><li><strong>Set to 84:</strong> 84 pages = <strong>1,680 results</strong></li></ul><p>Here is how much time it takes for <a href="http://har.com/">har.com</a> product page after I limit it to 242 pages. You have to wait 3–8 minutes for testing each request as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*bEY77aKY_0DaJimh" /></figure><p>None of this is a runaway bug. The scraper is doing exactly what we asked it to do. But it is a bad default for a tutorial where we may run the scraper repeatedly while testing snapshots, comparisons, and anomaly detection.</p><p>I have also seen much larger crawls in testing. One request produced more than 1,000 pages, while another test with <a href="http://coinmarketcap.com/">CoinMarketCap</a> reached more than 8,000 pages. That is a lot of browser work for a simple test.</p><p>Bright Data’s batch scraper concurrency can reach up to 100 concurrent jobs per scraper. Once that limit is exceeded, the API can return:</p><pre>Maximum limit of 100 jobs per scraper has been exceeded. Please reduce the number of parallel jobs.</pre><p>So the issue is not that our scraper is broken. The issue is that the default is too large for a repeatable demo.</p><p><strong>Put an explicit cap on the scraper:</strong></p><p>To fix that long-waiting scraping job for each test, we want a small and predictable run for local testing.</p><p>We will:</p><ul><li>Limit listing pagination to <strong>2 pages </strong>so it runs in seconds</li><li>Limit property-detail crawling to <strong>5 listings per page</strong></li><li>Prevent property-detail pages from starting another pagination loop</li></ul><p>Therefore, rewrite the “<strong>interaction code”</strong> in the Scraper Studio IDE as follows:</p><pre>const url = new URL(input.url);<br><br>// Guard: If this is an isolated property detail page, navigate, parse, and exit immediately.<br>// This prevents detail page crawls from recursively triggering search directory loops.<br>if (input.is_detail) {<br>    navigate(url.href);<br>    collect(parse());<br>    return;<br>}<br><br>// Otherwise, we are on the main search directory page<br>navigate(url.href);<br>const { property_urls } = parse();<br><br>// 💡 EXPLICIT PAGINATION CAP: Limit listing discovery to exactly 2 pages max<br>if (!input.is_rerun) {<br>    const max_page = 2; // Hard cap listing crawl page depth<br>    <br>    for (let page = 2; page &lt;= max_page; page++) {<br>        const next_page_url = new URL(input.url);<br>        next_page_url.searchParams.set(&#39;page&#39;, page.toString());<br>        <br>        rerun_stage({<br>            url: next_page_url.href,<br>            is_rerun: true<br>        });<br>    }<br>}<br><br>// 💡 EXPLICIT CRAWL CAP: Limit deep property-detail crawls to exactly 5 listings per page<br>const target_listings = (property_urls || []).slice(0, 5);<br><br>for (let property_url of target_listings) {<br>    next_stage({<br>        url: property_url,<br>        is_detail: true // Flag to activate our detail-page guard in the next stage<br>    });<br>}</pre><p>With that customized interaction code, you’ll see each API request takes only 30 seconds on average in IDE “Recent Runs” tab as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*2U-VlMyg3StHhsaa" /></figure><p>You may still see more pages than expected in some runs. In my case, the scraper returned 12 pages even though the interaction code was capped at 2. The parent worker spawned the two intended pages, but some sub-workers also discovered pagination links inside the site’s footer.</p><p>This is a useful reminder: a crawl limit in one part of a scraper does not automatically prevent a website’s own links from creating additional work.</p><p>After changing the interaction code, save it and click <strong>Save to production</strong>, then click <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*TeeIjOdLXUBl0jYJ" /></figure><p><strong><em>Note:</em></strong><em> Scraper Studio keeps the draft and production/development versions separate. Our Node.js specifically trigger runs the published production version, not an unsaved draft.</em></p><p>Always sync the production version after manually changing the scraper code. You can verify the production update from the <strong>Changelog</strong> tab in the top-right corner:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*VFJ_lv-0spnfGprE" /></figure><h4>11.2. Delivery Preferences and Calling the Collection API</h4><p>Open <strong>Delivery preferences</strong> in the scraper dashboard.</p><p>You will see several choices:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*yYxHWNuhOG89a1sP" /></figure><p>For this tracker, we want the complete dataset after the collection finishes.</p><p>So we use:</p><ul><li>On a job completion (batch)</li><li>JSON</li><li>API download</li></ul><p>That configuration is necessary because it determines how our Node.js collector gets the data.</p><p>Our flow is:</p><pre>POST /dca/trigger<br>        ↓<br>{ collection_id }<br>        ↓<br>GET /dca/dataset?id=...<br>        ↓<br>[ records ]</pre><p>The dataset becomes available after the batch job finishes. If you choose a webhook instead, the architecture changes. Scraper Studio would push the results to your application instead of your application polling for them.</p><p>For this guide, we will keep <strong>API download</strong>.</p><h4>11.3. Waiting for the Job Without Timing Out</h4><p>Our trigger endpoint from Chapter 10 starts a collection and returns its receipt. That proved our connection worked.</p><p>But a real tracker needs to wait for the completed dataset.</p><p>Bright Data’s Collection API returns a status object while the dataset is still being built and returns the completed records when the job is finished. That means our collector needs to poll the dataset endpoint until the result is ready.</p><p>There are also two different timeout problems we need to keep separate:</p><ul><li><strong>HTTP request timeout:</strong> How long one network request is allowed to hang.</li><li><strong>Collection timeout:</strong> How long the entire scraping job is allowed to run.</li></ul><p>A single network request should fail relatively quickly. A real browser crawl, however, may legitimately take several minutes.</p><p>So a slow or broken network request should be retried, while a collection that never finishes should eventually stop.</p><p>Open: src/collectors/ScraperStudioCollector.js</p><p>and replace it completely:</p><pre>// src/collectors/ScraperStudioCollector.js<br>import { BaseCollector } from &quot;./BaseCollector.js&quot;;<br><br>const TRIGGER_ENDPOINT = &quot;https://api.brightdata.com/dca/trigger&quot;;<br>const DATASET_ENDPOINT = &quot;https://api.brightdata.com/dca/dataset&quot;;<br><br>const POLL_INTERVAL_MS = 5000;              // how often we check in<br>const REQUEST_TIMEOUT_MS = 10000;           // how long ONE http call may hang<br>const MAX_COLLECTION_WAIT_MS = 20 * 60 * 1000; // how long the WHOLE job may take<br><br>function sleep(ms) {<br>  return new Promise((resolve) =&gt; setTimeout(resolve, ms));<br>}<br><br>export class ScraperStudioCollector extends BaseCollector {<br>  constructor() {<br>    super();<br>    this.token = process.env.BRIGHTDATA_API_TOKEN;<br>    this.collectorId = process.env.BRIGHTDATA_COLLECTOR_ID;<br><br>    if (!this.token || !this.collectorId) {<br>      throw new Error(&quot;Missing BRIGHTDATA_API_TOKEN or BRIGHTDATA_COLLECTOR_ID in your .env file.&quot;);<br>    }<br>  }<br><br>  /**<br>   * Fires one HTTP request with its own short timeout. This protects us<br>   * against a dead socket — it has nothing to do with how long the<br>   * overall scraping job is allowed to run.<br>   */<br>  async #request(url, options = {}) {<br>    const controller = new AbortController();<br>    const timer = setTimeout(() =&gt; controller.abort(), REQUEST_TIMEOUT_MS);<br>    try {<br>      return await fetch(url, { ...options, signal: controller.signal });<br>    } finally {<br>      clearTimeout(timer);<br>    }<br>  }<br><br>  async collect(url) {<br>    const collectionId = await this.#trigger(url);<br>    return this.#waitForDataset(collectionId);<br>  }<br><br>  async #trigger(targetUrl) {<br>    const triggerUrl = `TRIGGERENDPOINT?collector={this.collectorId}&amp;queue_next=1`;<br><br>    const response = await this.#request(triggerUrl, {<br>      method: &quot;POST&quot;,<br>      headers: {<br>        Authorization: `Bearer ${this.token}`,<br>        &quot;Content-Type&quot;: &quot;application/json&quot;<br>      },<br>      body: JSON.stringify([{ url: targetUrl, max_page: 2 }])<br>    });<br><br>    if ([401, 403, 407].includes(response.status)) {<br>      throw new Error(`Scraper Studio rejected the request credentials [HTTP ${response.status}]. Check BRIGHTDATA_API_TOKEN.`);<br>    }<br>    if (!response.ok) {<br>      throw new Error(`Scraper Studio trigger failed [HTTP ${response.status}]`);<br>    }<br><br>    const body = await response.json();<br>    const collectionId = body.collection_id || body.id;<br>    if (!collectionId) {<br>      throw new Error(&quot;Trigger response did not include a collection id.&quot;);<br>    }<br><br>    console.log(`[Scraper Studio] Job triggered. Collection ID: ${collectionId}`);<br>    return collectionId;<br>  }<br><br>  async #waitForDataset(collectionId) {<br>    const datasetUrl = `${DATASET_ENDPOINT}?id=${collectionId}`;<br>    const startedAt = Date.now();<br>    let lastStatus = &quot;INITIALIZING&quot;;<br><br>    while (Date.now() - startedAt &lt; MAX_COLLECTION_WAIT_MS) {<br>      const elapsedSec = Math.floor((Date.now() - startedAt) / 1000);<br>      process.stdout.write(`\r[Scraper Studio] ${lastStatus.padEnd(12)} elapsed: ${elapsedSec}s   `);<br><br>      let response;<br>      try {<br>        response = await this.#request(datasetUrl, {<br>          headers: { Authorization: `Bearer ${this.token}` }<br>        });<br>      } catch (requestError) {<br>        // A single request timing out or dropping is a network hiccup,<br>        // not a job failure — try again on the next polling pass.<br>        await sleep(POLL_INTERVAL_MS);<br>        continue;<br>      }<br><br>      // Auth problems are a request problem, not a &quot;still running&quot; state.<br>      // Fail immediately instead of burning the 20-minute budget on a<br>      // token that will never work.<br>      if ([401, 403, 407].includes(response.status)) {<br>        process.stdout.write(&quot;\n&quot;);<br>        throw new Error(`Scraper Studio rejected the dataset request [HTTP ${response.status}]. Check BRIGHTDATA_API_TOKEN.`);<br>      }<br><br>      // A brief 404 right after triggering (before the snapshot id has<br>      // fully registered) is normal and self-resolves within a poll or<br>      // two. Any other 4xx means something about the request is wrong<br>      // and won&#39;t fix itself by waiting, so we fail fast on those.<br>      if (response.status === 404 &amp;&amp; elapsedSec &lt; 30) {<br>        lastStatus = &quot;INITIALIZING&quot;;<br>        await sleep(POLL_INTERVAL_MS);<br>        continue;<br>      }<br>      if (response.status &gt;= 400 &amp;&amp; response.status &lt; 500) {<br>        process.stdout.write(&quot;\n&quot;);<br>        throw new Error(`Scraper Studio rejected the dataset request [HTTP ${response.status}]`);<br>      }<br><br>      // 5xx and anything else non-2xx is treated as transient — the job<br>      // itself is still fine, only this one poll failed.<br>      if (!response.ok) {<br>        lastStatus = &quot;RETRYING&quot;;<br>        await sleep(POLL_INTERVAL_MS);<br>        continue;<br>      }<br><br>      const body = await response.json();<br><br>      // Bright Data&#39;s documented contract: a plain JSON array means the<br>      // snapshot is finished. Anything else — e.g. { status: &quot;building&quot; }<br>      // — means the job is still running.<br>      if (Array.isArray(body)) {<br>        process.stdout.write(&quot;\n&quot;);<br>        console.log(`[Scraper Studio] Collection complete. Records received: ${body.length}`);<br>        return body;<br>      }<br><br>      lastStatus = body.status ? String(body.status).toUpperCase() : &quot;BUILDING&quot;;<br>      await sleep(POLL_INTERVAL_MS);<br>    }<br><br>    process.stdout.write(&quot;\n&quot;);<br>    throw new Error(`Scraper Studio job ${collectionId} did not finish within the 20-minute wait budget.`);<br>  }<br>}</pre><p>Here is what each part protects us from:</p><p>Our scraper implements a fail-fast polling architecture designed to handle diverse network conditions. It uses AbortController timeouts and strict HTTP error handling to <strong>fail immediately on unrecoverable 4xx client errors, while safely retrying transient 5xx server errors</strong> and tolerating brief 404 windows for delayed datasets. Finally, strict ceilings like MAX_COLLECTION_WAIT_MS prevent infinite hangs, while a live status line ensures full operational visibility.</p><p>The core distinction is that one request timing out does not fail the collection. A collection that never finishes does.</p><p>Bright Data’s <a href="https://docs.brightdata.com/products/scraper-studio/quickstart">quickstart</a> uses a shorter overall wait for simpler jobs. We use 20 minutes because we may scrape thousands of pages using our pipeline in a production app in the future, and the scraper will be doing more work.</p><h4>11.4. Building the Texas Tracker’s Data Layer</h4><p>Now we can build the part that is specific to our Texas real estate model.</p><p>The collector gives us raw HAR.com records. Our pipeline, however, expects the stable contract:</p><pre>id<br>value<br>label<br>metadata</pre><p>So we need an adapter between the two.</p><p>First, let’s look at a live JSON record returned by Scraper Studio:</p><pre>{<br>  &quot;price&quot;: { &quot;value&quot;: 305000, &quot;currency&quot;: &quot;USD&quot;, &quot;symbol&quot;: &quot;$&quot; },<br>  &quot;address&quot;: &quot;5238 Kylie Springs Ln, Houston, TX 77066&quot;,<br>  &quot;bedrooms&quot;: 4,<br>  &quot;bathrooms_full&quot;: 2,<br>  &quot;bathrooms_half&quot;: 1,<br>  &quot;square_feet&quot;: 2479,<br>  &quot;lot_size&quot;: 10724,<br>  &quot;property_type&quot;: &quot;Single-Family&quot;,<br>  &quot;mls_number&quot;: &quot;53228136&quot;,<br>  &quot;listing_status&quot;: &quot;For Sale&quot;,<br>  &quot;product_page_url&quot;: &quot;https://www.har.com/homedetail/5238-kylie-springs-ln-houston-tx-77066/3690464&quot;,<br>  &quot;input&quot;: { &quot;url&quot;: &quot;https://www.har.com/houston/realestate/for_sale&quot;, &quot;max_page&quot;: 2 }<br>}</pre><p>Two fields worth noticing before we map anything:</p><p><strong>1. </strong><strong>price is an object</strong></p><p>The price is not simply: 305000</p><p>Instead, Scraper Studio returns:</p><pre>price.value<br>price.currency<br>price.symbol</pre><p>We only need price.value for the main pipeline value.</p><p><strong>2. </strong><strong>input is request metadata</strong></p><p>The input object tells us which URL and settings produced the record.</p><p>That is useful while debugging. But it is not part of the property itself.</p><p>Our adapter will ignore it.</p><p>Open:</p><pre>src/pipeline/adapters.js</pre><p>and replace its contents:</p><pre>// src/pipeline/adapters.js<br><br>/**<br> * Texas city registry. Each entry pairs a simple selection key with the<br> * real HAR.com search URL our published Scraper Studio scraper targets.<br> * The person running the tracker never sees or types this URL — they<br> * just pick a city from a menu.<br> */<br>export const cityRegistry = {<br>  1: { key: &quot;houston&quot;, name: &quot;Houston&quot;, url: &quot;https://www.har.com/houston/realestate/for_sale&quot; },<br>  2: { key: &quot;dallas&quot;, name: &quot;Dallas&quot;, url: &quot;https://www.har.com/dallas/realestate/for_sale&quot; }<br>};<br><br>/**<br> * Universal Dataset Adapter.<br> * Converts HAR.com&#39;s raw field names into our stable pipeline contract:<br> * id, value, label, metadata. This is the ONLY file that knows HAR.com&#39;s<br> * field names — normalize.js, validate.js, and compare.js never do.<br> * Note that `input` (the echoed request) is deliberately never read here.<br> */<br>export class DatasetAdapter {<br>  /**<br>   * @param {Array&lt;Object&gt;} rawData - Raw records from the Scraper Studio collector.<br>   * @param {string} city - The city key (&quot;houston&quot; | &quot;dallas&quot;) for tagging.<br>   */<br>  static transform(rawData, city) {<br>    if (!Array.isArray(rawData)) return [];<br><br>    return rawData.map((item) =&gt; ({<br>      id: item.mls_number ? String(item.mls_number) : null,<br>      value: item.price ? item.price.value : null,<br>      label: item.address ? String(item.address).trim() : &quot;Untitled Listing&quot;,<br>      metadata: {<br>        city,<br>        currency: item.price ? item.price.currency : &quot;USD&quot;,<br>        currency_symbol: item.price ? item.price.symbol : &quot;$&quot;,<br>        bedrooms: toInt(item.bedrooms),<br>        bathrooms_full: toInt(item.bathrooms_full),<br>        bathrooms_half: toInt(item.bathrooms_half),<br>        square_feet: toInt(item.square_feet),<br>        lot_size: toInt(item.lot_size),<br>        property_type: item.property_type ?? null,<br>        listing_status: item.listing_status ?? null,<br>        product_page_url: item.product_page_url ?? null<br>      }<br>    }));<br>  }<br>}<br><br>function toInt(value) {<br>  const number = parseInt(String(value ?? &quot;&quot;).replace(/[^0-9]/g, &quot;&quot;), 10);<br>  return Number.isFinite(number) ? number : null;<br>}</pre><p>The adapter isolates HAR.com from the rest of our system.</p><p>The rest of the pipeline does not need to know that HAR.com calls the identifier mls_number.</p><p>It only sees:</p><pre>id<br>value<br>label<br>metadata</pre><p><strong>Choosing a stable ID:</strong></p><p>Our id comes from the MLS number rather than the address. That addresses can change formatting between crawls. An address might appear slightly differently while still referring to the same listing.</p><p>The MLS number gives us a much more stable identity for comparison.</p><p>If our identity key changes between runs, the comparison engine could treat one listing as two different records: one removed and another created.</p><p><strong>Keeping website-specific fields in metadata:</strong></p><p>Everything specific to HAR.com goes inside metadata. Bedrooms, bathrooms, square footage, property type, and listing status do not become part of the core pipeline contract.</p><p>That means normalize.js, validate.js, and compare.js remain completely independent of HAR.com.</p><p>This is the abstraction we designed earlier finally working with real data.</p><p><strong>Preserving metadata during normalization</strong></p><p>There is one small generic change we need in the pipeline. Our current normalize.js carries the core fields forward, but we also want to preserve the optional metadata bag.</p><p>Open:</p><pre>src/pipeline/normalize.js</pre><p>and add the metadata field to normalizeRecord:</p><pre>export function normalizeRecord(record, index) {<br>  return {<br>    id: record.id ?? `entity-${index + 1}`,<br>    value: toNumber(record.value),<br>    label: typeof record.label === &quot;string&quot; ? record.label.replace(/\s+/g, &quot; &quot;).trim() : &quot;Untitled Entry&quot;,<br>    metadata: record.metadata &amp;&amp; typeof record.metadata === &quot;object&quot; ? record.metadata : {},<br>    captured_at: new Date().toISOString()<br>  };<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*HbGKHhck6ctfgZgj" /><figcaption>adding metadata field to normalize.js</figcaption></figure><p>That’s the only change to the pipeline core in this chapter.</p><p>The change is generic. Any future adapter can attach metadata without teaching normalize.js anything about the source.</p><p><strong>Filtering by bedrooms:</strong></p><p>The bedroom filter belongs to the application, not the pipeline. So it runs <strong>after</strong> normalization, validation, and deduplication.</p><p>Add this helper to src/pipeline/adapters.js:</p><pre>/**<br> * Application-level filter. Runs strictly after the pipeline core has<br> * already normalized/validated/deduplicated the records.<br> */<br>export function filterByBedrooms(records, bedrooms) {<br>  if (!bedrooms || bedrooms === &quot;any&quot;) return records;<br>  const target = Number(bedrooms);<br>  return records.filter((record) =&gt; record.metadata.bedrooms === target);<br>}</pre><figure><img alt="implementing bedroom filters in adapters.js" src="https://cdn-images-1.medium.com/max/875/0*ZUtwxczmFzjt4CvY" /><figcaption>Beedroom filter function in adapters.js</figcaption></figure><p>Now the pipeline answers:</p><blockquote><em>Is this data valid?</em></blockquote><p>The application answers:</p><blockquote><em>Which valid records do I want to see?</em></blockquote><p>Those are different responsibilities.</p><p><strong>City-specific snapshots</strong></p><p>There is one more problem to solve before we build the CLI. Our snapshot system currently stores one file:</p><pre>latest_snapshot.json</pre><p>That works for one dataset. It does not work for two cities. If we run Dallas after Houston and both cities use the same snapshot, the Dallas listings would be compared against Houston’s previous data.</p><p>Every Dallas listing could appear to be CREATED, while Houston listings could appear to be REMOVED.</p><p>We need one snapshot per city.</p><p>Open:</p><pre>src/pipeline/snapshot.js</pre><p>and replace it with:</p><pre>// src/pipeline/snapshot.js<br>import fs from &quot;node:fs/promises&quot;;<br>import path from &quot;node:path&quot;;<br><br>const snapshotDir = path.join(process.cwd(), &quot;src&quot;, &quot;storage&quot;, &quot;snapshots&quot;);<br><br>function snapshotFileFor(city) {<br>  return path.join(snapshotDir, `snapshot_${city}.json`);<br>}<br><br>export async function saveSnapshot(city, records) {<br>  try {<br>    await fs.mkdir(snapshotDir, { recursive: true });<br>    await fs.writeFile(snapshotFileFor(city), JSON.stringify(records, null, 2), &quot;utf8&quot;);<br>    return true;<br>  } catch (err) {<br>    console.error(`[Snapshot Write Failure] ${city}: ${err.message}`);<br>    return false;<br>  }<br>}<br><br>export async function loadSnapshot(city) {<br>  try {<br>    const rawBuffer = await fs.readFile(snapshotFileFor(city), &quot;utf8&quot;);<br>    return JSON.parse(rawBuffer);<br>  } catch (notFoundError) {<br>    // First run for this city — start from an empty baseline.<br>    return [];<br>  }<br>}</pre><p>The comparison engine still does not know anything about cities. Only the snapshot layer and the caller know which city is being processed.</p><p>Now Houston gets:</p><pre>snapshot_houston.json</pre><p>and Dallas gets:</p><pre>snapshot_dallas.json</pre><p>Each city now has its own memory.</p><h4>11.5. Assembling an Interactive Tracker</h4><p>Create:</p><pre>src/cli/trackTexas.js</pre><p>This is our terminal client. Notice how little logic it owns. It asks the user for a city and bedroom filter, then connects the pieces we already built:</p><pre>CLI<br> ↓<br>Collector<br> ↓<br>Adapter<br> ↓<br>Pipeline<br> ↓<br>Filter<br> ↓<br>Snapshot<br> ↓<br>Compare<br> ↓<br>Classify</pre><p>The person running the tracker never needs to enter a HAR.com URL or know the collector ID. They simply choose a city and a bedroom filter:</p><pre>// src/cli/trackTexas.js<br>import readline from &quot;node:readline/promises&quot;;<br>import dotenv from &quot;dotenv&quot;;<br>import { CollectorFactory } from &quot;../collectors/CollectorFactory.js&quot;;<br>import { cityRegistry, DatasetAdapter, filterByBedrooms } from &quot;../pipeline/adapters.js&quot;;<br>import { processRawIngestion } from &quot;../pipeline/index.js&quot;;<br>import { loadSnapshot, saveSnapshot } from &quot;../pipeline/snapshot.js&quot;;<br>import { computeHistoricalDelta } from &quot;../pipeline/compare.js&quot;;<br>import { classifySystemEvents } from &quot;../pipeline/classify.js&quot;;<br><br>dotenv.config();<br><br>const rl = readline.createInterface({ input: process.stdin, output: process.stdout });<br><br>function formatMoney(amount) {<br>  return `$${Number(amount).toLocaleString()}`;<br>}<br><br>function movementIcon(percentChange) {<br>  if (percentChange &gt; 0) return &quot;📈&quot;;<br>  if (percentChange &lt; 0) return &quot;📉&quot;;<br>  return &quot;➖&quot;;<br>}<br><br>async function main() {<br>  console.log(&quot;======================================================================&quot;);<br>  console.log(&quot;                     TEXAS REAL ESTATE PRICE COMPARISON  TRACKER               &quot;);<br>  console.log(&quot;======================================================================&quot;);<br>  console.log(&quot;1) Houston&quot;);<br>  console.log(&quot;2) Dallas&quot;);<br>  const cityChoice = await rl.question(&quot;Select a city (1-2): &quot;);<br>  const city = cityRegistry[cityChoice.trim()];<br><br>  if (!city) {<br>    console.error(&quot;Invalid selection.&quot;);<br>    rl.close();<br>    process.exit(1);<br>  }<br><br>  console.log(&quot;\nBedroom filter:&quot;);<br>  console.log(&quot;1) 2 bedrooms&quot;);<br>  console.log(&quot;2) 3 bedrooms&quot;);<br>  console.log(&quot;3) Any&quot;);<br>  const bedroomChoice = await rl.question(&quot;Select a filter (1-3): &quot;);<br>  const bedrooms = { 1: 2, 2: 3, 3: &quot;any&quot; }[bedroomChoice.trim()] ?? &quot;any&quot;;<br><br>  console.log(`\n[Tracker] City: ${city.name}`);<br>  console.log(`[Tracker] Bedroom filter: ${bedrooms}`);<br><br>  try {<br>    const baseline = await loadSnapshot(city.key);<br>    console.log(`[Tracker] Loaded ${baseline.length} record(s) from ${city.key}&#39;s previous snapshot.`);<br><br>    const provider = process.env.COLLECTOR_PROVIDER || &quot;SCRAPER_STUDIO&quot;;<br>    const collector = CollectorFactory.create(provider);<br><br>    const rawData = await collector.collect(city.url);<br>    console.log(`[Tracker] Raw records received: ${rawData.length}`);<br><br>    const standardized = DatasetAdapter.transform(rawData, city.key);<br>    const processed = processRawIngestion(standardized);<br>    console.log(&quot;[Tracker] Pipeline telemetry:&quot;, processed.telemetry);<br><br>    const filtered = filterByBedrooms(processed.data, bedrooms);<br>    console.log(`[Tracker] Records after bedroom filter: ${filtered.length}`);<br><br>    if (filtered.length === 0) {<br>      console.warn(&quot;[Tracker] Nothing left after filtering. Nothing to compare or save.&quot;);<br>      return;<br>    }<br><br>    const deltas = computeHistoricalDelta(baseline, filtered);<br>    const events = classifySystemEvents(deltas);<br><br>    console.log(&quot;\n----------------------------------------------------------------------&quot;);<br>    console.log(`   ${city.name.toUpperCase()} — FIRST ${Math.min(10, filtered.length)} RECORDS`);<br>    console.log(&quot;----------------------------------------------------------------------&quot;);<br><br>    for (const record of filtered.slice(0, 10)) {<br>      const previous = baseline.find((item) =&gt; item.id === record.id);<br>      console.log(`  [${record.id}] ${record.label}`);<br>      console.log(`    Price: ${formatMoney(record.value)}  |  Beds: ${record.metadata.bedrooms ?? &quot;?&quot;}  |  Status: ${record.metadata.listing_status ?? &quot;unknown&quot;}`);<br>      if (previous) {<br>        const change = record.value - previous.value;<br>        const percent = previous.value ? (change / previous.value) * 100 : 0;<br>        console.log(`    Previous: ${formatMoney(previous.value)}  ${movementIcon(percent)} change&gt;=0?&quot;+&quot;:&quot;&quot;{formatMoney(change)} (${percent.toFixed(2)}%)`);<br>      } else {<br>        console.log(&quot;    Previous: [no baseline yet]&quot;);<br>      }<br>    }<br><br>    console.log(&quot;\n----------------------------------------------------------------------&quot;);<br>    console.log(`   CREATED: ${deltas.created.length}  |  UPDATED: ${deltas.updated.length}  |  REMOVED: ${deltas.removed.length}`);<br>    console.log(&quot;----------------------------------------------------------------------&quot;);<br><br>    for (const event of events) {<br>      console.log(`  [${event.severity}] ${event.type}: ${event.message}`);<br>    }<br><br>    const merged = new Map(baseline.map((item) =&gt; [item.id, item]));<br>    for (const record of filtered) {<br>      merged.set(record.id, record);<br>    }<br>    await saveSnapshot(city.key, [...merged.values()]);<br>    console.log(`\n[Tracker] Snapshot saved: snapshot_${city.key}.json`);<br>  } catch (error) {<br>    console.error(`\n[Tracker Error] ${error.message}`);<br>  } finally {<br>    rl.close();<br>  }<br>}<br><br>main();</pre><p>Add the CLI command to package.json:</p><pre>&quot;scripts&quot;: {<br>  &quot;track&quot;: &quot;node src/cli/trackTexas.js&quot;<br>}</pre><p>Now run:</p><pre>npm run track</pre><p>The terminal itself is not the interesting part. It is only a thin client that connects the components we already built.</p><p>The same sequence could later run behind:</p><ul><li>An Express API</li><li>A scheduled job</li><li>A background worker</li><li>An AI agent tool call</li></ul><p>The underlying pipeline would not need to change.</p><h4>11.6. Final Testing Workflow</h4><p>Now we can test the complete system with real data.</p><p><strong>Test 1: Real Data Baseline</strong></p><p>Run:</p><pre>npm run track</pre><p>From the terminal user query box: Select 1) Houston</p><p>And then in the next query for bedroom filter, I have chosen 3 (Any) to watch the real flow happen end to end.</p><p>For a normal repeatable test, keep the scraper bounded to the two-page configuration from Section 11.1. If you want a larger real-world dataset like m and are willing to wait longer, you can increase the crawl size for that specific run (e.g., max_page = 10).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*X3rJOpss2KOxFZoH" /></figure><p>The first run has no previous snapshot. That means every valid listing should show:</p><pre>Previous: [no baseline yet]</pre><p>The validator may also quarantine records that do not contain the required fields, such as a usable price or MLS number.</p><p>That is exactly what we want. The same validation rules that worked against our mock data are now working against real listings.</p><p>After the run, the tracker writes:</p><pre>snapshot_houston.json</pre><p>Scraper Studio will also show the corresponding collection in its <strong>Runs</strong> tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*aaMVms-LM2iQBOmv" /></figure><p><strong>Test 2: Real Historical Price Comparison</strong></p><p>Now we can test whether the comparison engine detects a price change.</p><p>Open src/storage/snapshots/snapshot_houston.json and locate a live listing to use as our test case. For instance, I have chosen <strong>7942 Hammerly Blvd, Houston, TX 77055, </strong>which was recently stored by our pipeline’s latest scraper run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*fpgDoynHM34LvhfR" /></figure><ul><li><strong>Live price right now:</strong> $439900</li><li><strong>Local snapshot (manually edited for testing):</strong> $539900</li></ul><p>Because real estate prices change slowly over weeks or months, we can’t just wait around for a real-world market drop to test our code. Instead, we will manually edit our local snapshot data to replicate a live price swing:</p><p>By artificially inflating our historical data, we force a mismatch. When the scraper runs next, it will perceive the actual market price as a sudden drop, allowing us to instantly verify that our comparison engine catches real-world fluctuations correctly.</p><p>Run the tracker again against Houston:</p><pre>npm run track</pre><p>The live value is lower than our edited historical value, so the comparison engine detects a price drop.</p><p>In my test, the result was -18.52% price drop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*qUFC4GJAY6QbhE3z" /></figure><p>That is below the 30% critical anomaly threshold while still exceeding the 15% major threshold discussed in earlier chapter, so it is classified according to the rules we already defined there.</p><p>See? we did not create a second comparison system for real estate. The exact same compare.js and classify.js code is now analyzing a real listing.</p><p><strong>Test 3: New and Removed Listings</strong></p><p>Edit snapshot_houston.json again.</p><p>This time:</p><ul><li>Delete a few real listings from the snapshot.</li><li>Add a fake listing with an ID that will not appear in the live crawl, such as &quot;81&quot;.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*TMHBGYVidJMcsXWP" /></figure><p>Now Run: npm run track</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*nil6IWUVaRvlpnidiRWYwQ.png" /></figure><p>The listing you deleted from the snapshot shows up as CREATED (it’s new relative to your edited baseline), and the fake listing you added shows up as DELETED (it’s absent from the live crawl). This is the exact compare.js logic from Chapter 8, it has no idea it’s looking at real estate, it’s still just matching id keys through two Map objects.</p><p><strong>Test 4: Bad Data Protection</strong></p><p>Open the snapshot again. Give one listing an obviously misleading value, such as:</p><pre>&quot;value&quot;: 1</pre><p>This mimics a scraper accidentally extracting a stray number instead of the actual property price. Run the tracker again.</p><p>You should see an anomaly similar to:</p><pre>[CRITICAL] ANOMALOUS_VALUE_COLLAPSE: 5238 Kylie Springs Ln, Houston, TX 77066 (ID: 53228136) shifted by -99.99%.</pre><p>The value is technically a valid number, so it can pass basic validation. But the comparison engine sees an extreme shift and the classifier flags it as <em>critical</em>. This is the reason why validation and anomaly detection are separate steps.</p><p>A number can be <strong>valid</strong> without being <strong>trustworthy</strong>.</p><p><strong>Test 5: Multiple Cities</strong></p><p>Run the tracker again and select: <em>2) Dallas</em></p><p>Complete the sync. Now check:</p><pre>src/storage/snapshots/</pre><p>You should have two separate files:</p><pre>snapshot_houston.json<br>snapshot_dallas.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/0*tBNH0soBLPxmpnkg" /></figure><p>Open both files. Houston and Dallas should remain separate. Running Dallas should not cause Houston listings to appear as REMOVED. Running Houston should not cause Dallas listings to appear as CREATED.</p><p>That is the small change we made to snapshot.js doing its job.</p><p>Each city now has its own memory. The terminal was the visible part of these five tests, but it was never the important part. The important part was everything underneath it: <strong>the contract, the pipeline, the memory, the comparison engine, and the event classifier. </strong>We built those pieces before we had any real estate data.</p><p>This chapter proved that the architecture survives contact with a real website. Let’s save this checkpoint:</p><pre>git add . &amp;&amp; git commit -m &quot;feat: Texas real estate valuation delta tracker, bounded pagination, city-scoped snapshots memory&quot;</pre><p>Next, we will look at what happens when HAR.com changes its layout underneath us.</p><p>More importantly, we will see how Scraper Studio’s <strong>Self-Healing</strong> can repair a broken extraction without us touching normalize.js, compare.js, or the rest of our pipeline core.</p><h3>12. Scraper Studio Self-Healing in Production</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*P7q9ud52tZcYTJwv_AxJ2Q.png" /></figure><p>If you ran the Texas real-estate tracker in the previous chapter and all records looked healthy, great. The scraper is working against the live HAR.com site. But websites change.</p><p>A developer might rename a CSS class or change the page structure. When that happens, a traditional scraper can fail silently. Instead of throwing an error, it may return incomplete values.</p><p>We cannot wait for HAR.com to change its website just to test this. So we will break our scraper ourselves.</p><p>In this chapter, we will:</p><ol><li>Set up the Bright Data CLI.</li><li>Intentionally break a scraper selector in Scraper Studio.</li><li>Run our Node.js tracker and let validation catch the bad data.</li><li>Use the Bright Data CLI to heal the scraper.</li><li>Review the proposed fix before deploying it.</li><li>Run the tracker again locally and verify that the data is healthy.</li></ol><h4>12.1. Installing the Bright Data CLI</h4><p>The Bright Data CLI is available as the <a href="https://docs.brightdata.com/products/cli/installation">@brightdata/cli</a> npm package.</p><p>You can install it globally:</p><pre>npm install -g @brightdata/cli</pre><p>You can also run it without a permanent installation using npx. Plus its fastest way to run the Bright Data CLI, which runs the latest version with no global install:</p><pre>npx -p @brightdata/cli brightdata --version</pre><p>For this chapter, I will use the bdata command after installing the CLI globally. Check that it works:</p><pre>bdata --version</pre><p><strong>Logging In: </strong>Authenticate the CLI with:</p><pre>bdata login</pre><p>This opens a browser for authentication. After login, the CLI stores the credentials locally and checks for the required Bright Data zones. If the cli_unlocker and cli_browser zones do not exist, the CLI can create them automatically.</p><p>You do not need to copy an API key into your project just to use the CLI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*jLLin5oLnXuS5Wep" /></figure><p>Once the login is complete, the terminal is ready to manage your Bright Data scrapers.</p><h4>12.2. Deliberately Breaking the Scraper</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*YpzndzKeI2M85Pv6" /></figure><p>Now let’s imitate a website redesign. A live website might change a selector from:</p><pre>h2.font_size--large_extra_extra.color_carbon</pre><p>to a completely different one. Our scraper could then keep running while returning missing values.</p><p><strong><em>Step 1: Open the Web IDE</em></strong></p><p>Open your Bright Data dashboard and go to our previous har.com scraper dashboard. In the left sidebar, open <strong>Parser Code</strong>. Find the line where the scraper extracts the price, address, or bedrooms. Let’s corrupt the price selector:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*4SVW31Rgi1wmZab9" /></figure><p><strong><em>Step 2: Break the Selector</em></strong></p><p>Change the working selector:</p><pre>const price = extractPrice(<br>  &#39;h2.font_size--large_extra_extra.color_carbon&#39;<br>);</pre><p>to a selector that does not exist:</p><pre>const price = extractPrice(<br>  &#39;div.completely-broken-price-class-that-does-not-exist&#39;<br>);</pre><p><strong><em>Step 3: Publish the Broken Version and Test</em></strong></p><p>Click the dropdown next to <strong>Save</strong> and choose <strong>Save to production</strong>. The active scraper now contains our broken selector. Delete all our local snapshot files that we generated earlier.</p><p>Run the tracker again: npm run track</p><p>Because the website elements no longer match our corrupted selector, the scraper returns null for bedrooms. Watch your terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*-WcvFIXsfq7mmBhd" /></figure><p>This is where our pipeline protects us. Our validate.js validation layer sees that required values are missing and prevents those records from entering the local data storage (failed_compliance: 10) and quarantined the dirty data safely.</p><p>The pipeline successfully protected our database from corruption.</p><p>Now we need to repair the extraction layer.</p><h4>12.3. Ask Bright Data to Heal the Scraper</h4><p>You have two choices to heal a broken scraper: you can use the web console “Self-Healing”, or you can use their terminal CLI.</p><p>While the web console works well for edits, the CLI is the superior tool for AI coding agents (Claude Code, Cursor, or Codex). I will intentionally use CLI to help you better understand both IDE (UI) and terminal self-healing workflow.</p><p>Run the healing command with your Collector ID and a clear description of the problem:</p><pre>bdata scraper heal c_mssne7uc11iej44z4s \<br>  &quot;The price selector is broken and returns null. Re-capture the price from the property details section.&quot; \<br>  --url https://www.har.com</pre><p>The CLI sends the healing request to Bright Data’s scraper infrastructure. The AI agent analyzes the scraper and the target page, then prepares a new version of the scraper.</p><p><strong>Review the Proposed Fix:</strong></p><p>The healing process stops at an approval gate. You should see a status similar to:</p><pre>Status: awaiting_approval</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*XkqM9uRfAIEZoi8i" /></figure><p>Refresh your Scraper Studio web IDE and you’ll see the this popup window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*0dh2zl_MWeqoUaQD" /></figure><p>Check that the price is being extracted from the correct part of the page. Do not approve a fix just because the command succeeded; make sure it returns the <strong>right</strong> value.</p><p><strong>Approve or Reject:</strong></p><p>If the proposed change looks correct, approve it using the CLI workflow.</p><pre>bdata scraper approve c_mssne7uc11iej44z4s</pre><p>If you decide that the proposed fix is wrong, reject it instead:</p><pre>bdata scraper approve c_mssne7uc11iej44z4s --reject</pre><p>Rejecting the fix leaves the existing scraper unchanged. You can then run heal again with clearer instructions.</p><p>One useful detail is that the <strong>Collector ID stays the same</strong> after a successful healing workflow. Your Node.js application therefore does not need a new collector ID just because the scraper implementation changed.</p><p><strong>Verifying the Fix:</strong></p><p>The scraper is repaired. Now run the tracker again: npm run track</p><p>The same Node.js pipeline receives data from the same collector. But this time, the required fields are populated again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*klObnrdPqJrwjBAt" /></figure><p>Our ScraperStudioCollector.js calls the same endpoints and Collector ID as before. The scraper now outputs clean, populated data, the <em>compliance failure</em> count <strong><em>drops back to zero</em></strong>, and the new real estate listings flow into your local snapshots seamlessly:</p><p>That is the main benefit of the architecture we built throughout this guide. The scraper can be repaired at the infrastructure layer while the Node.js pipeline continues working with the same stable data contract.</p><h3>13. Deployment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JxhGJvpLiJPY6jYXLdM_Qw.jpeg" /></figure><p>Our pipeline is now a modular Node.js application. Moving it to a cloud server is the next step. The deployment steps depend on your hosting provider, but the process is usually:</p><ol><li>Push your project to a GitHub repository.</li><li>Connect the repository to a Node.js hosting platform such as <a href="https://render.com/">Render</a>, <a href="https://railway.com/deploy/node-js">Railway</a>, or <a href="https://www.freecodecamp.org/news/how-to-deploy-a-nodejs-application-on-aws/">AWS</a>.</li><li>Add your environment variables through the platform’s environment-variable settings.</li></ol><p>Once deployed, your Express application can expose the same API routes we tested locally. An AI agent or app can then call the API without knowing implementation details.</p><p>Ultimately, Scraper Studio handles the website. Node.js pipeline handles the data. Snapshots store historical state. Delta comparison detects changes. The API makes the result reusable.</p><p>That is the final framework we set out to build.</p><h3>14. Scaling and Production</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*7kNLfvy5GkAuUt_uJzfHgw.png" /></figure><p>To be honest, it is incredibly tempting to keep writing to set up managed databases, implement RAG workflows, configure cloud queues, or build a frontend. But doing so would violate the very principles of clean software design we set out to learn. Our<strong> two-layer </strong>pipline <strong>is already complete.</strong></p><p>We don’t need to build all of that to prove the design works.</p><p>Instead, let’s look at <strong><em>three production pitfalls you should think</em></strong> about when moving this example toward production.</p><h4>1: The Temporary Cloud Filesystem</h4><p>Some hosting environments use temporary filesystems. A restart or new deployment can remove files created by the running application.</p><p>If the snapshot disappears, the pipeline loses its historical baseline.</p><p>For a simple single-instance deployment, your hosting provider may offer persistent disk or volume storage. You can then point the snapshot directory to that location.</p><p>For example:</p><pre>const snapshotDir =<br>  process.env.SNAPSHOT_DIR ||<br>  path.join(process.cwd(), &quot;src&quot;, &quot;storage&quot;, &quot;snapshots&quot;);</pre><p>For a larger application with multiple instances or concurrent writers, a database becomes a better choice. You could replace the file-based implementation behind:</p><pre>loadSnapshot()<br>saveSnapshot()</pre><p>with PostgreSQL, Redis, or another persistent store.</p><p>The rest of the pipeline does not need to know where the snapshot is stored. That is one of the benefits of keeping storage behind a small interface.</p><h4>2: Time-Based Data Decay</h4><p>Our snapshot keeps the latest version of each listing. But a listing that disappears from the source can remain in the snapshot if we never remove it.</p><p>Over many runs, that can leave old records in the dataset. One simple solution is <strong><em>time-based pruning.</em></strong></p><p>Our normalized records already contain captured_at, so we can use that timestamp to remove records that have not been seen recently.</p><p>For example:</p><pre>export function pruneStaleRecords(records, maxAgeDays = 30) {<br>  const cutoff =<br>    Date.now() -<br>    maxAgeDays * 24 * 60 * 60 * 1000;<br><br>return records.filter((record) =&gt; {<br>    const seenAt = new Date(record.captured_at).getTime();<br>    return Number.isFinite(seenAt) &amp;&amp; seenAt &gt;= cutoff;<br>  });<br>}</pre><p>The 30-day value is only an example. Your application might use 7 days, 30 days, 90 days, or another rule depending on the data.</p><p>There is also an important rule here: <strong><em>Prune the complete validated dataset, not a filtered view.</em></strong></p><p>For instance, if the user runs the tracker with a two-bedroom filter, a three-bedroom listing may not appear in that run. Historical storage should therefore operate on the full dataset before application-level filters are applied.</p><h4>3: Long-Running HTTP Requests</h4><p>A large crawl may take longer than the HTTP timeout allowed by your hosting platform. The exact timeout depends on the platform and the type of service you are using.</p><p>That means a request such as:</p><pre>POST /api/tracker/houston/sync</pre><p>should not always be responsible for waiting until a large collection finishes. A better production design is to separate <strong>starting a job</strong> from <strong>checking its result</strong>.</p><p>The application can:</p><ol><li>Start the collection job.</li><li>Receive a job or snapshot identifier.</li><li>Return control to the caller.</li><li>Check the job status later.</li><li>Process the final dataset when the collection is complete.</li></ol><p>This is commonly called <strong>asynchronous job processing</strong> or <strong>polling</strong>.</p><p>It becomes especially useful when your scraper needs to process multiple pages. For the small project in this guide, a synchronous flow is easier to understand. For larger crawls, asynchronous processing is the natural next step.</p><h3>15. What You Can Build Next</h3><p>We kept this pipeline small on purpose. Because it is reusable and reliable, you can easily plug it into large-scale production workflows.</p><p>Here are two high-demand popular use cases you can build right now:</p><p><strong>1. A Real-Estate RAG Pipeline for AI Agents</strong></p><p>Static documents make AI real estate analysts obsolete fast. You can use this pipeline to feed an LLM real-time data instead.</p><ul><li><strong>How to build it:</strong> Set up a daily cron job (like Render Cron) to hit your /api/track/houston endpoint.</li><li><strong>The Flow:</strong> The pipeline pulls live listings, normalizes the data, and flags major changes (like a 15%+ price drop). The server converts these updates into vector embeddings and saves them to Pinecone or Chroma.</li><li><strong>The Result:</strong> Your RAG system gets verified, daily market shifts. Your AI analyst can spot live investment opportunities without any manual data entry.</li></ul><p><strong>2. Capped-Budget Market Analyzers</strong></p><p>Running web crawlers inside autonomous AI loops is financially risky. A single runaway loop on a dynamic billing platform can cost thousands in surprise server fees.</p><ul><li><strong>How to build it:</strong> Run this pipeline on a flat-rate model (like Scraper Studio’s $1.50 per 1,000 pages). Cap each run at 2 directory pages.</li><li><strong>The Math:</strong> Every daily sync costs around $0.003.</li><li><strong>The Advantage:</strong> Strict pagination boundaries give you a hard safety ceiling. You can calculate and lock down your maximum monthly data budget with absolute certainty.</li></ul><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EeeSLTvwLMgRLy1jIHwKoQ.png" /></figure><p>We started with a basic problem: A scraper can succeed and still give you bad data. Therefore, we built a data pipeline around it. The scraper extracts data. The pipeline makes that data useful.</p><p>We first created a stable contract. The pipeline core works with that contract instead of knowing the fields of a specific website.</p><p>Then we built the core processing stages: we added snapshots so the application could remember previous data. Then we added comparison and classification. Next, we created the collector factory so the application could work with different extraction providers.</p><p>Finally, we tested everything against live Texas real-estate listings from HAR.com. We did not put HAR.com-specific field names into the pipeline core. Instead, the adapter translated HAR.com’s response into our stable contract.</p><p>For testing our pipeline, we intentionally broke the live scraper. Our validation layer detected the bad data. Bright Data’s self-healing workflow repaired the scraper. We reviewed the proposed change and deployed it without changing the Node.js pipeline.</p><p>That is the main idea of this guide. The terminal tracker itself is not the most notable part. It is ONLY one client of the application. The reusable part is the architecture underneath.</p><h3>FAQ</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QczcIRJhT97v3zZZJ-OKbg.jpeg" /></figure><h4>Why build a custom pipeline instead of parsing whatever the scraper returns?</h4><p>Because doing that for every source creates a maintenance problem.</p><p>Without a stable contract, every new source introduces different field names and different business logic. With the contract, each source needs an adapter.</p><p>The rest of the pipeline can remain the same.</p><h4>Why Node.js instead of Python?</h4><p>There is no <em>special </em>requirement to use Node.js. We use it here because Scraper Studio’s interaction and parser code also use JavaScript, so the entire example stays in one language.</p><p>The core ideas are not tied to Node.js. The normalization, validation, comparison, and classification logic could be implemented in Python, Go, or another language.</p><h4>Why use JSON files instead of a database?</h4><p>For an initial MVP (<a href="https://www.atlassian.com/agile/product-management/minimum-viable-product">Minimum Viable Product</a>), using a JSON is the smartest, fastest choice. But as soon as the project goes live for hundreds of users or needs long-term history, you must transition that historical snapshot into a real database.</p><h4>Is web scraping legal?</h4><p>The examples and workflows in this guide are about publicly accessible web data. <a href="https://brightdata.com/trustcenter">Bright Data does not utilize private accounts</a>, bypass authentication mechanisms, or collect sensitive personal information (PII).</p><p>It is important to note that public visibility does not automatically grant a blanket right to collect or reuse data. The exact legal requirements heavily depend on the target website, the nature of the data, your specific jurisdiction, and your intended end-use.</p><p>Before deploying any scraper to production systems, developers must thoroughly review the target site’s terms of service, applicable local and international laws, <a href="https://www.cookieyes.com/blog/ccpa-vs-gdpr/">strict data-protection regulations (GDPR or CCPA)</a>, and their own internal organizational policies.</p><h4>Can I use this pipeline other than a single data source?</h4><p>Yes. That is one of the main reasons we created the collector factory and adapter layer.</p><p>For a new source, you need:</p><ol><li>A scraper or collector for the source.</li><li>An adapter that maps its fields to { id, value, label, metadata }.</li><li>A registration in the collector factory.</li></ol><p>The generic pipeline does not need to know whether the source contains houses, products, jobs, or another type of data.</p><h4>How do I run the pipeline on a schedule?</h4><p>The pipeline does not need to know who started it.</p><p>Instead of calling it from the interactive CLI, you can trigger the same sequence from a scheduled job:</p><pre>CollectorFactory.create()<br>        ↓<br>DatasetAdapter.transform()<br>        ↓<br>processRawIngestion()<br>        ↓<br>computeHistoricalDelta()<br>        ↓<br>classifySystemEvents()<br>        ↓<br>saveSnapshot()</pre><p>A cron job, scheduled cloud function, webhook, or another job scheduler can become the trigger. The pipeline itself does not need to change.</p><p><strong>Related article: </strong><a href="https://blog.stackademic.com/how-to-build-an-unblockable-ai-agent-for-browser-automation-using-bright-data-gemini-and-923ba11cac6b">How to Build an Unblockable AI Agent for Browser Automation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d833427c4784" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-build-a-self-healing-web-data-pipeline-with-bright-data-and-node-js-d833427c4784">How to Build a Self-Healing Web Data Pipeline with Bright Data and Node.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clean Code: Zero to One (2026)]]></title>
            <link>https://codewithshahan.medium.com/clean-code-zero-to-one-2026-72386721c2f9?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/72386721c2f9</guid>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Tue, 28 Jul 2026 15:48:35 GMT</pubDate>
            <atom:updated>2026-07-28T15:49:29.551Z</atom:updated>
            <content:encoded><![CDATA[<h4>AI Can Write Code. But It Can’t Save You from Bad Engineering. <em>If you’ve ever asked ChatGPT/Cursor to fix your code, this article is for you.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*VH5C28L4jdUuO_kp9GbOCg.gif" /></figure><p>A few years ago, I thought I was becoming a great developer.</p><p>I knew JavaScript. I could build websites and apps. I understood APIs.</p><p>I had learned data structures, algorithms, and enough frameworks to confuse myself every weekend.</p><p>Then one day I opened a project I had written just two months earlier… and I <em>couldn’t</em> understand my own code.</p><p>Although, It was not complicated. But it was super messy: Variables were everywhere. Functions did five different jobs. Logic was duplicated everywhere.</p><p>Every new feature felt like defusing a BOMB.</p><p>That was the moment I learned something most developers will eventually find out:</p><blockquote><em>Writing code is easy.</em></blockquote><blockquote><em>Maintaining it is where careers are made.</em></blockquote><h3>AI Changed Programming.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8UDFl2jMX2V7iLWb" /><figcaption>Photo by <a href="https://unsplash.com/@patrickmmartin?utm_source=medium&amp;utm_medium=referral">Patrick Martin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>But It Didn’t Change Software Engineering.</p><p>Today everyone has ChatGPT. Claude writes entire components. Cursor finishes your thoughts before you type them. GitHub Copilot autocompletes half your project. <a href="https://get.brightdata.com/ai-web-scraper-studio">Bright Data’s AI-powered web scraper studio</a> takes care of the global <a href="https://javascript.plainenglish.io/how-to-bypass-anti-bot-walls-for-production-ready-apps-7de5bf0891b7">web data extraction process</a>.</p><p>Writing code has NEVER been easier.</p><p>Ironically, Building software has never been harder. Because AI can generate thousands of lines in seconds.</p><p>It cannot magically turn bad architecture into good architecture. It cannot make unreadable code maintainable. It cannot decide where your business logic belongs. It cannot stop technical debt from accumulating.</p><p>If anything…</p><p>AI makes clean code even more valuable. Because the faster we generate code, the more meticulous we need to be when organizing it.</p><h3>The Problem Isn’t AI.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kA76Nh5N4ZP7Lvnm" /><figcaption>Photo by <a href="https://unsplash.com/@olloweb?utm_source=medium&amp;utm_medium=referral">Agence Olloweb</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Think about building a skyscraper. Would you worry about the paint color before pouring the concrete?</p><p>Probably not.</p><p>Yet that’s exactly how many developers learn programming.</p><p>They jump from framework to framework. React today. Next.js tomorrow. Another AI coding tool next week.</p><p>Meanwhile they never learn:</p><ul><li>how to structure projects</li><li>how to name objects and keep clean hierarchy</li><li>how to separate responsibilities</li><li>how to write reusable code</li><li>how to keep large codebases understandable</li></ul><p>Those skills don’t trend on X. They don’t go viral on YouTube.</p><p>But they’re the reason senior engineers can confidently work inside million-line codebases while others struggle inside projects they wrote themselves.</p><h3>My Biggest Mistake</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jJDzgPcJGVbtc8Hn" /><figcaption>Photo by <a href="https://unsplash.com/@hasanalmasi?utm_source=medium&amp;utm_medium=referral">Hasan Almasi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Early in my career I believed learning another framework would make me a better programmer.</p><p>It didn’t.</p><p>Every new framework gave me another hammer. None of them taught me how to build a house.</p><p>Eventually I noticed something fascinating:</p><blockquote>The best engineers I met weren’t necessarily the fastest coders. They were the easiest people to collaborate with.</blockquote><p>Their projects felt predictable. Reading their code felt relaxing. Every function had one responsibility. Every file had a purpose.</p><p>Nothing felt random.</p><p>That’s when I became obsessed with clean software engineering.</p><h3>Five Months Changed Everything</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*07VRG2r3_PSp2ENj" /><figcaption>Photo by <a href="https://unsplash.com/@emilep?utm_source=medium&amp;utm_medium=referral">Emile Perron</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I spent five months studying, researching, writing principles, and rebuilding everything I thought I knew about clean code. I read <em>Clean Code</em> by Robert C. Martin.</p><p>But I translated those principles and clean code design patterns into practical graphical examples that are super easy to understand using JavaScript examples with real-world scenarios that developers actually use today by combining my last 6 years of technical writing and coding experience.</p><p>The result became something I wish existed when I first started programming. 👇</p><h3>Clean Code Zero to One</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SLMrsCjk7C6hk5dmhAgCAg.png" /><figcaption><a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one">Clean Code Zero to One book</a> written by <a href="https://medium.com/u/f63fe8afc87">Shahan Chowdhury</a></figcaption></figure><p>It&#39;s not another programming textbook. Not another collection of rules.</p><p>A practical visual guide for developers who want to build software they can still understand a year later.</p><p>Inside the book you’ll find:</p><ul><li>Clean code Architecture principles</li><li>Design patterns explained visually</li><li>Real JavaScript examples</li><li>modern conventions that actually matter</li><li>SOLID principles</li><li>Refactoring techniques</li><li>Maintainable project organization</li><li>Data structures for real applications</li><li>Hundreds of illustrations and diagrams</li></ul><p>I intentionally designed it differently from traditional programming books.</p><p>Less theory. More visuals. More practical engineering.</p><blockquote>Because software engineering isn’t about memorizing rules. It’s about building habits that you learn from mistakes after you actually code by hand.</blockquote><h3>AI Will Keep Improving</h3><p>Your Engineering Skills Must Too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cM-Wn8x47erQdkjX" /><figcaption>Photo by <a href="https://unsplash.com/@hdbernd?utm_source=medium&amp;utm_medium=referral">Bernd 📷 Dittrich</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Five years from now… AI will write even better code.</p><p>Frameworks will change. Languages will evolve. Tools will come and go.</p><p>But one thing won’t change.</p><p>Someone still has to design software that the developer/designer team can understand using tools like <a href="https://partners.bugherd.com/codewithshahan">BugHerd</a>. Someone still has to maintain production systems. Someone still has to make architectural decisions. Someone still has to own the codebase.</p><p><strong><em>That’s the developer worth becoming.</em></strong></p><p>If you’re interested in writing software that survives beyond the first deployment, you might enjoy my book:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*86rF-qdPxPgB5v7dr4aOwg.png" /></figure><p>📘 <a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><strong>Clean Code Zero to One</strong></a></p><p>It was written to help developers move beyond simply making code work and start writing code that’s readable, maintainable, and enjoyable to build on.</p><p>You can learn more here:</p><p><strong>👉 </strong><a href="https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic">10 Bulletproof Rules for Writing Clean Code</a></p><h3>To sum up</h3><p>AI can generate code. Engineers build functional, scalable software. Learn the difference, and you’ll always stay valuable. Thanks for your time and reading my guide.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72386721c2f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[11 open-source tools every full-stack developer should know in 2026]]></title>
            <link>https://codewithshahan.medium.com/11-open-source-tools-i-install-on-every-new-development-machine-2026-a54904f347bc?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/a54904f347bc</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 10:16:44 GMT</pubDate>
            <atom:updated>2026-07-17T12:18:04.887Z</atom:updated>
            <content:encoded><![CDATA[<h3>Key Concepts 🗝️</h3><blockquote>These 11 tools have saved me thousands of hours over the past 4 years. they’re worth mastering before chasing the next framework.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*NNaN0Yqanb8obSS1.png" /></figure><p>After years of building JavaScript applications, AI agents, browser automation projects, and technical content, these are the open-source tools I keep installing on every new machine.</p><p>They solve different problems, but together they create a faster, cleaner, and more productive development environment.</p><h3>Recommended Developer Tool: <a href="https://partners.bugherd.com/codewithshahan">BugHerd</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*fCqxKFubqZ55JXfH.jpeg" /></figure><p>If you build websites for clients or work in a product team, it’s one of those tools that saves countless hours of back-and-forth communication.</p><p>One of the biggest bottlenecks in software projects is collecting clear feedback. Instead of receiving messages like:</p><p>“The button over there doesn’t work.” or “Something looks broken on mobile.”</p><p>I prefer tools that let clients leave feedback directly on the page. That’s exactly what ⁠BugHerd does.</p><p>Developers, designers, QA engineers, and clients can simply click anywhere on a website, leave visual feedback, and automatically create actionable tasks with browser details, screenshots, and page metadata already attached.</p><p>Recently they also introduced <a href="https://partners.bugherd.com/codewithshahan">BugHerd MCP</a>, where AI coding tools like ChatGPT, Claude, Cursor, VS Code, and other MCP-compatible assistants to work directly with your BugHerd tasks that make AI-assisted debugging and website QA significantly smoother.</p><p>Now let’s move into the open-source tools I install on every new machine.</p><h3>1. <a href="https://github.com/codewithshahan">Git</a></h3><p>Every developer eventually breaks something.</p><p>The question isn’t <strong>if</strong>. It’s <strong>when</strong>.</p><p>Git is the reason those mistakes rarely become catastrophes.</p><p>Instead of <a href="https://dev.to/codewithshahan/mastering-git-github-12-most-useful-git-commands-3l70">thinking about Git</a> as “version control,” think about it as an undo button for your entire project.</p><p>With Git you can:</p><ul><li>experiment without losing work</li><li>create separate feature branches</li><li>collaborate with teammates</li><li>inspect old versions</li><li>recover deleted work</li><li>understand who changed what</li></ul><p>Without Git? Start over.</p><p>With Git?</p><pre>git checkout main</pre><p>Problem solved.</p><h3>2. <a href="https://code.visualstudio.com/">Visual Studio Code</a></h3><p>Even with AI editors like Cursor becoming popular, VS Code remains the foundation of most modern development environments.</p><p>VS Code is probably the application I spend more time inside than my browser.</p><p>Yes it’s “just” a code editor.</p><p>But the extension ecosystem turns it into an entire development platform.</p><p>My favorite extensions include:</p><ul><li>ESLint</li><li>Prettier</li><li>GitLens</li><li>Error Lens</li><li>Docker</li><li>Thunder Client</li><li>Playwright</li><li>GitHub Copilot</li></ul><p>Together they create an environment where formatting, linting, debugging, testing, and Git management happen without leaving the editor.</p><h3>3. <a href="https://www.waveterm.dev/">Wave Terminal</a></h3><p>Wave Terminal is one of the most exciting open-source terminals I’ve used recently.</p><p>Unlike traditional terminals, it transforms your command line into an interactive workspace where commands, outputs, notes, AI assistance, and multiple sessions live together.</p><p>Why I like it? It makes working inside the terminal feel modern instead of intimidating.</p><h3>4. <a href="https://www.docker.com/">Docker</a></h3><p>Every developer has heard it.</p><blockquote><em>“It works perfectly on my computer.”</em></blockquote><p>Usually five minutes before production explodes.</p><p>Docker solves this by packaging your application together with everything it needs to run.</p><p>Your runtime. Dependencies. Libraries. Configuration. Operating environment.</p><p>Instead of shipping code…</p><p>…you ship the entire environment.</p><p>You can run it on Windows, macOS, Linux, or a cloud server, it behaves exactly the same.</p><p>That consistency alone has probably saved software teams millions of debugging hours worldwide.</p><h3>Typical workflow</h3><p>If your goal is to build your local files and launch your entire multi-container stack at once, you only need a single command:</p><pre>docker compose up --build</pre><h3>5. <a href="https://playwright.dev/">Playwright</a></h3><p>Modern software increasingly interacts with browsers.</p><p>Testing. Automation. AI agents. Web scraping. End-to-end validation.</p><p>Playwright has become my favorite browser automation framework because it feels incredibly reliable.</p><p>Unlike older automation libraries, Playwright supports:</p><ul><li>Chromium</li><li>Firefox</li><li>WebKit</li></ul><p>from one API.</p><p>A few lines of JavaScript can launch an entire browser.</p><pre>await page.goto(url);<br>await page.click(selector);<br>await page.fill(selector, value);</pre><p>But here’s something many tutorials never explain: Launching a browser isn’t the hard part anymore.</p><p>The hard part is: getting real, usable data from websites to trust that browser.</p><p>Today’s websites inspect:</p><ul><li><a href="https://dev.to/codewithshahan/how-to-bypass-anti-bot-walls-for-production-ready-apps-2kko">browser fingerprints</a></li><li>TLS handshakes</li><li>IP reputation</li><li><a href="https://multilogin.com/glossary/webgl-fingerprint/">WebGL fingerprints</a></li><li>cookies</li><li>behavioral signals</li></ul><p>Long before your automation clicks its first button.</p><p>That’s why browser automation has become less about writing Playwright scripts…</p><p>…and more about browser infrastructure.</p><p>This is exactly where platforms like <a href="https://get.brightdata.com/codewithshahan"><strong>Bright Data</strong></a> become valuable.</p><p>Instead of spending weeks bypassing anti-bot protections yourself, Bright Data provides production-ready browser infrastructure, including <a href="https://get.brightdata.com/browser-api">Browser API</a>, <a href="https://get.brightdata.com/bypass-antibot-walls">Web Unlocker</a>, <a href="https://get.brightdata.com/ai-web-scraper-studio">AI Scraper Studio</a>, and residential proxy networks. So I can focus on building automation instead of constantly <a href="https://horsecoder.beehiiv.com/p/how-to-build-an-ai-agent-for-browser-automation-using-node-js">fighting anti-bot systems</a>.</p><p>If you’re building browser AI agents or production scraping pipelines, it’s one of the few paid developer tools I genuinely recommend.</p><p>While building AI agents, Bright Data delivers ready-to-use browser infrastructure that lets your Playwright automation focus on the task.</p><p>For hobby projects, local Playwright is fantastic.</p><p>For production automation, browser infrastructure matters just as much as browser code.</p><h3>6. <a href="https://scalar.com/">Scalar</a></h3><p>Scalar is one of the cleanest open-source API platforms available today.</p><p>It combines beautiful API documentation, request testing, and SDK generation into a single modern interface.</p><p>Why I like it? Its strict OpenAPI compliance, robust CLI/API registry, and smooth CI/CD integration with built-in test generation code for a variety of targets. I love its user interface.</p><p>Why should you learn it?</p><p>Every backend developer works with APIs. Scalar makes analyzing them enjoyable.</p><h3>7. <a href="https://supabase.com/">Supabase</a></h3><p>Supabase has become one of my favorite open-source backend platforms.</p><p>It combines PostgreSQL, authentication, storage, edge functions, realtime features, and APIs into one developer-friendly stack.</p><p>Why I like it? You can build production-ready applications without spending days configuring infrastructure.</p><p>It’s one of the fastest ways to build modern full-stack applications.</p><h3>8. <a href="https://www.tensorflow.org/">TensorFlow</a></h3><p>TensorFlow is a tool used for teaching computers to learn, like how your brain learns new things.</p><p>It’s mostly used for machine learning, which is how computers can learn patterns and make decisions. For example, writing a block of code to teach a computer how to recognize pictures or understand text.</p><p>You can create really smart programs that can learn from data.</p><p>Why do you need it? If you want to get into AI and make machines that can think a bit like humans, TensorFlow is your go-to tool.</p><h3>9. <a href="https://www.selenium.dev/">Selenium</a></h3><p>Selenium tests websites for you. If you build a website and want to make sure all the buttons work and no errors pop up, you can use Selenium to do the job automatically.</p><p>Plus, you don’t have to test everything by yourself. Selenium can do it faster and more accurately. It saves time and helps you find bugs quickly.</p><h3>10. <a href="https://pnpm.io/">pnpm</a></h3><p>pnpm is the package manager I install before writing my first line of JavaScript.</p><p>It installs dependencies faster while using dramatically less disk space than traditional package managers.</p><p>Why should you learn it?</p><p>Once you switch to pnmp, it’s difficult to go back :)</p><h3>11. <a href="https://dbeaver.io/">DBeaver</a></h3><p>DBeaver is my favorite open-source database client.</p><p>It supports PostgreSQL, MySQL, SQLite, SQL Server, MongoDB, and dozens of other databases from one interface.</p><p>One tool for nearly every database. Why should you learn it?</p><p>Sooner or later, every developer needs to inspect data directly.</p><h3>My Advice to New Developers</h3><p>One mistake I made early in my career was constantly chasing new frameworks.</p><p>Every month there was something “better.” Eventually I realized that frameworks change.</p><p>Good engineering habits don’t.</p><p>Learning a new framework might take a weekend. Building a productive development workflow pays dividends for years.</p><p>If you’re just starting out, I’d spend less time asking:</p><p>“What’s the hottest framework?”</p><p>and more time asking:</p><p>“What tools will make me a better engineer every single day?”</p><p>That’s a much better long-term investment.</p><p><strong>Read more:</strong> If you’re interested in writing cleaner, more maintainable JavaScript, not just shipping code that works, you might also enjoy my book:</p><p>📘 <a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><strong>Clean Code Zero to One</strong></a></p><p>Inside, I cover practical clean code principles, design patterns &amp; data structure rules, project organization, <a href="https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic">reusable patterns</a>, and real-world JavaScript examples that have helped me build production applications over the years.</p><p>You can subscribe to my weekly newsletter <a href="https://horsecoder.beehiiv.com/">Horsecoder</a> for latest AI agent building tactics and programming news. You can also read some of my articles from <a href="https://www.linkedin.com/newsletters/mindset-for-programmers-7154918262978269184/">Mindset for Programmers</a> on my LinkedIn profile.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a54904f347bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built an Unblockable AI Agent for Browser Automation with JavaScript, Bright Data, Gemini, and…]]></title>
            <link>https://towardsdev.com/i-built-an-unblockable-ai-agent-for-browser-automation-with-javascript-bright-data-gemini-and-d20607972a4b?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/d20607972a4b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 20:36:00 GMT</pubDate>
            <atom:updated>2026-07-13T20:36:00.908Z</atom:updated>
            <content:encoded><![CDATA[<h3>I built an Unblockable AI Agent for Browser Automation with JavaScript, Bright Data, Gemini, and Playwright</h3><p><strong>In this full guide, you’ll learn:</strong></p><ul><li>📛 Why <a href="https://medium.com/stackademic/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">most AI browser agents fail</a> on modern websites.</li><li>🧱 How browser fingerprinting and anti-bot systems work.</li><li>⛑️ How to build an AI browser agent using JavaScript (Node.js) that combines Gemini, <a href="https://playwright.dev/">Playwright</a>, and <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data</a> to browse real websites, extract live data, analyze, reason, and generate reports locally without maintaining fragile anti-bot infrastructure ourselves that breaks 5 days later.</li><li>🗃️ How to setup Bright Data production-ready <a href="https://get.brightdata.com/free-proxies">browser sessions</a> for AI agent automation without user’s assistance manually.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFGWyBZ5Xve3LWLE8ZLNqg.gif" /><figcaption>image by author</figcaption></figure><h3>🪁Introduction</h3><p>Building unrestricted anonymous browser automation has developed far beyond writing Playwright scripts that click buttons and scrape HTML. Modern websites actively detect automated traffic using <a href="https://www.firefox.com/en-US/features/block-fingerprinting/">browser fingerprints</a>, <a href="https://www.ibm.com/docs/en/ibm-mq/10.0.x?topic=tls-digital-signatures-in-ssltls">TLS signatures</a>, IP reputation, and behavioral analysis, making reliable automation significantly more challenging than it was just a few years ago.</p><p>Modern AI browser agents don’t usually fail because they’re arbitrary. Their reasoning, prompts, and planning loops are often sophisticated. The execution layer underneath is fragile.</p><p>Most tutorials show how to connect an LLM to a browser, execute a few <a href="https://docs.brightdata.com/integrations/playwright">Playwright commands</a>, and declare you’ve built an autonomous agent.</p><pre>await page.goto(url)<br>await page.click(selector)<br>await page.type(selector, text)</pre><p>In reality, you’ve ONLY automated a browser. Commercial sites don’t gauge how intelligent your agent is. They judge whether they believe your browser is genuine.</p><p>Before a page even finishes loading, they inspect what your browser actually is: the <a href="https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/">TLS handshake</a>, IP reputation, browser fingerprints, <a href="https://www.todetect.net/article/canvas/webgl-fingerprint/">canvas and WebGL fingerprints</a>, cookies, device characteristics, and even the rhythm of your connection. Dozens of signals are examined in the time it takes the page to start loading.</p><p>If those signals don’t look authentic, your agent rarely reaches the real application. Instead, it encounters CAPTCHA challenges, verification pages, <a href="https://wiki.c2.com/?QuickSilentRedirect=">silent redirects</a>, incomplete datasets, or <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200">HTTP 200 responses</a> that quietly return entirely different content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*BL6KenWoXX6xCwW_.png" /></figure><p>This is one of the biggest challenges in modern browser automation:👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ce0gs1wKERiIBENj.png" /></figure><p>I’ve always wanted to <a href="https://blog.stackademic.com/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">build an autonomous software system</a> that could function on the web as naturally as a human, not another scraper that extracts a few HTML elements or another automation script that breaks the moment a production website changes.</p><p>Like many developers, I started with HTTP requests, graduated to browser automation, and eventually began building AI agents powered by large language models.</p><p>Along the way, I realized something surprising: intelligence without <a href="https://sajidalianjum.substack.com/p/ai-without-internet-how-offline-ai">reliable web access</a> is meaningless.</p><p>Fortunately, solving this problem doesn’t require <a href="https://fingerprint.com/blog/browser-fingerprinting-techniques/">building your own fingerprinting</a> or <a href="https://get.brightdata.com/bypass-antibot-walls">anti-detection infrastructure</a>.</p><p>Instead, we’ll let <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data handle browser identity</a>, network reputation, and anti-bot bypass while our AI agent focuses on reasoning and execution.</p><p>Because on today’s web, access is an engineering problem.</p><h3>🏗️ What We Are Building</h3><p>By the end of this article, we’ll build a fully functional browser automation AI agent called <strong>SIKKI Agent</strong>.</p><p>Think of it as an unpaid intern who somehow thinks harder at 3 a.m. than I do: it clicks, scrolls, extracts products, grabs ratings, checks prices, and patiently does the repetitive work I’d rather avoid; the <a href="https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic">most overqualified intern you’ll never have to pay.</a></p><p>The entire project is built with plain JavaScript. No proprietary framework. No billion-dollar AI platform. Just Node.js, Playwright, Bright Data, and Gemini working together.</p><p>Here’s a quick overview of what we’re going to build:</p><p>{% youtube <a href="https://youtu.be/1AFVtiBkcxQ">https://youtu.be/1AFVtiBkcxQ</a> %}</p><blockquote><strong><em>🍋‍🟩Note:</em></strong><em> The complete source code is available on GitHub at the end of this article.</em></blockquote><p>At a high level, the agent follows this workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zu5GhWx2uf1kpKTz.png" /></figure><p>And this is the engineering architecture we’ll build throughout the tutorial:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3zZ0VcA4a9Z4zK1P.png" /></figure><h3>🪪 Prerequisite</h3><ul><li><strong>Basic JavaScript/TypeScript or Python. E</strong>ven though I used javascript all over this project, you can follow through this article if you know any programming language. But familiarity with asynchronous programming (async/await) is required, as both scraping and AI calls rely heavily on it.</li><li><strong>Fundamental Node.js or Python Environment:</strong> Ability to install packages via npm or pip and manage local environment variables (.env).</li><li><strong>API Keys:</strong> Active accounts and API keys for both <a href="https://aistudio.google.com/">Google AI Studio (Gemini API)</a> and Bright Data. <strong>Both are free to use.</strong></li><li><strong>Basic DOM Understanding:</strong> A general awareness of HTML structure, though our SIKKI AI agent will minimize the need for complex CSS selectors.</li></ul><p><strong>We will use:</strong></p><ul><li>Gemini as the reasoning engine</li><li>Node.js as the runtime</li><li>Playwright as the browser controller</li><li>Bright Data Scraping Browser as the cloud browser infrastructure</li><li>Memory and retry loops for robustness</li><li>Structured outputs and screenshots for observation</li></ul><p><strong>Our Sikki agent will:</strong></p><ul><li>Accept natural language goals</li><li>Plan browser actions dynamically</li><li>Connect to a remote cloud browser over CDP (Chrome DevTools Protocol)</li><li>Access real websites</li><li>Extract structured information</li><li>Take screenshots</li><li>Recover from failures</li><li>Produce clean results by itself</li></ul><p>But more importantly</p><p>You will understand <strong>why</strong> browser AI agents fail. Why local Playwright breaks. Why websites detect automation. Why browser identity matters.</p><p>And how modern AI agents separate rational thinking from execution to run successfully on the real web.</p><p>We are NOT building another toy model. We are building an architecture.</p><p>And like all architectures, we begin with the foundations.</p><h3>🧑‍🍼 Building Sikki Project</h3><p>In this section, I will show you how to setup Sikki project locally using Gemini, Playwright, and Bright Data and run a quick result in terminal to extract information from CNN website. You can skips this section if you know exactly how to integrate Gemini, Playwright, and Bright Data locally.</p><p>Then in the coming section, I will go deeper building the final Sikki agent engine by showing the blueprint and functional implementations step by step.</p><p>So lets start with a basic test to see whether our API keys and tech stacks are working properly:</p><h3>Step 1: ⛏️Create the Project</h3><p>Open terminal:</p><pre>mkdir sikki-agent<br>cd sikki-agent<br>npm init -y</pre><p>Enable ES Modules:</p><pre>npm pkg set type=module</pre><p><strong>Note:</strong> Node.js treats .js files as legacy CommonJS by default. We enable ES Modules to cleanly use modern import statements and native await commands at the root level of our AI agent script</p><p><strong>Now install the necessary dependencies:</strong></p><pre>npm install playwright</pre><p>npm install @google/genai npm install dotenv npm install chalk npm install ora</p><pre>Our project’s folder structure should look like this (create these other directories manually):</pre><pre>```js<br>sikki-agent<br> index.js<br> .env<br> screenshots/<br> reports/<br> package.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/0*Df5oZj4bgqfo2_PB.png" /></figure><h3>Step 2: 🗝️ Get Gemini API Key</h3><p>Go to: <a href="https://aistudio.google.com/">https://aistudio.google.com</a></p><p>Create Gemini API Key by creating a new project called “Sikki-Agent”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RsdJPgZGPKdp6zLt.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/0*uLBVGj3VlmxtcRkG.png" /></figure><p>Inside your .env file, paste your Gemini API key:</p><pre>GEMINI_API_KEY = your_gemini_api_key</pre><pre>BRIGHT_WS_ENDPOINT = //i will show you later</pre><h3>Step 3: 😶‍🌫️ Setting up Bright Data Cloud Browser Infrastructure</h3><p>Visit the official gateway link at <a href="https://get.brightdata.com/browser-api">Bright Data Browser-API </a>to log into your control panel dashboard.</p><p>Once you are inside the main console sidebar, do not search for generic proxy settings. Navigate directly to the <a href="https://get.brightdata.com/scraping-browser-signup"><strong>Web Access API</strong></a> section on the left-hand navigation menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L2i6Xu90b5CXD3TB.png" /></figure><p>Click on the Top right corner “Create API” and choose option labeled <strong>Browser API:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ESCa_4uxGjwSqXGw.png" /></figure><p>then click “continue” and name your API key or leave it default.</p><p>Now click “Add API”; you will find your unique <strong>WebSocket Connection Endpoint</strong>. Copy that first puppeteer/playwright endpoint starting with “wss://brd-customer-hl…” Paste it in your .env file in your local project.</p><pre>BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;</pre><p>It will look exactly like this perpetual connection string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/0*eHWjQ3P7QKCz3Jnk.png" /></figure><p>This is Because:</p><p>We are NOT launching:</p><pre>chromium.launch()</pre><p>Instead:</p><pre>chromium.connectOverCDP()</pre><p>Meaning: Your browser lives in the cloud.</p><p>To help you understand lets write a simple code block to browse CNN’s title from our local terminal using Playwright and Bright Data.</p><h3>Step 4: 🦧 Connect Playwright to Bright Data</h3><p>Inside your index.js file write that below to access CNN title from terminal:</p><pre>import { chromium }<br>from &quot;playwright&quot;;<br><br>const BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;<br>const browser =<br>await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT<br>);<br>const page =<br>await browser.newPage();<br>await page.goto(<br>&quot;https://cnn.com&quot;<br>);<br>console.log(<br>await page.title()<br>);</pre><p>If you run this on the terminal, you will see a real CNN website title has been shown. We successfully extracted information and displayed the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/0*-U3HYm7IXiLL6WDe.png" /></figure><p>If you now look at your Bright Data <em>event log</em> inside <strong>web access</strong> panel, you will see successful authentication. That means our BrightData and Playwright are working properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JOfR8eeaOmP24l75.png" /></figure><p>So connectOverCDP() does NOT launch a browser locally.</p><p>Instead, this is what happened:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gEc5N2tKHidkPgvW.png" /></figure><p>This separation is one of the most important notions in today’s browser agents:</p><blockquote><em>Your AI reasons locally. Your browser executes remotely.</em></blockquote><p>Hope that makes sense.</p><h3>🐦‍⬛ Going Deeper into SIKKI Agent Before Implementation</h3><blockquote><em>Wait! in this section I will not show you the actual Sikki codebase. I will explain the arthictecture behind SIKKI and how we will implement it in the next setion. You can skip this section if you want.</em></blockquote><p>Up until now, we have built something that resembles a browser automation script. We opened a cloud browser. We visited a website. We extracted information. And we displayed the results.</p><p>That is useful, but it is <strong>not intelligence</strong>.</p><p>The truth is that many developers stop at this stage and call their projects AI agents. They build a browser script, attach an LLM somewhere in the pipeline, and assume they have built something autonomous.</p><p><strong>I don’t think that’s enough.🙅‍♂️</strong></p><p>An autonomous agent is not defined by the presence of an LLM. It is defined by its ability to observe an environment, reason about the information it receives, decide on actions, execute those actions, and continue this cycle until it reaches its objective.</p><p>In other words:</p><p><em>The browser is not the agent. The model is not the agent. The agent is the system that connects both.</em></p><p>This is the architectural philosophy behind SIKKI.</p><h3>🪛 SIKKI is Not A Scraper</h3><p>I intentionally avoided calling SIKKI a scraper.</p><p>Scrapers collect data. Agents pursue goals.</p><p>Suppose I ask SIKKI:</p><blockquote><em>Find the best gaming laptop under $1000.</em></blockquote><p>A traditional scraper might return the following:</p><pre>ProductPriceAcer Nitro V$899ASUS TUF$949MSI Thin$979</pre><p>Useful. But not intelligent. An actual agent should ask:</p><ul><li>Which products exceed the budget?</li><li>Which product has the highest rating?</li><li>Which seller has the most reviews?</li><li>Which laptop offers the best price-to-performance ratio?</li><li>Is the market trending upward or downward?</li></ul><p>And finally:</p><blockquote><em>Which one would I personally recommend?</em></blockquote><p>That is no longer data extraction. That is reasoning. And that is the moment a browser becomes an intelligent e-commerce agent.</p><h3>🛣️ The Architecture Behind SIKKI</h3><p>Internally, SIKKI is composed of <strong>four independent layers.</strong> Each layer solves a completely different problem:</p><pre>SIKKI<br>Strategic Intelligence Commerce Kernel<br>┌──────────────────────────────┐<br>│ Browser Layer                │<br>│ Playwright + Bright Data     │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Extraction Layer             │<br>│ Product                      │<br>│ Price                        │<br>│ Rating                       │<br>│ Seller                       │<br>│ Availability                 │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ AI Layer                     │<br>│ Gemini                       │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Analysis Layer               │<br>│ Cheapest Products            │<br>│ Market Average               │<br>│ Competitor Comparison        │<br>│ Trend Analysis               │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>        Markdown / CSV<br>        Dashboard Export</pre><p>Because browser automation problems and reasoning problems are fundamentally different. If Gemini cannot understand your prompt, changing Playwright selectors won’t fix it.</p><p>If Bright Data cannot open a page, increasing Gemini’s context window won’t help. Each layer has a different responsibility. And each layer can evolve independently.</p><h3>🏙️ Building The Extraction Layer</h3><p>Let’s make SIKKI more useful. Instead of extracting a single CNN headline, let’s teach it how to understand products.</p><p>In the real world, commerce websites display several critical pieces of information:</p><ul><li>Product title</li><li>Current price</li><li>Rating</li><li>Review count</li><li>Seller information</li><li>Availability</li><li>Product link</li></ul><p>A human sees these immediately. Our goal is to teach the browser to see them too.</p><p>Inside Playwright, we can execute JavaScript directly in the page context using page.evaluate().</p><p>For example:</p><pre>const products = await page.evaluate(() =&gt; {const items = [];<br>    document.querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach(card =&gt; {<br>        const title =<br>          card.querySelector(&#39;h2 span&#39;)?.innerText;<br>        const price =<br>          card.querySelector(&#39;.a-price .a-offscreen&#39;)<br>          ?.innerText;<br>        const rating =<br>          card.querySelector(&#39;.a-icon-alt&#39;)<br>          ?.innerText;<br>        const link =<br>          card.querySelector(&#39;h2 a&#39;)<br>          ?.href;<br>        if(title &amp;&amp; price){<br>            items.push({<br>                title,<br>                price,<br>                rating,<br>                link<br>            });<br>        }<br>    });<br>    return items;<br>});<br>console.log(products);</pre><p>The output will look like this:</p><pre>[ {<br>   title: &quot;Acer Nitro V Gaming Laptop&quot;,<br>   price: &quot;$899&quot;,<br>   rating: &quot;4.5 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> },<br>{<br>   title: &quot;ASUS TUF Gaming A15&quot;,<br>   price: &quot;$949&quot;,<br>   rating: &quot;4.4 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> }<br>]</pre><p>At this point, SIKKI has eyes. But it still doesn’t know what it is looking at.</p><p>That is where Gemini enters the architecture.</p><h3>🧠 Giving SIKKI A Brain</h3><p>I personally think many developers misunderstand LLMs. Gemini is not a magical replacement for code. It is a reasoning engine. This makes it perfect for commerce intelligence.</p><p>After extracting products, we simply send structured JSON to Gemini.</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze the following products.<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest product<br>2. Average price<br>3. Best rated product<br>4. Summary of the market<br>5. Recommendation<br>`;</pre><p><strong>Gemini may answer:</strong></p><blockquote>I analyzed 12 products. The cheapest option is Acer Nitro V at $899.</blockquote><blockquote>The average market price is $942.</blockquote><blockquote>ASUS TUF has slightly better reviews but is more expensive.</blockquote><blockquote>Based on value and user ratings, Acer Nitro V provides the best balance between performance and affordability.</blockquote><p><em>Now SIKKI is not only obtaining information but also</em> analyzing <em>the output.</em></p><h3>🛸 Building the Final SIKKI Agent</h3><p>At this point, we already have everything we need.</p><ul><li>🌩️ A cloud browser powered by Bright Data</li><li>🧐 Playwright connected through CDP</li><li>⛑️ Gemini API access</li><li>🚚 A local Node.js project</li></ul><p>Now, let’s put everything together and build the final version of SIKKI.</p><p>The goal is straightforward:</p><ol><li>Open an e-commerce website.</li><li>Search for a product.</li><li>Extract product information.</li><li>Ask Gemini to analyze the results.</li><li>Export the findings into a Markdown report.</li></ol><p>By the end of this section, you will have a fully functional browser-use AI Agent running locally.</p><h3>Step 1: Create the Agent File</h3><p>Replace your previous local Sikki project index.js file (if you didn’t follow through with our initial “Building Sikki Agent” section) and import the required modules. Paste your Browser CDP endpoint inside your index.js file if you want instant access or follow best practice by creating an .env file (using the dotenv library) to secure your API keys:</p><pre>import &quot;dotenv/config&quot;; //to use environment variables from .env file<br>import fs from &quot;fs&quot;; //to read and write files<br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br>//api keys and endpoints from environment variables<br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;</pre><p>Initialize Gemini with a fixed prompt text first, then we will make it dynamic:</p><pre>//initialize the GoogleGenAI client with the Gemini API key<br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br>//the prompt to send to the Gemini API<br>const prompt = &quot;Write a short introduction to the Gemini API.&quot;; <br>const response = await ai.models.generateContent({<br>  model: &quot;gemini-2.5-flash&quot;,<br>  contents: prompt,<br>});<br>console.log(response.text);</pre><p>Here is the results in our local terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EMYj9svkSResDaeA.png" /></figure><h3>Step 2: Setup Playwright to connect to Bright Data’s WebSocket</h3><p>As I have already shown you how to set up Bright Data with Playwright earlier, I will go straight to searching for e-commerce products.</p><blockquote><em>Note: Unlike a Playwright’s normal local browser chromium.launch() we used chromium.connectOverCDP(). This browser runs inside Bright Data’s infrastructure. IP rotation, browser fingerprinting, and anti-bot protection are handled automatically. Your local machine only sends instructions.</em></blockquote><p>To test our playwright and bright data working properly, let’s search for “gaming laptops” from amazon:</p><pre>//setup Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br>const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br>  await browser.close();<br>}<br>main();</pre><p>Here is our terminal output 👇:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/0*21t90m5CQCtYH4kK.png" /></figure><p>You can replace Amazon with: BestBuy, Walmart, Product Hunt, g2, Ebay etc. The logic remains <strong>exactly</strong> the same.</p><h3>Step 3: Extract Product Information</h3><p>Now let’s collect structured data.</p><pre>// Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br>const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>  const products = await page.evaluate(() =&gt; {<br>    const data = [];<br>    document<br>      .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach((card) =&gt; {<br>        const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>        const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>        const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>        if (title &amp;&amp; price) {<br>          data.push({<br>            title,<br>            price,<br>            rating,<br>          });<br>        }<br>      });<br>    return data;<br>  });<br>  console.log(&quot;Step 3: Extract Product Information&quot;);<br>  console.log(products);<br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br>  await browser.close();<br>}<br>main();</pre><p>Our Result 👇:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BcmeUI-wJ42fH01o.png" /></figure><p>At this point, SIKKI has successfully observed the environment.</p><p>Now we give it the ability to reason.</p><h3>Step 4: Ask Gemini To Analyze The Market</h3><p>Create a prompt:</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;</pre><p>Generate:</p><pre>const result = await model.generateContent(prompt);<br>const analysis =<br>result.response.text();</pre><p>Terminal output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y9ZLAAZTgRch45Yz.png" /></figure><p>Here is the “Best reated product” result and analysis that I pasted from my terminal:</p><pre>### 3. Best Rated Product<br>There are three products tied for the highest rating of **5.0 out of 5 stars**:<br>1.  **HP OMEN 16&quot; Gaming Laptop Computer** (Intel Ultra 9 285H, NVIDIA GeForce RTX 5070 8GB, 16GB DDR5, 1TB PCIe SSD, 144Hz IPS WUXGA Display) at **$1,745.99**<br>2.  **HP OMEN 16 Slim RTX 5070 Gaming Laptop** (Intel Ultra 9 285H, NVIDIA RTX 5070, 32GB DDR5, 1TB SSD, 16&quot; FHD+ Anti-Glare) at **$1,929.00**<br>3.  **ASUS ROG Strix G16 Gaming Laptop** (Intel Core i7 14650HX, NVIDIA RTX 5060, 32 GB DDR5 RAM, 1 TB SSD, 16&quot; FHD+ LED Display, &amp; Gaming Accessories) at **$1,999.99**<br>**Analysis:** It&#39;s noteworthy that two HP OMEN laptops achieved perfect ratings, both featuring high-end Ultra 9 CPUs and RTX 5070 GPUs. <br>This suggests strong customer satisfaction with HP&#39;s premium gaming line. <br>The ASUS ROG Strix G16 also achieved a 5.0 rating, <br>despite having a slightly lower-tier GPU (RTX 5060) than the <br>HP OMENs in this bracket, possibly due to the included <br>&quot;Gaming Accessories&quot; and overall perceived value. <br>The Alienware product has no rating, so it cannot be considered here.</pre><p>Notice what just happened? The browser extracted raw information.</p><p>Gemini transformed it into business intelligence. That small architectural separation is what turns automation into an AI Agent.</p><h3>Step 5: Export The Sikki Market Report</h3><p>Now we save the scraped product data and Gemini analysis into real files.</p><p>Instead of dumping raw JSON into the output, the final agent:</p><ul><li>extracts clean product titles</li><li>normalizes URLs</li><li>writes a Markdown report</li><li>writes a CSV table</li><li>writes a short summary.txt dashboard</li></ul><p>Example report generation:</p><pre>const report = `<br># SIKKI Market Report<br>## Search Query<br>${query}<br>## Products<br>${JSON.stringify(products, null, 2)}<br>## Gemini Analysis<br>${analysis}<br>Generated: ${new Date().toISOString()}<br>`;<br>fs.writeFileSync(reportPath, report, &quot;utf8&quot;);</pre><p>You will see <strong>sikki-report.md</strong> after running this agent in your terminal.</p><p>Here is the full code:</p><pre>import &quot;dotenv/config&quot;; // use environment variables from .env file<br>import fs from &quot;fs&quot;;<br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;<br>if (!BRIGHT_WS_ENDPOINT) {<br>  throw new Error(&quot;Missing BRIGHT_WS_ENDPOINT environment variable.&quot;);<br>}<br>if (!GEMINI_API_KEY) {<br>  throw new Error(&quot;Missing GEMINI_API_KEY environment variable.&quot;);<br>}<br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br>async function retryWithBackoff(fn, maxRetries = 5, initialDelayMs = 2000) {<br>  for (let attempt = 1; attempt &lt;= maxRetries; attempt++) {<br>    try {<br>      return await fn();<br>    } catch (error) {<br>      const errorMsg = error?.message || error?.status || JSON.stringify(error);<br>      if (attempt === maxRetries) {<br>        console.error(`Final attempt failed. Error: ${errorMsg}`);<br>        throw error;<br>      }<br>      const delayMs = initialDelayMs * Math.pow(2, attempt - 1);<br>      console.log(`Attempt ${attempt} failed: ${errorMsg}`);<br>      console.log(`Retrying in ${delayMs}ms... (${attempt}/${maxRetries})`);<br>      await new Promise((resolve) =&gt; setTimeout(resolve, delayMs));<br>    }<br>  }<br>}<br>async function main() {<br>  let browser;<br>  try {<br>    browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>    const page = await browser.newPage();<br>    const query = &quot;gaming laptop&quot;;<br>    const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>    console.log(&quot;Connecting Playwright to Bright Data...&quot;);<br>    console.log(&quot;Navigating to:&quot;, searchUrl);<br>    await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>    const products = await page.evaluate(() =&gt; {<br>      const data = [];<br>      document<br>        .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>        .forEach((card) =&gt; {<br>          const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>          const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>          const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>          if (title &amp;&amp; price) {<br>            data.push({<br>              title,<br>              price,<br>              rating,<br>            });<br>          }<br>        });<br>      return data;<br>    });<br>    console.log(`Extracted ${products.length} products.`);<br>    const analysisPrompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;<br>    console.log(&quot;Sending products to Gemini for analysis (with retry logic)...&quot;);<br>    const analysisResult = await retryWithBackoff(async () =&gt; {<br>      return await ai.models.generateContent({<br>        model: &quot;gemini-2.5-flash&quot;,<br>        contents: analysisPrompt,<br>      });<br>    }, 5, 2000);<br>    const analysis = analysisResult.text || &quot;No analysis text returned.&quot;;<br>    const report = `# SIKKI Market Report<br>## Search Query<br>${query}<br>## Products<br>${JSON.stringify(products, null, 2)}<br>## Gemini Analysis<br>${analysis}<br>Generated: ${new Date().toISOString()}<br>`;<br>    fs.writeFileSync(&quot;sikki-report.md&quot;, report, &quot;utf8&quot;);<br>    console.log(&quot;Step 5: Export the Results&quot;);<br>    console.log(&quot;Report generated: sikki-report.md&quot;);<br>    console.log(&quot;Final analysis saved. Open sikki-report.md to review the result.&quot;);<br>    await browser.close();<br>  } catch (error) {<br>    console.error(&quot;Error:&quot;, error.message || error);<br>    if (browser) {<br>      await browser.close().catch(() =&gt; {});<br>    }<br>    process.exit(1);<br>  }<br>}<br>main();</pre><p>Here is the output of Sikki market report:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/0*IYM534rPhJujMYhj.png" /></figure><h3>Step 6: 📸Teach SIKKI To Capture Evidence</h3><p>Now that SIKKI can scrape product metadata, the next job is proof.</p><p>Capture evidence by taking:</p><ul><li>one search-results summary screenshot</li><li>a product card screenshot for the top result</li><li>direct product page screenshots for the highest-ranked items</li></ul><p>Here is how:</p><pre>const searchScreenshot = path.join(screenshotDir, &quot;search-results.png&quot;);<br>await page.screenshot({ path: searchScreenshot, fullPage: true });<br>const summaryPath = path.join(screenshotDir, &quot;top-product-summary.png&quot;);<br>await cards[0].screenshot({ path: summaryPath });</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KtEdrLPWcwXu9ie6.png" /></figure><h3>Step 7: Capture Every Product Page</h3><p>Now we’re able to extract product information using Bright Data (Playwright) without getting blocked by antibot walls, analyze the market using Gemini, and make a report that will be stored inside our /Reports directory. SIKKI should visit each selected product URL and save the page image and it should be graceful without error loops.</p><p><strong>Here is the fun part:</strong> we don’t want only search result screenshots; we want each product page detail picked by Gemini intelligence. We will generate up to five screenshots; the first screenshot will be a summary. The remaining 4 screenshots should be: top products and individual product details pages. They will be generated based on the user search query and carefully analyzed by Gemini.</p><p>Let’s update our code, but this code is too long to paste here (you should check my git repo) so I will explain what I am changing along the way.</p><p>Let’s first have a look at what changes our new updated code made. This time I will search for “ryzen processor”:</p><p>Key points we are making:</p><ul><li>normalize the URL first</li><li>visit the direct product page</li><li>wait briefly for the page to render</li><li>save up to 4 product screenshots</li></ul><p>Example:</p><pre>const normalized = normalizeAmazonUrl(p.url, p.title);<br>await retryWithBackoff(async () =&gt; <br> await page.goto(normalized, { waitUntil: &quot;domcontentloaded&quot;, timeout: 120000 }), <br> 3, <br> 1500<br>);<br>await page.waitForTimeout(800);<br>await page.screenshot({ path: outPath, fullPage: true });</pre><p>Here is our intelligent agent picking the top product from <a href="https://get.brightdata.com/codewithshahan">Bright Data’s extracted data</a> after a successful analysis and saving a screenshot inside the “screenshot” folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fzej9sh_DBVgBRKZ.png" /></figure><p>This turns SIKKI from “just data” into “evidence-backed market intelligence.”</p><h3>Step 8: Create a CSV Export</h3><p>A CSV file is essential for downstream analysis and makes the agent practical.</p><p>Write a simple export with:</p><ul><li>title</li><li>price</li><li>rating</li><li>normalized URL</li></ul><p>Example:</p><pre>const csvLines = [&quot;TITLE,PRICE,RATING,URL&quot;];<br>enriched.forEach((p) =&gt; {<br> const safe = (s) =&gt; `&quot;${String(s || &quot;&quot;).replace(/&quot;/g, &#39;&quot;&quot;&#39;)}&quot;`;<br> csvLines.push([safe(p.title), safe(p.price), safe(p.rating || &quot;&quot;), safe(p.url || &quot;&quot;)].join(&quot;,&quot;));<br>});<br>fs.writeFileSync(csvPath, csvLines.join(&quot;\n&quot;), &quot;utf8&quot;);</pre><p>The result is a readable products.csv file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*vUIXdTi0RtdSm4cY.png" /></figure><h3>Step 9: Generate A Dashboard Summary</h3><p>Finally, create a human-readable summary file with the important metrics.</p><p>Compute:</p><ul><li>total products extracted</li><li>cheapest offer</li><li>average price</li><li>best rated product</li><li>top 5 product summary</li></ul><p>Example:</p><pre>const priced = enriched.filter((p) =&gt; !isNaN(p.priceValue));<br>const cheapestObj = priced.length ? priced.reduce((a, b) =&gt; (a.priceValue &lt;= b.priceValue ? a : b)) : null;<br>const avgPriceVal = priced.length ? (priced.reduce((s, p) =&gt; s + p.priceValue, 0) / priced.length).toFixed(2) : “N/A”;<br>const bestRatedObj = enriched.slice().sort((a, b) =&gt; {<br> const ra = parseFloat((a.rating || “”).split(“ “)[0]) || 0;<br> const rb = parseFloat((b.rating || “”).split(“ “)[0]) || 0;<br> return rb — ra;<br>})[0] || null;</pre><p>Then write:</p><pre>const dashboard = [];<br>dashboard.push(“==================================”);<br>dashboard.push(“SIKKI MARKET DASHBOARD”);<br>dashboard.push(“==================================”);<br>dashboard.push(`Query: ${query}`);<br>dashboard.push(`Products Extracted: ${enriched.length}`);<br>dashboard.push(`Cheapest Product: ${cheapestObj ? `${cheapestObj.title} | ${cheapestObj.price}` : “N/A”}`);<br>dashboard.push(`Average Price: ${avgPriceVal === “N/A” ? “N/A” : `$${avgPriceVal}`}`);<br>dashboard.push(`Best Rated: ${bestRatedObj ? `${bestRatedObj.title} | ${bestRatedObj.rating || “N/A”}` : “N/A”}`);<br>dashboard.push(“\nTop 5 Products:”);<br>enriched.slice(0, 5).forEach((p, i) =&gt; {<br> dashboard.push(`${i + 1}. ${p.title} | ${p.price} | ${p.rating || “N/A”} | ${p.url || “N/A”}`);<br>});<br>fs.writeFileSync(dashboardPath, dashboard.join(“\n”), “utf8”);</pre><p>Lets have a look at the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TSMScrFPl57zDEzm.png" /></figure><p>That’s it for today. What we’ve built is a foundation, not a finished product. The interesting part is what you scale it into, and there’s a lot of room.</p><p>Here is the github repo of this project (SIKKI agent): <a href="https://github.com/codewithshahan/sikki-agent">https://github.com/codewithshahan/sikki-agent</a></p><h3>🏌️Where To Go From Here</h3><p>This article intentionally focused on the foundations. But SIKKI can become significantly more powerful. You can extend it with:</p><ul><li>🤹Multi-site product comparison</li><li>🔎Competitor tracking</li><li>⏰Scheduled market reports</li><li>📊Interactive dashboards</li><li>📈Price trend monitoring</li><li>🛍️Autonomous shopping assistants</li><li>🗃️Agent memory using databases</li><li>🍶Multi-agent workflows</li></ul><p>You could even create an agent that monitors hundreds of e-commerce websites every day and sends market intelligence directly to your inbox.</p><p>The possibilities become surprisingly large once you stop thinking of browser automation as scraping and start thinking about it as an intelligent system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7T6vXuwwjQXWh83r.png" /></figure><p><em>If you’re serious about mastering clean code and taking your programming career to the next level, then my book is for you:</em> <a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><em>Clean Code Zero to One</em></a><em>. I am offering a 50% discount using the code “earlybird” during checkout ;only for the first 50 copies! Plus, enjoy a 30-day money-back guarantee. no risk, all reward.</em></p><h3>🏁Conclusion</h3><p>Many developers think AI Agents begin with LLMs. I think they begin with <a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one">architecture</a>. An agent is not just a prompt.</p><p>It is not just a browser. It is not just an API.</p><p>It is the coordination between observation, reasoning, and action.</p><p>That is why I built SIKKI: What began as a simple browser session eventually became something much more interesting.</p><p>A system capable of exploring the web, interpreting information, and transforming raw data into actionable knowledge.</p><p>And I am convinced this is only the beginning.</p><p>The future of browser automation isn’t scraping pages anymore. It’s building agents that can understand them.</p><h3>🧲 Frequently Asked Questions</h3><h3>1. Why use Bright Data instead of running Playwright locally?</h3><p>Local Playwright is perfect for development and testing, but production websites often evaluate browser fingerprints, IP reputation, TLS signatures, and other anti-bot signals before serving content. <a href="https://get.brightdata.com/scraping-browser-signup">Bright Data</a> provides a production-ready browser infrastructure that handles these challenges behind the scenes that allows your AI agent to interact with websites more reliably while you focus on building application logic.</p><h3>2. Do I still need Playwright if I’m using Bright Data?</h3><p>Yes. Bright Data and Playwright solve different problems. <a href="https://playwright.dev/">Playwright</a> controls the browser by clicking, typing, navigating, and extracting data, while <a href="https://get.brightdata.com/scraping-browser-signup">Bright Data</a> provides a cloud browser environment designed to access modern websites reliably. Together they create a much more robust browser automation stack than using either tool alone.</p><h3>3. What kinds of AI agents can I build with Bright Data?</h3><p>Once you have reliable browser access, the possibilities extend far beyond web scraping. The same architecture can power shopping assistants, market research agents, competitor monitoring systems, travel assistants, browser testing agents, lead generation workflows, news monitoring, and autonomous research assistants. By combining an LLM for reasoning, Playwright for browser control, and Bright Data for browser infrastructure, you can build AI agents capable of operating on real websites with minimal changes to the overall architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d20607972a4b" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/i-built-an-unblockable-ai-agent-for-browser-automation-with-javascript-bright-data-gemini-and-d20607972a4b">I built an Unblockable AI Agent for Browser Automation with JavaScript, Bright Data, Gemini, and…</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Bypass Anti-Bot Walls for Production-Ready Apps]]></title>
            <link>https://javascript.plainenglish.io/how-to-bypass-anti-bot-walls-for-production-ready-apps-7de5bf0891b7?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/7de5bf0891b7</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Thu, 09 Jul 2026 06:02:20 GMT</pubDate>
            <atom:updated>2026-07-10T10:05:21.322Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADjJrp6Hzox-xVgspIZ0VQ.png" /><figcaption>Image by author</figcaption></figure><p>In this guide, you’ll learn:</p><ul><li>Why traditional scraping approaches fail against modern anti-bot systems, even when using rotating User-Agents or browser automation.</li><li>How enterprise websites actually detect and block automated traffic through fingerprinting, reputation scoring, behavioral analysis, and network signals.</li><li>How to architect a production-ready scraping pipeline using cloud browsers, proxies, and AI agents instead of brittle scripts.</li><li>How to build a multi-target autonomous agent called <strong>Vanguard</strong> that can reliably collect data from modern websites at scale.</li></ul><p>If you’re anything like me, you’ve probably found that many web scraping tutorials stop being useful the moment you point them at a real production website.</p><p>The common advice is surprisingly predictable: use<em> fetch()</em>, automate a browser with <a href="https://autify.com/blog/playwright-vs-puppeteer">Playwright or Puppeteer</a>, rotate a User-Agent, maybe add a proxy, and you’re supposedly ready to scrape almost anything.</p><p>That approach might work against a small personal website. It usually falls apart against companies like Amazon, Product Hunt, G2, Walmart, or CNN.</p><p>Developers often assume anti-bot protection is just another HTTP check that can be bypassed by changing a few request headers. Modern detection systems work very differently: they review browser fingerprints, TLS characteristics, IP reputation, behavioral patterns, request timing, JavaScript execution, and dozens of other signals before deciding whether your traffic looks human.</p><p>Changing your User-Agent is only one tiny piece of that puzzle.</p><p>To understand why so many automation projects eventually fail, we first need to understand how modern <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">Web Application Firewalls (WAFs)</a> actually inspect and classify traffic.</p><p><strong>Corporate website’s WAF ecosystem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*CkL5isup9Hj-B9843b3Xzg.png" /><figcaption>Corporate website’s WAF ecosystem</figcaption></figure><p>If you’ve built automation that kept getting blocked after a few days, you’re not alone. I’ve written far more broken scraping systems than successful ones, and every failure taught me something about how these defenses actually work.</p><p>The good news is that the problem usually isn’t your code. It’s the architecture behind it.</p><p>Throughout this guide, we’ll look beyond individual requests and focus on designing systems that can survive production environments. Regardless of how you’re building a price-monitoring platform, collecting market intelligence, or <a href="https://get.brightdata.com/codewithshahan-scraping-browser">fueling AI agents with fresh web data</a>, the underlying principles remain the same.</p><p>By the end, you’ll understand the mechanics behind modern bot detection and build a fully operational multi-target agent called Vanguard. More importantly, you’ll understand <em>why</em> its architecture continues working long after traditional scraping scripts have failed.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs8tXrYsGmUY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds8tXrYsGmUY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs8tXrYsGmUY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href">https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href</a></iframe><p><strong>Prerequisite:</strong> All examples use plain JavaScript with Node.js so we can focus on the underlying architecture instead of framework-specific details</p><h3>I — The Illusion of the Clean Browser</h3><p>When an automation script fails, developers immediately look for a quick proxy patch. They focus on changing their actions to make progress toward the goal (which is low impact) instead of fundamentally changing how their connection behaves so that success naturally follows (which is high impact).</p><p>Typically, developers write a script, test it on their local machine, and watch it succeed. They look at a target link (e,g.<a href="https://www.amazon.com/s?k=ddr5+ram+128gb,"> https://www.amazon.com/s?k=ddr5+ram+128gb),</a> paste it into their personal browser, and see the clean results page layout load instantly without a single CAPTCHA block:</p><figure><img alt="normal agentic script for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/800/1*KWlou6_OorKdl-ZN4r9efQ.gif" /></figure><p>They assume the target is wide open. But they are trying to build a great pipeline on a rotting foundation.</p><p>Your personal browser loads that link because it brings a lifetime of clean human history. It presents a validated residential IP address, deep cookie pools, active browser session context, and a highly complex, hardware-accelerated <a href="https://fingerprint.com/blog/what-is-tls-fingerprinting-transport-layer-security/">TLS cryptographic fingerprint</a>. Your browser doesn’t have to “grind” or “prove” it’s human; its natural behavior inherently aligns with what the security system requires.</p><p>A vanilla automated script has none of this context. To show you exactly how fast a standard production system rejects unmanaged automation, let’s look at the naive code most engineers write when they are being lazy.</p><h3>II — The Anatomy of an Immediate Rejection</h3><p>If you want to understand how anti-bot engines work, you must look at how they treat raw, unmanaged server requests.</p><p>If this doesn’t make sense, let’s run through an example.</p><p>When you execute this, your connection is dropped. Amazon’s WAF doesn’t care that your string header says “Mozilla”. It looks at the <a href="https://github.com/CarterPerez-dev/Cybersecurity-Projects/blob/main/SYNOPSES/intermediate/JA3.JA4.TLS.Fingerprinting.Tool.md">TCP handshake</a> behavior, notices that your <a href="https://www.tenable.com/audits/items/CIS_MS_IIS_10_v1.2.1_Level_2.audit:402c63d34c7c6a259868d26c647860af">TLS cipher suite order</a> doesn’t match an actual Windows Chrome installation, maps your datacenter or unrotated local IP, and flags the machine instantly.</p><p>So… security systems read what your connection does. Your headers are irreverent. Take a look:</p><figure><img alt="amazon anti bot walls firewall" src="https://cdn-images-1.medium.com/max/1024/1*1OT-lDFIr9QKjBEBGKFGZA.png" /></figure><figure><img alt="how bot protection works on corporate sites" src="https://cdn-images-1.medium.com/max/1024/1*gBVrQTaGsYH0AwUxS3672Q.png" /><figcaption>Concept art by <a href="https://medium.com/u/f63fe8afc87">Shahan Chowdhury</a></figcaption></figure><p>Do you think the real human browser has to “grind” to bypass a CAPTCHA? Does their machine have to trick the target to load a product page? To you, it may seem like a <a href="https://dev.to/codewithshahan/your-first-backend-application-using-nodejs-45i">basic request </a>on the surface, but the truth is that the security gateway cannot see them as anything other than authentic. The human browser has to try incredibly hard to trigger an anti-bot wall. The bare automated script has to force its way through a firewall, and <a href="https://www.buzzstream.com/blog/publishers-block-ai-study/">it gets flagged every single second of it.</a></p><p>To some developers, a professional enterprise proxy mesh seems extreme and over-engineered. To me, it’s natural, and I don’t say that to contrast it with any other kind of architecture. I simply enjoy running production systems that do not break. When my peers tell me that I should just use a basic string rotation utility… I hold my tongue from telling them, “If your scripts are constantly breaking, why are you doing what you’re doing?”</p><p>This next sentence may sound simple, <em>but it is baffling how many people don’t get it.</em></p><p>If you want to scrape enterprise websites reliably, the request itself is only part of the equation. Modern Web Application Firewalls (WAFs) inspect your browser fingerprint, network behavior, TLS fingerprint, session history, <a href="https://www.ipqualityscore.com/ip-reputation-check">IP reputation</a>, and many other signals before deciding whether you’re a legitimate user or an automated bot.</p><p>To understand why most scraping scripts eventually fail, we first need to look at how modern WAFs make those decisions.</p><h3>III — The “Fake” 200 Response Trap</h3><p>Lets look at a real-world scenario where all corporate websites play with agentic AI developers by using <em>“soft block”</em> tricks. I will be using<a href="https://www.npmjs.com/package/axios"> </a><a href="http://node.js/">Node.js</a> <a href="https://www.npmjs.com/package/axios">axios</a> library locally to send asynchronous network requests to REST endpoints, in this case our target URL endpoint is Amazon’s DDR5 ram listing page (you can use any website you like for scraping data):</p><pre>// The Lazy Scraping Pattern (Guaranteed to fail at scale)<br><br>const axios = require(&#39;axios&#39;);<br>async function naiveScrape() {<br>const targetUrl = &#39;https://www.amazon.com/s?k=ddr5+ram+128gb&#39;;<br>try {<br>const response = await axios.get(targetUrl, {<br>headers: { &#39;User-Agent&#39;: &#39;Mozilla/5.0…&#39; }<br>});<br>console.log(&quot;Success! Status:&quot;, response.status, &quot;Data Length:&quot;,<br>response.data.length);<br>} catch (error) {<br>console.error(&quot;Blocked!&quot;);<br>}<br>}<br>naiveScrape();</pre><p>If you run this code inside your terminal right now, you might see an output that looks exactly like this:</p><figure><img alt="amazon soft block exposes with 200 respose status in terminal" src="https://cdn-images-1.medium.com/max/803/1*Y9Pr9zxoNGoIdoOEr5XP6Q.png" /></figure><p>When scraping a gigantic popular website, a 200 OK response status is often a false victory. Large e-commerce sites use a technique called a <strong>Soft Block</strong>.</p><p>You look at that output. You see nearly a megabyte of data. You see no errors. You see a pristine “200 Success” code. You assume your <a href="https://dev.to/codewithshahan/writing-clean-reusable-components-in-react-best-practices-2gka">code cleanly outsmarted the infrastructure</a>. You are wrong.</p><p>This is the cleverest trap in modern web architecture. High-tier platforms rarely throw a loud <a href="https://seocom.agency/en/blog/web-errors-404-403-503-502-401-meaning-and-solutions/">403 Forbidden or 503 Error code</a> to standard scripts anymore. If they give you an error code, you know instantly you’re blocked, and you immediately start changing your code.</p><p>Instead, they route your connection away from the raw data asset entirely. Let’s prove exactly what is inside that 650KB+ length data string. Add these logging lines directly into your try block inside the above codeblock:</p><pre>console.log(&quot;Does it contain Amazon&#39;s soft-block tag?&quot;, response.data.includes(&quot;a-no-js&quot;));<br>console.log(&quot;First 300 characters of the page code:\n&quot;, response.data.substring(0, 300));</pre><p>When you run it, you won’t see the actual marketplace data from amazon. You will see lines of obfuscated, tracking JavaScript loops meant to run in a real browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*4QLzOVjoNVSoetQPpjGytg.png" /></figure><p>See? Your terminal <em>exposed</em> the trap. The real clue is the content that was returned. Instead of the product page DOM you expected, Amazon responded with its <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-captcha-and-challenge.html">verification challenge wrapper</a>. In other words, AWS WAF intercepted your request and served a challenge page rather than the actual marketplace content because your script wasn’t operating as a real browser session. Because your script lacked a continuous browsing fingerprint, AWS WAF silently intercepted your connection and handed you a dead-end sandbox loop.</p><p>Your script spends precious compute power downloading and trying to parse almost a megabyte of empty authentication wrappers, completely blind to the fact that it didn’t capture a single item. Automated agents cannot run the tracking scripts required to clear that page, putting your pipeline at a complete dead end.</p><p>Even though a target website tricks your code with a fake success redirect or drops you completely with a <em>403</em> Forbidden block, you are losing the exact same thing: <strong>access to the data layer.:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3A0IQCmGDIWGnlK_83qmw.png" /></figure><p>I will now use CNN news website as target URL, instead of falling into Amazon’s tricky “soft block” trap, you will receive an instant block because they use <strong>Cloudflare</strong>, which will instantly reject your vanilla Axios request with a hard <strong>HTTP 403 Forbidden</strong> error code and crash the script. Have a look:</p><pre>const axios = require(&#39;axios&#39;);<br>async function naiveScrape() {<br>// Switching to a Cloudflare-protected target for a clean firewall error<br>const targetUrl = &#39;https://www.cnn.com/&#39;;<br>try {<br><br>console.log(&quot;Initiating naive data extraction request…&quot;);<br>const response = await axios.get(targetUrl, {<br>headers: {<br>&#39;User-Agent&#39;: &#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64)<br>AppleWebKit/537.36&#39;<br>}<br>});<br><br>console.log(&quot;Success! Data Length:&quot;, response.data.length);<br>} catch (error) {<br>console.error(&quot;\n❌ Request Crushed by Anti-Bot Wall.&quot;);<br>if (error.response) {<br>// This will capture and print the hard 403 error code<br>console.error(`Status Code: ${error.response.status}`);<br>console.error(`Status Text: ${error.response.statusText}`);<br>console.error(&quot;Reason: Cloudflare WAF rejected the vanilla Axios<br>handshake.&quot;);<br>} else {<br>console.error(&quot;Error Message:&quot;, error.message);<br>}<br>}<br>}<br>naiveScrape();</pre><p><strong>Here is the result inside the terminal:</strong></p><figure><img alt="agent get blocked by CCN’s cloudflare" src="https://cdn-images-1.medium.com/max/801/1*IqHJCXriGpCsAdsWRi0nMQ.png" /></figure><p>A 403 Forbidden error is universally recognized by developers as a <a href="https://brightdata.com/blog/leadership/web-unlocker-site-unblocking-capabilities"><strong>hard security rejection</strong>.</a> It removes all ambiguity. The errors will be the same for<a href="http://g2.com/"> g2.com</a> or any other protected sites and your automated agents cannot run that script, so your code is completely stuck at a dead end.</p><h3>IV — Moving to an Automated Gateway</h3><p>I realized I couldn’t spend my life engineering custom solutions for every single browser fingerprint update, JS challenge modification, or proxy rotation algorithm. It’s an endless game of whack-a-mole. I needed a production-ready infrastructure that handled the network-level deception for me so I could focus purely on writing data logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zss3CQrkl6NqNHF0YWK0Dg.png" /></figure><p>That is why I migrated this workflow to <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data’s Web Unlocker</a>. It treats the entire bypass pipeline as a simple managed endpoint. It acts as an abstraction layer that intercepts your raw request, automatically executes the necessary TLS handshakes, decrypts hidden challenges, mimics human behavior, and pipes back the clean HTML data.</p><p>Here is exactly how to set this up and test it without turning your local computer into a messy testing ground.</p><h4>Step 1: Account Activation and Token Generation</h4><p>First, you need access to the proxy cluster infrastructure.</p><ol><li>Sign up for a console dashboard account on <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data Web Unlocker</a>.</li><li>From the main dashboard sidebar, navigate to <strong>Web Access</strong>:</li></ol><figure><img alt="Bright data web unlocoker setup for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/1024/1*c6fCPuncBiv2DTgBixjmYA.png" /></figure><p>3. Select <strong>Web Unlocker API </strong>and press continue. This is the specialized cluster that houses the machine-learning-driven browser emulation layer:</p><figure><img alt="Bright data web unlocoker api setup for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/1024/1*fWK0en34LvSVSdGnoeX8Pg.png" /></figure><p>4. Name your routing zone (default is: web_unlocker1), activate it, and generate an API Token by clicking into the “API key” box.</p><p>5. Allow Your Server IP: Before sending requests, there’s one important configuration step that’s easy to miss.</p><p>Open your Web Unlocker zone settings, go to the configuration tab, then security settings, and finally check <strong>Allowed IPs</strong>. Make sure to add your current IPs in the allowlist. Go to “Configuration, then “Security Settings”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*EloMNNQcteIKwxsAORC-Ww.png" /></figure><p>Here is “Add allowed IP” box. Paste your current IP from your machine or check “recent IPs allowlist”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*GhFQkkdCIEdcHq4Udt6wCA.png" /></figure><p>Without this step, your API key may be valid and your zone may be configured correctly, but your requests can still fail because <a href="https://brightdata.com/blog/proxy-101/proxy-error-codes">Bright Data rejects connections from unauthorized IP addresses</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*0ZXwMs_IFSEfQ4vQfC2sOg.png" /></figure><p>Once your IP has been added and the changes have propagated, you’re ready to send your first request.</p><h4>Step 2: Testing Inside the Native Playground</h4><p>Before you deploy a single line of application code to your servers, you can visually verify that the unlocking layer works by using their <a href="https://get.brightdata.com/browser-api">built-in Playground</a>. It allows you to run requests directly from the cloud console to check how targets respond.</p><ol><li>Paste your target address directly into the <strong>Target URL</strong> field. For example: <a href="https://www.amazon.com/s?k=ddr5+ram+128gb">https://www.amazon.com/s?k=ddr5+ram+128gb</a></li><li>Keep the configuration to <strong>API</strong> mode and device type to <strong>desktop.</strong></li><li>Hit the blue <strong>Run Request</strong> button:</li></ol><figure><img alt="Bright data web unlcoker built in playground for web access without getting blocked" src="https://cdn-images-1.medium.com/max/1024/1*Zej2mP90U6GuhmxBLpZ9yg.png" /></figure><p>The interface will display a green<em> RESPONSE 200</em> success state. If you look at the bottom visual block, you’ll see a rendering preview of the exact Amazon product directory list. You’ll also find the pure market tables and real product tags by managing to bypass the <em>security wall</em> without any problems.</p><p>It is a 3-in-1 tool that manages IP rotation, dynamic browser fingerprinting, and CAPTCHA solving automatically. <a href="https://get.brightdata.com/bypass-antibot-walls">The API bypasses the anti-bot wall</a> and returns the clean HTML source code to the software in a single response.</p><p><strong><em>Note on verification:</em> </strong>If you download that specific raw response file from the playground UI, your computer will automatically open it up inside a local web browser, rendering it visually. If you want to see the actual raw data your backend will process, simply open that downloaded file with a basic text editor like VS Code. You will find thousands of lines of pristine, uninhibited DOM structural code strings.</p><h3>V — Building LaunchRadar Agent</h3><p>If you are trying to feed live web data into an LLM using basic Axios configurations or unmanaged connection structures, you are forcing your AI agent to ride a bicycle with flat tires. Modern security layers look for advanced browser behaviors and TLS cipher sequences. If you try to manually concatenate your configuration parameters as raw text blocks, a single trailing comma will break strict backend string parsing, throwing a frustrating 400 Bad Request or an empty payload block.</p><p>Therefore, we need to install Bright Data’s official SDK in our project. With this, we completely eliminate Axios-style network proxy bugs and let Bright Data handle them.</p><p>Lets go trough the code blocks step by step to build our first AI agent using bright data. We are going to assemble a product hunt’s trend intelligence agent called LaunchRadar. Its target is specific: it bypasses the tracking walls of<a href="https://www.producthunt.com/"> Product Hunt</a>, ingests the real-time tech product feeds, and structures raw document strings into clean text data arrays ready to feed straight into an LLM context window.</p><h4>Setup LaunchRadar Project from Scratch</h4><p>To ensure your runtime application environment maps dependencies cleanly, we will completely drop out of folders controlled by cloud backup networks (like Microsoft OneDrive or iCloud) that lock active file permissions and disrupt local script loops.</p><p>Open your terminal window (Terminal app on macOS, or your preferred shell) and run these clean setup commands sequentially to construct an isolated project workspace from scratch:</p><pre># 1. Move directly to your local User Home root path to avoid file syncing errors<br>cd ~<br><br># 2. Provision a dedicated application folder<br>mkdir LaunchRadar<br><br># 3. Enter your newly initialized project workspace<br>cd LaunchRadar<br><br># 4. Initialize an isolated local package architecture<br>npm init -y<br><br># 5. Tell the Node.js runtime to process modern ES Module imports natively<br>npm pkg set type=&quot;module&quot;</pre><p>Now install the official bright data SDK locally using node.js:</p><pre>npm install @brightdata/sdk</pre><p>Now, create a fresh file named index.js inside your application directory workspace and paste this exact production script to scrap raw HTML data from Product Hunt:</p><pre>/**<br> * Project: LaunchRadar<br> * Core Stack: Node.js + Official Bright Data JavaScript SDK<br> */<br><br>import { bdclient } from &#39;@brightdata/sdk&#39;;<br><br>const BRIGHTDATA_KEY = process.env.BRIGHTDATA_API_KEY || &#39;&#39;;<br><br>async function deployLaunchRadar() {<br>    // Targeting Product Hunt&#39;s active daily launch asset path<br>    const targetUrl = &#39;https://www.producthunt.com/&#39;;<br>   <br>    console.log(&quot;🤖 [LaunchRadar]: Initializing autonomous target ingestion loop...&quot;);<br><br>    try {<br>        // Initialize the client gateway via the native constructor<br>        const client = new bdclient({<br>            apiKey: BRIGHTDATA_KEY<br>        });<br><br>        console.log(&quot;🤖 [LaunchRadar]: Tunneling through Web Unlocker cluster...&quot;);<br>       <br>        // Execute the single-step browser-emulated extraction natively<br>        const htmlResponse = await client.scrapeUrl(targetUrl, {<br>            zone: &#39;web_unlocker1&#39;,<br>            format: &#39;raw&#39; // Streams the target webpage as a raw HTML text string<br>        });<br><br>        console.log(&quot;\n=================== PIPELINE SUCCESS ===================&quot;);<br>        console.log(`🤖 [LaunchRadar]: Ingestion complete. Streamed: ${htmlResponse.length} bytes.`);<br>        console.log(&quot;========================================================\n&quot;);<br>       <br>        // This will print true-proving your paid credit bypassed the security loop<br>        const dataIsValid = htmlResponse.includes(&quot;Product Hunt&quot;);<br>        console.log(`🤖 [LaunchRadar]: Target Data Authenticated: ${dataIsValid}`);<br><br>        // Gracefully disconnect active execution sockets<br>        await client.close();<br><br>    } catch (error) {<br>        console.error(&quot;❌ [LaunchRadar Fatal]: Pipeline exception encountered.&quot;);<br>        console.error(`Reason: ${error.message}`);<br>    }<br>}<br><br>deployLaunchRadar();</pre><p>If you run that code inside your terminal window, you will see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*ob-VWM_Yj9029eJd_-JU4w.png" /><figcaption>LaunchRadar terminal output image</figcaption></figure><p><em>Congratulations! You extracted nearly a ~megabyte of raw HTML data. Now you understand how we can collect raw HTML data, it’s time to build our final agent application: </em><strong><em>Vanguard Agent. </em></strong><em>It interfaces directly with Bright Data’s official JavaScript SDK, targets the verified backend data pipeline endpoint natively, and bypasses the front-end rendering layer completely to return beautifully structured insights straight to your terminal window.</em></p><h3>VI — Building Our Final Vanguard Agent Application</h3><p>Now that Web Unlocker is handling browser fingerprinting, JavaScript challenges, TLS negotiation, and request routing behind the scenes, we can focus on the part that actually creates value: extracting useful information.</p><p>Now let’s build <strong>Vanguard Agent. </strong>It will work as a lightweight agent that searches live CNN articles, extracts relevant headlines, and automatically generates a structured Markdown report.</p><p>Instead of supporting multiple unrelated websites with different search endpoints and DOM structures, we’ll focus on a single production-quality example. The same architecture can later be extended to other targets by swapping the parser while keeping the networking layer exactly the same.</p><p>First, install Cheerio:</p><pre>npm install cheerio</pre><p>Then, trigger the Bright data SDK request with the following:</p><pre>const htmlResponse = await client.scrapeUrl(targetUrl, {<br>zone: &quot;web_unlocker1&quot;,<br>format: &quot;raw&quot;,<br>country: &quot;us&quot;,<br>dataFormat: &quot;html&quot;<br>});</pre><p><em>dataFormat: “html”</em> is the correct SDK option for returning rendered HTML. Browser emulation is already handled internally by Web Unlocker, so no additional rendering flag is required.</p><p>Next I will point the application directly at CNN’s search endpoint. This produces reproducible search results while keeping the extraction logic straightforward.</p><p>After that, the HTML has been retrieved by Bright Data, Cheerio loads the document and extracts article links.</p><p>Once the extraction finishes, Vanguard writes the collected results into a Markdown report that can be consumed by downstream AI agents, summarization pipelines, or analytics workflows. I will explain more clearly inside the code blocks one by one.</p><p>Here is the full source code of our agent that is copy-pastable for testing on your local machine:</p><pre>/**<br>* Project: Vanguard Agent<br>* Function: Autonomous CNN Trend &amp; Headline Generator<br>* Core Stack: Node.js (ESM) + Official Bright Data JavaScript SDK + Cheerio<br>*<br>* IMPORTANT: CNN&#39;s own robots.txt disallows /search (Disallow: /search),<br>* so Bright Data&#39;s Web Unlocker refuses it in immediate-access mode —<br>* that&#39;s not a bug, it&#39;s the site opting out of that specific path for<br>* compliant bots. Instead, this hits CNN&#39;s own News Sitemap<br>* (https://www.cnn.com/sitemap/news.xml), which robots.txt explicitly<br>* lists as a Sitemap: entry — meaning it&#39;s meant to be fetched by bots.<br>* It contains real headline titles and real publish timestamps for the<br>* last ~48 hours of coverage across every section, which is arguably a<br>* better fit for &quot;trend monitoring&quot; than a search page anyway.<br>*/<br><br>import fs from &#39;fs&#39;;<br>import readline from &#39;readline&#39;;<br>import * as cheerio from &#39;cheerio&#39;;<br>import { bdclient } from &#39;@brightdata/sdk&#39;;<br>const REPORT_FILE = &#39;vanguard_trend_report.md&#39;;<br>const CNN_NEWS_SITEMAP = &#39;https://www.cnn.com/sitemap/news.xml&#39;;<br><br>// Key comes ONLY from the environment - no hardcoded fallback, ever.<br>// If a real key has been pasted into a file, a chat, or a log at any<br>// point, treat it as compromised and rotate it in your Bright Data<br>// dashboard immediately, even after removing it from the code.<br><br>const BRIGHTDATA_KEY = process.env.BRIGHTDATA_API_KEY || &#39;&#39;;<br>if (!BRIGHTDATA_KEY) {<br>    console.error(<br>        &quot;\n❌ [Vanguard Config Error] BRIGHTDATA_API_KEY is not set.\n&quot; +<br>        &quot;   Run it like this instead:\n\n&quot; +<br>        &quot;   PowerShell:   $env:BRIGHTDATA_API_KEY=\&quot;your_actual_key\&quot;; node vanguard.mjs\n&quot; +<br>        &quot;   cmd.exe:      set BRIGHTDATA_API_KEY=your_actual_key &amp;&amp; node vanguard.mjs\n&quot; +<br>        &quot;   macOS/Linux:  BRIGHTDATA_API_KEY=your_actual_key node vanguard.mjs\n&quot;<br>    );<br>    process.exit(1);<br>}<br><br>// CNN article URLs follow /YYYY/MM/DD/category/slug - used here purely to<br>// derive a topic category for the breakdown, not for date (the sitemap<br>// gives us a real publish timestamp directly).<br>const CNN_ARTICLE_PATTERN = /^\/(\d{4})\/(\d{2})\/(\d{2})\/([a-z0-9-]+)\//i;<br>const printDashboardHeader = () =&gt; {<br>    console.clear();<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; ┌────────────────────────────────────────────────────────┐&quot;);<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; │   VANGUARD INTELLIGENCE SERVICE // CNN TREND ENGINE     │&quot;);<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; └────────────────────────────────────────────────────────┘&quot;);<br>};<br><br>const promptUser = (queryMessage) =&gt; {<br>    const interfaceInstance = readline.createInterface({<br>        input: process.stdin,<br>        output: process.stdout<br>    });<br>    return new Promise((resolve) =&gt; {<br>        interfaceInstance.question(queryMessage, (inputAnswer) =&gt; {<br>            interfaceInstance.close();<br>            resolve(inputAnswer.trim());<br>        });<br>    });<br>};<br><br>function escapeRegExp(string) {<br>    return string.replace(/[.*+?^${}()|[\]\\]/g, &#39;\\$&amp;&#39;);<br>}<br><br>function categoryFromUrl(loc) {<br>    try {<br>        const path = new URL(loc).pathname;<br>        const dated = path.match(CNN_ARTICLE_PATTERN);<br>        if (dated) return dated[4].replace(/-/g, &#39; &#39;);<br>        // Some CNN URLs skip the date prefix entirely (e.g. video pages<br>        // like /politics/video/slug). Fall back to the first path segment<br>        // instead of dumping everything into &quot;uncategorized&quot;.<br>        const segment = path.split(&#39;/&#39;).filter(Boolean)[0];<br>        return segment ? segment.replace(/-/g, &#39; &#39;) : &#39;uncategorized&#39;;<br>    } catch {<br>        return &#39;uncategorized&#39;;<br>    }<br>}<br><br>async function deployVanguardService() {<br>    printDashboardHeader();<br>    console.log(&quot;\x1b[38;5;244m%s\x1b[0m&quot;, &quot;\n [CONFIGURE INTELLIGENCE FILTER]&quot;);<br>    const searchQuery = await promptUser(&#39;🔍 Enter a keyword to filter recent CNN headlines (e.g., startup, election, climate): &#39;);<br>    if (!searchQuery) {<br>        console.error(&quot;\n❌ [Vanguard Error] Input token context empty. Pipeline aborted.&quot;);<br>        return;<br>    }<br>    printDashboardHeader();<br>    console.log(`\n\x1b[38;5;214m🤖 [Vanguard]: Connecting to proxy fabric for target: ${CNN_NEWS_SITEMAP}\x1b[0m`);<br>    console.log(&quot;🤖 [Vanguard]: Initializing automated browser emulation...&quot;);<br>    const client = new bdclient({ apiKey: BRIGHTDATA_KEY });<br>    try {<br>        // dataFormat: &#39;html&#39; returns the raw response body as-is, which<br>        // works fine for XML too - we just parse it with cheerio&#39;s XML<br>        // mode below instead of treating it as an HTML page.<br>        const xmlResponse = await client.scrapeUrl(CNN_NEWS_SITEMAP, {<br>            zone: &#39;web_unlocker1&#39;,<br>            dataFormat: &#39;html&#39;,<br>            country: &#39;us&#39;<br>        });<br>        console.log(`\x1b[38;5;46m🤖 [Vanguard]: Data stream ingestion complete. Length: ${xmlResponse.length} bytes.\x1b[0m`);        if (!xmlResponse || xmlResponse.length &lt; 500) {            const preview = xmlResponse ? xmlResponse.slice(0, 300) : &#39;(empty response)&#39;;            throw new Error(                `Target returned only ${xmlResponse ? xmlResponse.length : 0} bytes - this is too small to be ` +                `a real sitemap. Raw response below:\n\n${preview}\n\n` +                `Checklist:\n` +                `  1. Confirm BRIGHTDATA_API_KEY is a valid, active key.\n` +                `  2. Confirm &#39;web_unlocker1&#39; matches an active Web Unlocker zone name in your ` +                `Bright Data dashboard - zone names are account-specific.\n` +                `  3. If the text above mentions a block/captcha, retry in a moment or try a ` +                `different &#39;country&#39; value.`            );        }        console.log(&quot;🤖 [Vanguard]: Processing resilient extraction analytics...&quot;);        // xmlMode: true keeps namespaced tags (e.g. news:title) intact        // instead of cheerio&#39;s default HTML-parsing/lowercasing behavior.<br>        const $ = cheerio.load(xmlResponse, { xmlMode: true });<br>        const insights = [];<br>        $(&#39;url&#39;).each((_, el) =&gt; {<br>            const loc = $(el).find(&#39;loc&#39;).first().text().trim();<br>            const title = $(el).find(&#39;news\\:title&#39;).first().text().trim();<br>            const pubDateRaw = $(el).find(&#39;news\\:publication_date&#39;).first().text().trim()<br>                || $(el).find(&#39;lastmod&#39;).first().text().trim();<br>            if (!loc || !title) return; // skip entries without a real headline (e.g. galleries/video-only)<br>            insights.push({<br>                title: title.replace(/\s+/g, &#39; &#39;),<br>                date: pubDateRaw ? pubDateRaw.slice(0, 10) : &#39;unknown&#39;,<br>                category: categoryFromUrl(loc),<br>                postUrl: loc<br>            });<br>        });<br>        const uniqueRawInsights = Array.from(new Map(insights.map(item =&gt; [item.postUrl, item])).values());<br>        // Sort newest first using the sitemap&#39;s own publish timestamp.        uniqueRawInsights.sort((a, b) =&gt; (a.date &lt; b.date ? 1 : a.date &gt; b.date ? -1 : 0));        // Whole-word match, not substring - plain .includes() would match        // &quot;war&quot; inside &quot;Warner&quot; or &quot;warrant&quot;, which are false positives        // for a search on &quot;war&quot;. \b enforces a real word boundary.        const keywordPattern = new RegExp(`\\b${escapeRegExp(searchQuery)}\\b`, &#39;i&#39;);        let filteredInsights = uniqueRawInsights.filter(item =&gt; keywordPattern.test(item.title));        // Phase 2: fallback to the newest overall headlines if no direct match        let isFallbackMode = false;        if (filteredInsights.length === 0) {            filteredInsights = uniqueRawInsights;            isFallbackMode = true;        }        const uniqueInsights = filteredInsights.slice(0, 10);        if (uniqueInsights.length === 0) {            throw new Error(&#39;Zero real headline entries isolated inside the sitemap buffer.&#39;);        }        const categoryCounts = uniqueRawInsights.reduce((acc, item) =&gt; {            acc[item.category] = (acc[item.category] || 0) + 1;<br>            return acc;<br>        }, {});<br>        const topCategories = Object.entries(categoryCounts)<br>            .sort((a, b) =&gt; b[1] - a[1])<br>            .slice(0, 5);<br>        console.log(&quot;\n\x1b[38;5;51m┌────────────────────────────────────────────────────────────────────────┐&quot;);<br>        console.log(`│ ► VANGUARD INTELLIGENCE STREAM // CNN // &#39;${searchQuery}&#39;`.padEnd(76, &#39; &#39;) + &#39;│&#39;);<br>        console.log(&quot;└────────────────────────────────────────────────────────────────────────┘\x1b[0m&quot;);<br>        if (isFallbackMode) {<br>            console.log(`\x1b[33m ⚠️ [Notice] No direct matches for &#39;${searchQuery}&#39;. Showing newest CNN headlines instead.\x1b[0m\n`);<br>        }<br>        uniqueInsights.forEach((item, index) =&gt; {<br>            console.log(` \x1b[38;5;46m[${String(index + 1).padStart(2, &#39;0&#39;)}]\x1b[0m \x1b[1m${item.title.substring(0, 75)}\x1b[0m`);<br>            console.log(`     ├─ Category : ${item.category}`);<br>            console.log(`     ├─ Date     : ${item.date}`);<br>            console.log(`     └─ Link     : \x1b[38;5;39m\x1b[4m${item.postUrl}\x1b[0m\n`);<br>        });<br>        console.log(&quot;\x1b[38;5;51m└────────────────────────────────────────────────────────────────────────┘\x1b[0m&quot;);<br>        console.log(&#39;\x1b[38;5;244m📊 Top categories in this result set:\x1b[0m&#39;);<br>        topCategories.forEach(([cat, count]) =&gt; console.log(`   • ${cat} (${count})`));<br>        const markdownReport = [<br>            `# Vanguard CNN Intelligence Digest`,<br>            `* **Search Keyword:** \`${searchQuery}\``,<br>            `* **Source:** CNN News Sitemap (robots.txt-approved)`,<br>            `* **Data Capture Status:** ${isFallbackMode ? &#39;Newest-headlines fallback&#39; : &#39;Direct keyword match&#39;}`,<br>            `* **Timestamp:** ${new Date().toISOString()}`,<br>            `\n## Top Categories`,<br>            ...topCategories.map(([cat, count]) =&gt; `* **${cat}** - ${count} article(s)`),<br>            `\n## Headlines`,<br>            ...uniqueInsights.map((p, idx) =&gt;<br>                `### ${idx + 1}. ${p.title}\n* **Date:** ${p.date}\n* **Category:** ${p.category}\n* **Link:** [${p.postUrl}](${p.postUrl})`<br>            )<br>        ].join(&#39;\n&#39;);<br>        fs.writeFileSync(REPORT_FILE, markdownReport, &#39;utf8&#39;);<br>        console.log(`\x1b[38;5;46m💾 [Vanguard] System Report written successfully -&gt; ${REPORT_FILE}\x1b[0m\n`);<br>    } catch (pipelineException) {<br>        console.error(&quot;\n❌ [Vanguard Fatal]: Operational routine aborted.&quot;);<br>        console.error(`Reason: ${pipelineException.message}`);<br>    } finally {<br>        await client.close();<br>    }<br>}<br>deployVanguardService();</pre><p>At this point, the application submits a keyword, retrieves the rendered page through Web Unlocker, extracts structured information, and generates a clean report automatically. The anti-bot layer is handled by the gateway, allowing your application to stay focused on parsing and processing data instead of maintaining browser fingerprints or bypass logic.</p><p>Here is our agent functionality; you can scale it as you wish:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs8tXrYsGmUY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds8tXrYsGmUY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs8tXrYsGmUY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href">https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href</a></iframe><p><em>If you’re serious about mastering clean code and taking your programming career to the next level, then my book is for you: </em><a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><em>Clean Code Zero to One</em></a><em>:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*9Z-I47x-DiI-hZF3NhbEqQ.png" /><figcaption>Clean Code Zero to One Book TOC</figcaption></figure><p><em>I am offering a 50% discount using the code “earlybird” during checkout, only for the first 50 copies! Plus, enjoy a 30-day money-back guarantee.</em></p><h3>VII — Moving Past The Anti-Bot Maintenance</h3><p>As websites continue strengthening their anti-bot systems, maintaining custom bypass logic becomes an increasingly expensive engineering task. Every browser update, fingerprinting change, or new challenge introduces additional maintenance that doesn’t contribute to your product.</p><p>Using a managed gateway such as Bright Data Web Unlocker shifts that responsibility away from your application. Instead of maintaining infrastructure that keeps requests alive, you can focus on collecting, processing, and analyzing the data your users actually care about.</p><p>Whenever you’re building AI agents, market intelligence platforms, monitoring systems, or large-scale data pipelines, separating anti-bot handling from your business logic results in software that is easier to maintain, easier to scale, and more reliable over time.</p><h3>Frequently Asked Questions</h3><h4>Can Web Unlocker scrape JavaScript-heavy websites?</h4><p>Yes. Web Unlocker performs browser emulation behind the scenes, allowing it to retrieve rendered HTML from websites that rely heavily on JavaScript, anti-bot challenges, or advanced fingerprinting.</p><h4>Do I still need to rotate proxies manually?</h4><p>No. Proxy rotation, browser fingerprint management, retry logic, and challenge handling are managed by the Web Unlocker infrastructure, so your application can focus on extracting data instead of maintaining network logic.</p><h4>Can I use this architecture for AI agents?</h4><p>Absolutely. AI agents often require reliable access to fresh web data. By separating data collection from application logic, you can feed structured information into LLM workflows without continually rebuilding scraping infrastructure.</p><h4>Can I extend Vanguard to other websites?</h4><p>Yes. The networking layer remains the same. In most cases, you only need to replace the target URL and update the parsing logic for the new site’s HTML structure while continuing to use the same Web Unlocker workflow.</p><h3>Before you go</h3><ul><li>Please take a moment to like the post and follow the writer!</li><li>Did you know that over 400,000 developers share what they’re building, learning, and discovering across our platforms every month? Learn how you can contribute <a href="https://plainenglish.io/write-for-us">here</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7de5bf0891b7" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-bypass-anti-bot-walls-for-production-ready-apps-7de5bf0891b7">How to Bypass Anti-Bot Walls for Production-Ready Apps</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build an unblockable AI agent for Browser Automation using Bright Data, Gemini, and…]]></title>
            <link>https://blog.stackademic.com/how-to-build-an-unblockable-ai-agent-for-browser-automation-using-bright-data-gemini-and-923ba11cac6b?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/923ba11cac6b</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 08:38:26 GMT</pubDate>
            <atom:updated>2026-07-06T08:38:26.530Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Build an unblockable AI agent for Browser Automation using Bright Data, Gemini, and Playwright</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFGWyBZ5Xve3LWLE8ZLNqg.gif" /><figcaption>image by author</figcaption></figure><p>Building unblockable browser automation agents has developed far beyond writing Playwright scripts that click buttons and scrape HTML. Modern websites actively detect automated traffic using <a href="https://www.firefox.com/en-US/features/block-fingerprinting/">browser fingerprints</a>, <a href="https://www.ibm.com/docs/en/ibm-mq/10.0.x?topic=tls-digital-signatures-in-ssltls">TLS signatures</a>, IP reputation, and behavioral analysis. They are making reliable automation significantly more challenging than it was just a few years ago.</p><p><strong>In this article, you’ll learn:</strong></p><ul><li>How to build an AI browser agent using JavaScript that combines Gemini, <a href="https://playwright.dev/">Playwright</a>, and <a href="https://get.brightdata.com/free-proxies">Bright Data</a> to automate real websites without maintaining fragile anti-bot infrastructure ourselves.</li><li>Why <a href="https://medium.com/stackademic/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">most AI browser agents fail</a> on modern websites.</li><li>How browser fingerprinting and anti-bot systems work.</li><li>How Bright Data provides production-ready browser sessions for AI automation.</li><li>How to build an end-to-end browser agent that can navigate websites, extract structured information, and generate reports dynamically.</li></ul><h3>Introduction</h3><p>Modern AI browser agents don’t usually fail because they’re arbitrary. Their reasoning, prompts, and planning loops are often sophisticated. The execution layer underneath is fragile.</p><p>Most tutorials show how to connect an LLM to a browser, execute a few <a href="https://docs.brightdata.com/integrations/playwright">Playwright commands</a>, and declare you’ve built an autonomous agent.</p><pre>await page.goto(url)<br>await page.click(selector)<br>await page.type(selector, text)</pre><p>In reality, you’ve ONLY automated a browser. Commercial sites don’t gauge how intelligent your agent is. They judge whether they believe your browser is genuine.</p><p>Before a page even finishes loading, they inspect what your browser actually is: the <a href="https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/">TLS handshake</a>, IP reputation, browser fingerprints, <a href="https://www.todetect.net/article/canvas/webgl-fingerprint/">canvas and WebGL fingerprints</a>, cookies, device characteristics, and even the rhythm of your connection. Dozens of signals are examined in the time it takes the page to start loading.</p><p>If those signals don’t look authentic, your agent rarely reaches the real application. Instead, it encounters CAPTCHA challenges, verification pages, <a href="https://wiki.c2.com/?QuickSilentRedirect">silent redirects</a>, incomplete datasets, or <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200">HTTP 200 responses</a> that quietly return entirely different content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*4QLzOVjoNVSoetQPpjGytg.png" /><figcaption>Fake 200 response from amazon after sending raw request without browser fingerprint</figcaption></figure><p>This is one of the biggest challenges in modern browser automation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-I21bruIGslPJeI0_OUew.png" /><figcaption>raw http request vs. Bright Data Web Unlocker API gateway</figcaption></figure><p>I’ve always wanted to <a href="https://blog.stackademic.com/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">build an autonomous software system</a> that could function on the web as naturally as a human, not another scraper that extracts a few HTML elements or another automation script that breaks the moment a production website changes.</p><p>Like many developers, I started with HTTP requests, graduated to browser automation, and eventually began building AI agents powered by large language models.</p><p>Along the way, I realized something surprising: intelligence without <a href="https://sajidalianjum.substack.com/p/ai-without-internet-how-offline-ai">reliable web access</a> is meaningless.</p><p>Fortunately, solving this problem doesn’t require <a href="https://fingerprint.com/blog/browser-fingerprinting-techniques/">building your own fingerprinting</a> or <a href="https://get.brightdata.com/bypass-antibot-walls">anti-detection infrastructure</a>.</p><p>Instead, we’ll let <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data handle browser identity</a>, network reputation, and anti-bot bypass while our AI agent focuses on reasoning and execution.</p><p>Because on today’s web, access is an engineering problem.</p><h3>What We Are Building</h3><p>By the end of this article, we’ll build a fully functional browser automation AI agent called <strong>SIKKI Agent</strong>.</p><p>Think of it as an unpaid intern who somehow thinks harder at 3 a.m. than I do: it clicks, scrolls, extracts products, grabs ratings, checks prices, and patiently does the repetitive work I’d rather avoid; the most overqualified intern you’ll never have to pay.</p><p>The entire project is built with plain JavaScript. No proprietary framework. No billion-dollar AI platform. Just Node.js, Playwright, Bright Data, and Gemini working together.</p><p>Here’s a quick overview of what we’re going to build:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1AFVtiBkcxQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1AFVtiBkcxQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1AFVtiBkcxQ%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fd6651784d427fea7f93adfbaa064e7/href">https://medium.com/media/8fd6651784d427fea7f93adfbaa064e7/href</a></iframe><blockquote>Note: The complete source code is available on GitHub at the end of this article.</blockquote><p>At a high level, the agent follows this workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mkQ8KOZJNkp8OjYmlYuURw.png" /><figcaption>our sikki agent’s blueprint</figcaption></figure><p>And this is the engineering architecture we’ll build throughout the tutorial:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HtaHnxOaa3goelKXTMQig.png" /></figure><h4>Prerequisite</h4><ul><li><strong>Basic JavaScript/TypeScript or Python. E</strong>ven though I used javascript all over this project, you can follow through this article if you know any programming language. But familiarity with asynchronous programming (async/await) is required, as both scraping and AI calls rely heavily on it.</li><li><strong>Fundamental Node.js or Python Environment:</strong> Ability to install packages via npm or pip and manage local environment variables (.env).</li><li><strong>API Keys:</strong> Active accounts and API keys for both <a href="https://aistudio.google.com/">Google AI Studio (Gemini API)</a> and Bright Data. <strong>Both are free to use.</strong></li><li><strong>Basic DOM Understanding:</strong> A general awareness of HTML structure, though our SIKKI AI agent will minimize the need for complex CSS selectors.</li></ul><p><strong>We will use:</strong></p><ul><li>Gemini as the reasoning engine</li><li>Node.js as the runtime</li><li>Playwright as the browser controller</li><li>Bright Data Scraping Browser as the <a href="https://get.brightdata.com/scraping-browser-signup">cloud browser infrastructure</a></li><li>Memory and retry loops for robustness</li><li>Structured outputs and screenshots for observation</li></ul><p><strong>Our Sikki agent will:</strong></p><ul><li>Accept natural language goals</li><li>Plan browser actions dynamically</li><li>Connect to a remote cloud browser over CDP</li><li>Access real websites</li><li>Extract structured information</li><li>Take screenshots</li><li>Recover from failures</li><li>Produce clean results automatically</li></ul><p>But more importantly</p><p>You will understand <strong>why</strong> browser AI agents fail. Why local Playwright breaks. Why websites detect automation. Why browser identity matters.</p><p>And how modern AI agents separate rational thinking from execution to run successfully on the real web.</p><p>We are NOT building another toy model. We are building an architecture.</p><p>And like all architectures, we begin with the foundations.</p><h3>Building Sikki Project</h3><p>In this section, I will show you how to setup Sikki project locally using Gemini, Playwright, and Bright Data and run a quick result in terminal to extract information from CNN website. You can skips this section if you know exactly how to integrate Gemini, Playwright, and Bright Data locally.</p><p>Then in the coming section, I will go deeper building the final Sikki agent engine by showing the blueprint and functional implementations step by step.</p><p>So lets start with a basic test to see whether our API keys and tech stacks are working properly:</p><h4>Step 1: Create the Project</h4><p>Open terminal:</p><pre>mkdir sikki-agent<br>cd sikki-agent<br>npm init -y</pre><p>Enable ES Modules:</p><pre>npm pkg set type=module</pre><p><strong>Note:</strong> Node.js treats .js files as legacy CommonJS by default. We enable ES Modules to cleanly use modern import statements and native await commands at the root level of our AI agent script</p><p><strong>Now install the necessary dependencies:</strong></p><pre>npm install playwright</pre><pre>npm install @google/genai<br>npm install dotenv<br>npm install chalk<br>npm install ora</pre><p>Our project’s folder structure should look like this (create these other directories manually):</p><pre>sikki-agent<br> index.js<br> .env<br> screenshots/<br> reports/<br> package.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*KqlQsgLxLf288edEJVozow.png" /><figcaption>project’s folder structure</figcaption></figure><h4>Step 2: Get Gemini API Key</h4><p>Go to: <a href="https://aistudio.google.com/">https://aistudio.google.com</a></p><p>Create Gemini API Key by creating a new project called “Sikki-Agent”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEYeQ7EAOphXKn1ddnnnAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*kbT7aW_3DndPRlJtVvIUzA.png" /><figcaption>gemini api key project dashboard</figcaption></figure><p>Inside your .env file, paste your Gemini API key:</p><pre>GEMINI_API_KEY = your_gemini_api_key</pre><pre>BRIGHT_WS_ENDPOINT = //i will show you later</pre><h4>Step 3 : Setting up Bright Data Cloud Browser Infrastructure</h4><p>Visit the official gateway link at <a href="https://get.brightdata.com/browser-api">https://get.brightdata.com/browser-api</a> to log into your control panel dashboard.</p><p>Once you are inside the main console sidebar, do not search for generic proxy settings. Navigate directly to the <strong>Web Access API</strong> section on the left-hand navigation menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XI0TP2MXSTn4-TWfKcfIA.png" /></figure><p>Click on the Top right corner “Create API” and choose option labeled <strong>Browser API:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hb9RwKyawl31-u44ruJa2w.png" /></figure><p>then click “continue” and name your API key or leave it default.</p><p>Now click “Add API”; you will find your unique <strong>WebSocket Connection Endpoint</strong>. Copy that first puppeteer/playwright endpoint starting with “wss://brd-customer-hl…” Paste it in your .env file in your local project.</p><pre>BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;</pre><p>It will look exactly like this perpetual connection string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*g-7xVXrsB6omv9Tmv91sKQ.png" /><figcaption>Bright data browser api key</figcaption></figure><p>This is Because:</p><p>We are NOT launching:</p><pre>chromium.launch()</pre><p>Instead:</p><pre>chromium.connectOverCDP()</pre><p>Meaning: Your browser lives in the cloud.</p><p>To help you understand lets write a simple code block to browse CNN’s title from our local terminal using Playwright and Bright Data.</p><h4>Step 4: Connect Playwright to Bright Data</h4><p>Inside your index.js file write that below to access CNN title from terminal:</p><pre>import { chromium }<br>from &quot;playwright&quot;;</pre><pre>const BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;</pre><pre>const browser =<br>await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT<br>);</pre><pre>const page =<br>await browser.newPage();<br>await page.goto(<br>&quot;https://cnn.com&quot;<br>);</pre><pre>console.log(<br>await page.title()<br>);</pre><p>If you run this on the terminal, you will see a real CNN website title has been shown. We successfully extracted information and displayed the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*N1aDNB8B7okhpwux8J-2Iw.png" /></figure><p>If you now look at your Bright Data <em>event log</em> inside <strong>web access</strong> panel, you will see successful authentication. That means our BrightData and Playwright are working properly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JCKv3hKvVf0G_-U2ELphyQ.png" /></figure><p>So connectOverCDP() does NOT launch a browser locally.</p><p>Instead, this is what happened:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPUS2oD8qw_iW7lmxENX8Q.png" /><figcaption>image by author</figcaption></figure><p>This separation is one of the most important notions in today’s browser agents:</p><blockquote>Your AI reasons locally. Your browser executes remotely.</blockquote><p>Hope that makes sense.</p><h3>Going Deeper into SIKKI Agent Before Implementation</h3><blockquote>Note: wait! in this section I will not show you the actual Sikki codebase. I will explain the arthictecture behind SIKKI and how we will implement it in the next setion. You can skip this section if you want.</blockquote><p>Up until now, we have built something that resembles a browser automation script. We opened a cloud browser. We visited a website. We extracted information. And we displayed the results.</p><p>That is useful, but it is not intelligence.</p><p>The truth is that many developers stop at this stage and call their projects AI agents. They build a browser script, attach an LLM somewhere in the pipeline, and assume they have built something autonomous.</p><p><strong>I don’t think that’s enough.</strong></p><p>An autonomous agent is not defined by the presence of an LLM. It is defined by its ability to observe an environment, reason about the information it receives, decide on actions, execute those actions, and continue this cycle until it reaches its objective.</p><p>In other words:</p><p>The browser is not the agent.</p><p>The model is not the agent.</p><p>The agent is the system that connects both.</p><p>This is the architectural philosophy behind SIKKI.</p><h4>SIKKI is Not A Scraper</h4><p>I intentionally avoided calling SIKKI a scraper.</p><p>Scrapers collect data. Agents pursue goals.</p><p>Suppose I ask SIKKI:</p><blockquote>Find the best gaming laptop under $1000.</blockquote><p>A traditional scraper might return the following:</p><pre>ProductPriceAcer Nitro V$899ASUS TUF$949MSI Thin$979</pre><p>Useful. But not intelligent. An actual agent should ask:</p><ul><li>Which products exceed the budget?</li><li>Which product has the highest rating?</li><li>Which seller has the most reviews?</li><li>Which laptop offers the best price-to-performance ratio?</li><li>Is the market trending upward or downward?</li></ul><p>And finally:</p><blockquote>Which one would I personally recommend?</blockquote><p>That is no longer data extraction. That is reasoning. And that is the moment a browser becomes an intelligent e-commerce agent.</p><h3>The Architecture Behind SIKKI</h3><p>Internally, SIKKI is composed of <strong>four independent layers.</strong> Each layer solves a completely different problem:</p><pre>SIKKI<br><br>Strategic Intelligence Commerce Kernel<br>┌──────────────────────────────┐<br>│ Browser Layer                │<br>│ Playwright + Bright Data     │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Extraction Layer             │<br>│ Product                      │<br>│ Price                        │<br>│ Rating                       │<br>│ Seller                       │<br>│ Availability                 │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ AI Layer                     │<br>│ Gemini                       │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Analysis Layer               │<br>│ Cheapest Products            │<br>│ Market Average               │<br>│ Competitor Comparison        │<br>│ Trend Analysis               │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>        Markdown / CSV<br>        Dashboard Export</pre><p>Because browser automation problems and reasoning problems are fundamentally different. If Gemini cannot understand your prompt, changing Playwright selectors won’t fix it.</p><p>If Bright Data cannot open a page, increasing Gemini’s context window won’t help. Each layer has a different responsibility. And each layer can evolve independently.</p><h4>Building The Extraction Layer</h4><p>Let’s make SIKKI more useful. Instead of extracting a single CNN headline, let’s teach it how to understand products.</p><p>In the real world, commerce websites display several critical pieces of information:</p><ul><li>Product title</li><li>Current price</li><li>Rating</li><li>Review count</li><li>Seller information</li><li>Availability</li><li>Product link</li></ul><p>A human sees these immediately. Our goal is to teach the browser to see them too.</p><p>Inside Playwright, we can execute JavaScript directly in the page context using page.evaluate().</p><p>For example:</p><pre>const products = await page.evaluate(() =&gt; {const items = [];<br>    document.querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach(card =&gt; {<br>        const title =<br>          card.querySelector(&#39;h2 span&#39;)?.innerText;<br>        const price =<br>          card.querySelector(&#39;.a-price .a-offscreen&#39;)<br>          ?.innerText;<br>        const rating =<br>          card.querySelector(&#39;.a-icon-alt&#39;)<br>          ?.innerText;<br>        const link =<br>          card.querySelector(&#39;h2 a&#39;)<br>          ?.href;<br>        if(title &amp;&amp; price){<br>            items.push({<br>                title,<br>                price,<br>                rating,<br>                link<br>            });<br>        }<br>    });<br>    return items;<br>});<br>console.log(products);</pre><p>The output will look like this:</p><pre>[<br> {<br>   title: &quot;Acer Nitro V Gaming Laptop&quot;,<br>   price: &quot;$899&quot;,<br>   rating: &quot;4.5 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> },<br><br>{<br>   title: &quot;ASUS TUF Gaming A15&quot;,<br>   price: &quot;$949&quot;,<br>   rating: &quot;4.4 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> }<br>]</pre><p>At this point, SIKKI has eyes.</p><p>But it still doesn’t know what it is looking at.</p><p>That is where Gemini enters the architecture.</p><h4>Giving SIKKI A Brain</h4><p>I personally think many developers misunderstand LLMs. Gemini is not a magical replacement for code. It is a reasoning engine. This makes it perfect for commerce intelligence.</p><p>After extracting products, we simply send structured JSON to Gemini.</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze the following products.<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest product<br>2. Average price<br>3. Best rated product<br>4. Summary of the market<br>5. Recommendation<br>`;</pre><p><strong>Gemini may answer:</strong></p><blockquote><em>I analyzed 12 products. The cheapest option is Acer Nitro V at $899.</em></blockquote><blockquote><em>The average market price is $942.</em></blockquote><blockquote><em>ASUS TUF has slightly better reviews but is more expensive.</em></blockquote><blockquote><em>Based on value and user ratings, Acer Nitro V provides the best balance between performance and affordability.</em></blockquote><p><em>Now SIKKI is not only obtaining information but also </em>analyzing<em> the output.</em></p><h3>Building the Final SIKKI Agent</h3><p>At this point, we already have everything we need.</p><ul><li>A cloud browser powered by Bright Data</li><li>Playwright connected through CDP</li><li>Gemini API access</li><li>A local Node.js project</li></ul><p>Now, let’s put everything together and build the final version of SIKKI.</p><p>The goal is straightforward:</p><ol><li>Open an e-commerce website.</li><li>Search for a product.</li><li>Extract product information.</li><li>Ask Gemini to analyze the results.</li><li>Export the findings into a Markdown report.</li></ol><p>By the end of this section, you will have a fully functional browser-use AI Agent running locally.</p><h4>Step 1: Create the Agent File</h4><p>Replace your previous local Sikki project index.js file (if you didn’t follow through with our initial “Building Sikki Agent” section) and import the required modules. Paste your Browser CDP endpoint inside your index.js file if you want instant access or follow best practice by creating an .env file (using the dotenv library) to secure your API keys:</p><pre>import &quot;dotenv/config&quot;; //to use environment variables from .env file<br>import fs from &quot;fs&quot;; //to read and write files<br><br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br><br>//api keys and endpoints from environment variables<br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;</pre><p>Initialize Gemini with a fixed prompt text first, then we will make it dynamic:</p><pre>//initialize the GoogleGenAI client with the Gemini API key<br><br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br>//the prompt to send to the Gemini API<br>const prompt = &quot;Write a short introduction to the Gemini API.&quot;; <br>const response = await ai.models.generateContent({<br>  model: &quot;gemini-2.5-flash&quot;,<br>  contents: prompt,<br>});<br>console.log(response.text);</pre><p>Here is the results in our local terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KeCur01ZzyY3QiFTTK2EoA.png" /></figure><h4>Step 2: Setup Playwright to connect to Bright Data’s WebSocket</h4><p>As I have already shown you how to set up Bright Data with Playwright earlier, I will go straight to searching for e-commerce products.</p><blockquote>Note: Unlike a Playwright’s normal local browser chromium.launch() we used chromium.connectOverCDP(). This browser runs inside Bright Data’s infrastructure. IP rotation, browser fingerprinting, and anti-bot protection are handled automatically. Your local machine only sends instructions.</blockquote><p>To test our playwright and bright data working properly, let’s search for “gaming laptops” from amazon:</p><pre>//setup Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br><br>const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br>  await browser.close();<br>}<br>main();</pre><p>Here is our terminal output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*vtYG8DdY2ZFFiB4p6vz2ng.png" /></figure><p>You can replace Amazon with: BestBuy, Walmart, Product Hunt, g2, Ebay etc. The logic remains <strong>exactly </strong>the same.</p><h4>Step 3: Extract Product Information</h4><p>Now let’s collect structured data.</p><pre>// Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br><br>const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>  const products = await page.evaluate(() =&gt; {<br>    const data = [];<br>    document<br>      .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach((card) =&gt; {<br>        const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>        const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>        const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>        if (title &amp;&amp; price) {<br>          data.push({<br>            title,<br>            price,<br>            rating,<br>          });<br>        }<br>      });<br>    return data;<br>  });<br>  console.log(&quot;Step 3: Extract Product Information&quot;);<br>  console.log(products);<br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br>  await browser.close();<br>}<br>main();</pre><p>Our Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Duwp4jXdve2Ms-H-zos-7g.png" /><figcaption>Using playwright to connect to Bright Data’s WebSocket endpoint and navigate to Amazon search results for “gaming laptop”</figcaption></figure><p>At this point, SIKKI has successfully observed the environment.</p><p>Now we give it the ability to reason.</p><h4>Step 4: Ask Gemini To Analyze The Market</h4><p>Create a prompt:</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;</pre><p>Generate:</p><pre>const result = await model.generateContent(prompt);<br>const analysis =<br>result.response.text();</pre><p>Terminal output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sM_jJvKHXTMnNM9ZcZyxEA.png" /></figure><p>Here is the “Best reated product” result and analysis that I pasted from my terminal:</p><pre>### 3. Best Rated Product<br>There are three products tied for the highest rating of **5.0 out of 5 stars**:<br>1.  **HP OMEN 16&quot; Gaming Laptop Computer** (Intel Ultra 9 285H, NVIDIA GeForce RTX 5070 8GB, 16GB DDR5, 1TB PCIe SSD, 144Hz IPS WUXGA Display) at **$1,745.99**<br>2.  **HP OMEN 16 Slim RTX 5070 Gaming Laptop** (Intel Ultra 9 285H, NVIDIA RTX 5070, 32GB DDR5, 1TB SSD, 16&quot; FHD+ Anti-Glare) at **$1,929.00**<br>3.  **ASUS ROG Strix G16 Gaming Laptop** (Intel Core i7 14650HX, NVIDIA RTX 5060, 32 GB DDR5 RAM, 1 TB SSD, 16&quot; FHD+ LED Display, &amp; Gaming Accessories) at **$1,999.99**<br><br>**Analysis:** It&#39;s noteworthy that two HP OMEN laptops achieved perfect ratings, both featuring high-end Ultra 9 CPUs and RTX 5070 GPUs. <br>This suggests strong customer satisfaction with HP&#39;s premium gaming line. <br>The ASUS ROG Strix G16 also achieved a 5.0 rating, <br>despite having a slightly lower-tier GPU (RTX 5060) than the <br>HP OMENs in this bracket, possibly due to the included <br>&quot;Gaming Accessories&quot; and overall perceived value. <br>The Alienware product has no rating, so it cannot be considered here.</pre><p>Notice what just happened? The browser extracted raw information.</p><p>Gemini transformed it into business intelligence. That small architectural separation is what turns automation into an AI Agent.</p><h4>Step 5: Export The Sikki Market Report</h4><p>Now we save the scraped product data and Gemini analysis into real files.</p><p>Instead of dumping raw JSON into the output, the final agent:</p><ul><li>extracts clean product titles</li><li>normalizes Amazon URLs</li><li>writes a Markdown report</li><li>writes a CSV table</li><li>writes a short summary.txt dashboard</li></ul><p>Example report generation:</p><pre>const report = `<br># SIKKI Market Report<br>## Search Query<br>${query}<br><br>## Products<br>${JSON.stringify(products, null, 2)}<br>## Gemini Analysis<br>${analysis}<br>Generated: ${new Date().toISOString()}<br>`;<br>fs.writeFileSync(reportPath, report, &quot;utf8&quot;);</pre><p>You will see <strong>sikki-report.md</strong> after running this agent in your terminal.</p><p>Here is the full code:</p><pre>import &quot;dotenv/config&quot;; // use environment variables from .env file<br>import fs from &quot;fs&quot;;<br><br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;<br>if (!BRIGHT_WS_ENDPOINT) {<br>  throw new Error(&quot;Missing BRIGHT_WS_ENDPOINT environment variable.&quot;);<br>}<br>if (!GEMINI_API_KEY) {<br>  throw new Error(&quot;Missing GEMINI_API_KEY environment variable.&quot;);<br>}<br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br>async function retryWithBackoff(fn, maxRetries = 5, initialDelayMs = 2000) {<br>  for (let attempt = 1; attempt &lt;= maxRetries; attempt++) {<br>    try {<br>      return await fn();<br>    } catch (error) {<br>      const errorMsg = error?.message || error?.status || JSON.stringify(error);<br>      if (attempt === maxRetries) {<br>        console.error(`Final attempt failed. Error: ${errorMsg}`);<br>        throw error;<br>      }<br>      const delayMs = initialDelayMs * Math.pow(2, attempt - 1);<br>      console.log(`Attempt ${attempt} failed: ${errorMsg}`);<br>      console.log(`Retrying in ${delayMs}ms... (${attempt}/${maxRetries})`);<br>      await new Promise((resolve) =&gt; setTimeout(resolve, delayMs));<br>    }<br>  }<br>}<br>async function main() {<br>  let browser;<br>  try {<br>    browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>    const page = await browser.newPage();<br>    const query = &quot;gaming laptop&quot;;<br>    const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>    console.log(&quot;Connecting Playwright to Bright Data...&quot;);<br>    console.log(&quot;Navigating to:&quot;, searchUrl);<br>    await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>    const products = await page.evaluate(() =&gt; {<br>      const data = [];<br>      document<br>        .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>        .forEach((card) =&gt; {<br>          const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>          const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>          const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>          if (title &amp;&amp; price) {<br>            data.push({<br>              title,<br>              price,<br>              rating,<br>            });<br>          }<br>        });<br>      return data;<br>    });<br>    console.log(`Extracted ${products.length} products.`);<br>    const analysisPrompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;<br>    console.log(&quot;Sending products to Gemini for analysis (with retry logic)...&quot;);<br>    const analysisResult = await retryWithBackoff(async () =&gt; {<br>      return await ai.models.generateContent({<br>        model: &quot;gemini-2.5-flash&quot;,<br>        contents: analysisPrompt,<br>      });<br>    }, 5, 2000);<br>    const analysis = analysisResult.text || &quot;No analysis text returned.&quot;;<br>    const report = `# SIKKI Market Report<br>## Search Query<br>${query}<br>## Products<br>${JSON.stringify(products, null, 2)}<br>## Gemini Analysis<br>${analysis}<br>Generated: ${new Date().toISOString()}<br>`;<br>    fs.writeFileSync(&quot;sikki-report.md&quot;, report, &quot;utf8&quot;);<br>    console.log(&quot;Step 5: Export the Results&quot;);<br>    console.log(&quot;Report generated: sikki-report.md&quot;);<br>    console.log(&quot;Final analysis saved. Open sikki-report.md to review the result.&quot;);<br>    await browser.close();<br>  } catch (error) {<br>    console.error(&quot;Error:&quot;, error.message || error);<br>    if (browser) {<br>      await browser.close().catch(() =&gt; {});<br>    }<br>    process.exit(1);<br>  }<br>}<br>main();</pre><p>Here is the output of Sikki market report:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*EokCFUKVxH46KVwQt3kY_A.png" /></figure><h4>Step 6: Teach SIKKI To Capture Evidence</h4><p>Now that SIKKI can scrape product metadata, the next job is proof.</p><p>Capture evidence by taking:</p><ul><li>one search-results summary screenshot</li><li>a product card screenshot for the top result</li><li>direct product page screenshots for the highest-ranked items</li></ul><p>Here is how:</p><pre>const searchScreenshot = path.join(screenshotDir, &quot;search-results.png&quot;);<br>await page.screenshot({ path: searchScreenshot, fullPage: true });<br>const summaryPath = path.join(screenshotDir, &quot;top-product-summary.png&quot;);<br>await cards[0].screenshot({ path: summaryPath });</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy62kFUiEDbIBnbmhNO3vQ.png" /></figure><h4>Step 7: Capture Every Product Page</h4><p>Now we’re able to extract product information using Bright Data (Playwright) without getting blocked by antibot walls, analyze the market using Gemini, and make a report that will be stored inside our /Reports directory. SIKKI should visit each selected product URL and save the page image and it should be graceful without error loops.</p><p><strong>Here is the fun part: </strong>we don’t want only search result screenshots; we want each product page detail picked by Gemini intelligence. We will generate up to five screenshots; the first screenshot will be a summary. The remaining 4 screenshots should be: top products and individual product details pages. They will be generated based on the user search query and carefully analyzed by Gemini.</p><p>Let’s update our code, but this code is too long to paste here (you should check my git repo) so I will explain what I am changing along the way.</p><p>Let&#39;s first have a look at what changes our new updated code made. This time I will search for “ryzen processor”:</p><p>Key points we are making:<br>- normalize the URL first<br>- visit the direct product page<br>- wait briefly for the page to render<br>- save up to 4 product screenshots</p><p>Example:</p><pre>const normalized = normalizeAmazonUrl(p.url, p.title);<br>await retryWithBackoff(async () =&gt; <br> await page.goto(normalized, { waitUntil: &quot;domcontentloaded&quot;, timeout: 120000 }), <br> 3, <br> 1500<br>);<br>await page.waitForTimeout(800);<br>await page.screenshot({ path: outPath, fullPage: true });</pre><p>Here is our intelligent agent picking the top product from Bright Data’s extracted data after a successful analysis and saving a screenshot inside the “screenshot” folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7H_CiDrvw1Ow-RnAZfMi_g.png" /></figure><p>This turns SIKKI from “just data” into “evidence-backed market intelligence.”</p><h4>Step 8: Create a CSV Export</h4><p>A CSV file is essential for downstream analysis and makes the agent practical.</p><p>Write a simple export with:<br>- title<br>- price<br>- rating<br>- normalized URL</p><p>Example:</p><pre>const csvLines = [&quot;TITLE,PRICE,RATING,URL&quot;];<br>enriched.forEach((p) =&gt; {<br> const safe = (s) =&gt; `&quot;${String(s || &quot;&quot;).replace(/&quot;/g, &#39;&quot;&quot;&#39;)}&quot;`;<br> csvLines.push([safe(p.title), safe(p.price), safe(p.rating || &quot;&quot;), safe(p.url || &quot;&quot;)].join(&quot;,&quot;));<br>});<br>fs.writeFileSync(csvPath, csvLines.join(&quot;\n&quot;), &quot;utf8&quot;);</pre><p>The result is a readable products.csv file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*tcWFASsFweuBNThMT3JLHg.png" /></figure><h4>Step 9: Generate A Dashboard Summary</h4><p>Finally, create a human-readable summary file with the important metrics.</p><p>Compute:<br>- total products extracted<br>- cheapest offer<br>- average price<br>- best rated product<br>- top 5 product summary</p><p>Example:</p><pre>const priced = enriched.filter((p) =&gt; !isNaN(p.priceValue));<br>const cheapestObj = priced.length ? priced.reduce((a, b) =&gt; (a.priceValue &lt;= b.priceValue ? a : b)) : null;<br>const avgPriceVal = priced.length ? (priced.reduce((s, p) =&gt; s + p.priceValue, 0) / priced.length).toFixed(2) : “N/A”;<br>const bestRatedObj = enriched.slice().sort((a, b) =&gt; {<br> const ra = parseFloat((a.rating || “”).split(“ “)[0]) || 0;<br> const rb = parseFloat((b.rating || “”).split(“ “)[0]) || 0;<br> return rb — ra;<br>})[0] || null;</pre><p>Then write:</p><pre>const dashboard = [];<br>dashboard.push(“==================================”);<br>dashboard.push(“SIKKI MARKET DASHBOARD”);<br>dashboard.push(“==================================”);<br>dashboard.push(`Query: ${query}`);<br>dashboard.push(`Products Extracted: ${enriched.length}`);<br>dashboard.push(`Cheapest Product: ${cheapestObj ? `${cheapestObj.title} | ${cheapestObj.price}` : “N/A”}`);<br>dashboard.push(`Average Price: ${avgPriceVal === “N/A” ? “N/A” : `$${avgPriceVal}`}`);<br>dashboard.push(`Best Rated: ${bestRatedObj ? `${bestRatedObj.title} | ${bestRatedObj.rating || “N/A”}` : “N/A”}`);<br>dashboard.push(“\nTop 5 Products:”);<br>enriched.slice(0, 5).forEach((p, i) =&gt; {<br> dashboard.push(`${i + 1}. ${p.title} | ${p.price} | ${p.rating || “N/A”} | ${p.url || “N/A”}`);<br>});<br>fs.writeFileSync(dashboardPath, dashboard.join(“\n”), “utf8”);</pre><p>Lets have a look at the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoqHjs89wn6dRSIWzxPFww.png" /><figcaption>SIKKI summary report</figcaption></figure><p>That’s it for today. What we’ve built is a foundation, not a finished product. The interesting part is what you scale it into, and there’s a lot of room.</p><p>Here is the github repo of this project (SIKKI agent): <a href="https://github.com/codewithshahan/sikki-agent">https://github.com/codewithshahan/sikki-agent</a></p><h3>Where To Go From Here</h3><p>This article intentionally focused on the foundations. But SIKKI can become significantly more powerful. You can extend it with:</p><ul><li>Multi-site product comparison</li><li>Competitor tracking</li><li>Scheduled market reports</li><li>Interactive dashboards</li><li>Price trend monitoring</li><li>Autonomous shopping assistants</li><li>Agent memory using databases</li><li>Multi-agent workflows</li></ul><p>You could even create an agent that monitors hundreds of e-commerce websites every day and sends market intelligence directly to your inbox.</p><p>The possibilities become surprisingly large once you stop thinking of browser automation as scraping and start thinking about it as an intelligent system.</p><h3>Conclusion</h3><p>Many developers think AI Agents begin with LLMs. I think they begin with architecture. An agent is not just a prompt.</p><p>It is not just a browser. It is not just an API.</p><p>It is the coordination between observation, reasoning, and action.</p><p>That is why I built SIKKI: What began as a simple browser session eventually became something much more interesting.</p><p>A system capable of exploring the web, interpreting information, and transforming raw data into actionable knowledge.</p><p>And I believe this is only the beginning.</p><p>The future of browser automation isn’t scraping pages.</p><p>It’s building agents that can understand them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=923ba11cac6b" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/how-to-build-an-unblockable-ai-agent-for-browser-automation-using-bright-data-gemini-and-923ba11cac6b">How to Build an unblockable AI agent for Browser Automation using Bright Data, Gemini, and…</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build an Unrestricted Browser Automation AI Agent using Node.js,]]></title>
            <link>https://javascript.plainenglish.io/how-to-build-an-unrestricted-browser-automation-ai-agent-using-node-js-834927667e87?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/834927667e87</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 06:35:43 GMT</pubDate>
            <atom:updated>2026-07-11T12:44:12.330Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Build an Unrestricted Browser Automation AI Agent using Node.js, Playwright, Bright Data, and Gemini</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFGWyBZ5Xve3LWLE8ZLNqg.gif" /><figcaption>image by author</figcaption></figure><p><strong>In this full guide, you’ll learn:</strong></p><ul><li>Why <a href="https://medium.com/stackademic/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">most AI browser agents fail</a> on modern websites.</li><li>How browser fingerprinting and anti-bot systems work.</li><li>How to combine Gemini and Playwright into an autonomous browser agent.</li><li>How Bright Data provides production-ready <a href="https://get.brightdata.com/scraping-browser-signup">browser sessions</a> for AI automation.</li><li>How to build an end-to-end browser agent that can browse websites, extract structured information, and generate reports dynamically.</li><li>How to build an AI browser agent using JavaScript that combines Gemini, <a href="https://playwright.dev/">Playwright</a>, and <a href="https://get.brightdata.com/free-proxies">Bright Data</a> to automate real websites without maintaining fragile anti-bot infrastructure ourselves.</li></ul><h3>Introduction</h3><p>Building unrestricted browser automation AI agents has developed far beyond writing Playwright scripts that click buttons and scrape HTML. Modern websites actively detect automated traffic using <a href="https://www.firefox.com/en-US/features/block-fingerprinting/">browser fingerprints</a>, <a href="https://www.ibm.com/docs/en/ibm-mq/10.0.x?topic=tls-digital-signatures-in-ssltls">TLS signatures</a>, IP reputation, and behavioral analysis, making reliable automation significantly more challenging than it was just a few years ago.</p><p>Modern AI browser agents don’t usually fail because they’re arbitrary. Their reasoning, prompts, and planning loops are often sophisticated. The execution layer underneath is fragile.</p><p>Most tutorials show how to connect an LLM to a browser, execute a few <a href="https://docs.brightdata.com/integrations/playwright">Playwright commands</a>, and declare you’ve built an autonomous agent.</p><pre>await page.goto(url)<br>await page.click(selector)<br>await page.type(selector, text)</pre><p>In reality, you’ve ONLY automated a browser. Commercial sites don’t gauge how intelligent your agent is. They judge whether they believe your browser is genuine.</p><p>Before a page even finishes loading, they inspect what your browser actually is: the <a href="https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/">TLS handshake</a>, IP reputation, browser fingerprints, <a href="https://www.todetect.net/article/canvas/webgl-fingerprint/">canvas and WebGL fingerprints</a>, cookies, device characteristics, and even the rhythm of your connection. Dozens of signals are examined in the time it takes the page to start loading.</p><p>If those signals don’t look authentic, your agent rarely reaches the real application. Instead, it encounters CAPTCHA challenges, verification pages, silent redirects, incomplete datasets, or <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200">HTTP 200 responses</a> that quietly return entirely different content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*4QLzOVjoNVSoetQPpjGytg.png" /><figcaption>Fake 200 response from amazon after sending raw request without browser fingerprint</figcaption></figure><p>This is one of the biggest challenges in modern browser automation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-I21bruIGslPJeI0_OUew.png" /><figcaption>raw http request vs. Bright Data Web Unlocker API gateway</figcaption></figure><p>I’ve always wanted to <a href="https://blog.stackademic.com/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">build an autonomous software system</a> that could function on the web as naturally as a human, not another scraper that extracts a few HTML elements or another automation script that breaks the moment a production website changes.</p><p>Like many developers, I started with HTTP requests, graduated to browser automation, and eventually began building AI agents powered by large language models.</p><p>Along the way, I realized something surprising: intelligence without <a href="https://sajidalianjum.substack.com/p/ai-without-internet-how-offline-ai">reliable web access</a> is meaningless.</p><p>Fortunately, solving this problem doesn’t require <a href="https://fingerprint.com/blog/browser-fingerprinting-techniques/">building your own fingerprinting</a> or <a href="https://get.brightdata.com/bypass-antibot-walls">anti-detection infrastructure</a>.</p><p>Instead, we’ll let <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data handle browser identity</a>, network reputation, and anti-bot bypass while our AI agent focuses on reasoning and execution.</p><p>Because on today’s web, access is an engineering problem.</p><h3>What We Are Building</h3><p>By the end of this article, we’ll build a fully functional browser automation AI agent called <strong>SIKKI Agent</strong>.</p><p>Think of it as an unpaid intern who somehow thinks harder at 3 a.m. than I do: it clicks, scrolls, extracts products, grabs ratings, checks prices, and patiently does the repetitive work I’d rather avoid; the most overqualified intern you’ll never have to pay.</p><p>The entire project is built with plain JavaScript. No proprietary framework. No billion-dollar AI platform. Just Node.js, Playwright, Bright Data, and Gemini working together.</p><p>Here’s a quick overview of what we’re going to build:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1AFVtiBkcxQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1AFVtiBkcxQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1AFVtiBkcxQ%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fd6651784d427fea7f93adfbaa064e7/href">https://medium.com/media/8fd6651784d427fea7f93adfbaa064e7/href</a></iframe><blockquote><strong>Note:</strong> The complete source code is available on GitHub at the end of this article.</blockquote><p>At a high level, the agent follows this workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mkQ8KOZJNkp8OjYmlYuURw.png" /><figcaption>our sikki agent’s blueprint</figcaption></figure><p>And this is the engineering architecture we’ll build throughout the tutorial:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HtaHnxOaa3goelKXTMQig.png" /></figure><h4>Prerequisite</h4><ul><li><strong>Basic JavaScript/TypeScript or Python. E</strong>ven though I used JavaScript all over this project, you can follow through with this article if you know any programming language. But knowledge with asynchronous programming (async/await) is required, as both scraping and AI calls rely heavily on it.</li><li><strong>Fundamental Node.js or Python Environment:</strong> Ability to install packages via npm or pip and manage local environment variables (.env).</li><li><strong>API Keys:</strong> Active accounts and API keys for both <a href="https://aistudio.google.com/">Google AI Studio (Gemini API)</a> and Bright Data. <strong>Both are free to use.</strong></li><li><strong>Basic DOM Understanding:</strong> A general awareness of HTML structure, though our SIKKI AI agent will minimize the need for complex CSS selectors.</li></ul><p><strong>We will use:</strong></p><ul><li>Gemini as the reasoning engine</li><li>Node.js as the runtime</li><li>Playwright as the browser controller</li><li>Bright Data Scraping Browser as the <a href="https://get.brightdata.com/scraping-browser-signup">cloud browser infrastructure</a></li><li>Memory and retry loops for robustness</li><li>Structured outputs and screenshots for observation</li></ul><p><strong>Our Sikki agent will:</strong></p><ul><li>Accept natural language goals</li><li>Plan browser actions dynamically</li><li>Connect to a remote cloud browser over CDP</li><li>Access real websites</li><li>Extract structured information</li><li>Take screenshots</li><li>Recover from failures</li><li>Produce clean results automatically</li></ul><p>But more importantly</p><p>You will understand <strong>why</strong> browser AI agents fail. Why local Playwright breaks. Why websites detect automation. Why browser identity matters.</p><p>And how modern AI agents separate rational thinking from execution to run successfully on the real web.</p><p>We are NOT building another toy model. We are building an architecture.</p><p>And like all architectures, we begin with the foundations.</p><h3>Building Sikki Project</h3><p>In this section, I will show you how to setup Sikki project locally using Gemini, Playwright, and Bright Data and run a quick result in terminal to extract information from CNN website. You can skips this section if you know exactly how to integrate Gemini, Playwright, and Bright Data locally.</p><p>Then in the coming section, I will go deeper building the final Sikki agent engine by showing the blueprint and functional implementations step by step.</p><p>So lets start with a basic test to see whether our API keys and tech stacks are working properly:</p><h4>Step 1: Create the Project</h4><p>Open terminal:</p><pre>mkdir sikki-agent<br>cd sikki-agent<br>npm init -y</pre><p>Enable ES Modules:</p><pre>npm pkg set type=module</pre><p><strong>Note:</strong> Node.js treats .js files as legacy CommonJS by default. We enable ES Modules to cleanly use modern import statements and native await commands at the root level of our AI agent script</p><p><strong>Now install the necessary dependencies:</strong></p><pre>npm install playwright<br><br>npm install @google/genai<br>npm install dotenv<br>npm install chalk<br>npm install ora</pre><p>Our project’s folder structure should look like this (create these other directories manually):</p><pre>sikki-agent<br> index.js<br> .env<br> screenshots/<br> reports/<br> package.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*KqlQsgLxLf288edEJVozow.png" /><figcaption>project’s folder structure</figcaption></figure><h4>Step 2: Get Gemini API Key</h4><p>Go to: <a href="https://aistudio.google.com/">https://aistudio.google.com</a></p><p>Create Gemini API Key by creating a new project called “Sikki-Agent”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEYeQ7EAOphXKn1ddnnnAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*kbT7aW_3DndPRlJtVvIUzA.png" /><figcaption>gemini api key project dashboard</figcaption></figure><p>Inside your .env file, paste your Gemini API key:</p><pre>GEMINI_API_KEY = your_gemini_api_key</pre><pre>BRIGHT_WS_ENDPOINT = //i will show you later</pre><h4>Step 3 : Setting up Bright Data Cloud Browser Infrastructure</h4><p>Visit the official gateway link at <a href="https://get.brightdata.com/browser-api">https://get.brightdata.com/browser-api</a> to log into your control panel dashboard.</p><p>Once you are inside the main console sidebar, do not search for generic proxy settings. Navigate directly to the <strong>Web Access API</strong> section on the left-hand navigation menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XI0TP2MXSTn4-TWfKcfIA.png" /></figure><p>Click on the Top right corner “Create API” and choose option labeled <strong>Browser API:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hb9RwKyawl31-u44ruJa2w.png" /></figure><p>then click &quot;continue&quot; and name your API key or leave it default.</p><p>Now click “Add API&quot;; you will find your unique <strong>WebSocket Connection Endpoint</strong>. Copy that first puppeteer/playwright endpoint starting with &quot;wss://brd-customer-hl...&quot; Paste it in your .env file in your local project.</p><pre>BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;</pre><p>It will look exactly like this perpetual connection string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*g-7xVXrsB6omv9Tmv91sKQ.png" /><figcaption>Bright data browser api key</figcaption></figure><p>This is Because:</p><p>We are NOT launching:</p><pre>chromium.launch()</pre><p>Instead:</p><pre>chromium.connectOverCDP()</pre><p>Meaning: Your browser lives in the cloud.</p><p>To help you understand lets write a simple code block to browse CNN’s title from our local terminal using Playwright and Bright Data.</p><h4>Step 4: Connect Playwright to Bright Data</h4><p>Inside your index.js file write that below to access CNN title from terminal:</p><pre>import { chromium }<br>from &quot;playwright&quot;;<br><br>const BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;<br><br>const browser =<br>await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT<br>);<br><br>const page =<br>await browser.newPage();<br>await page.goto(<br>&quot;https://cnn.com&quot;<br>);<br><br>console.log(<br>await page.title()<br>);  <br></pre><p>If you run this on the terminal, you will see a real CNN website title has been shown. We successfully extracted information and displayed the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*N1aDNB8B7okhpwux8J-2Iw.png" /></figure><p>If you now look at your Bright Data <em>event log</em> inside <strong>web access</strong> panel, you will see successful authentication. That means our BrightData and Playwright are working properly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JCKv3hKvVf0G_-U2ELphyQ.png" /></figure><p>So connectOverCDP() does NOT launch a browser locally.</p><p>Instead, this is what happened:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPUS2oD8qw_iW7lmxENX8Q.png" /><figcaption>image by author</figcaption></figure><p>This separation is one of the most important notions in today’s browser agents:</p><blockquote>Your AI reasons locally. Your browser executes remotely.</blockquote><p>Hope that makes sense.</p><h3>Going Deeper into SIKKI Agent Before Implementation</h3><blockquote>Note: wait! in this section I will not show you the actual Sikki codebase. I will explain the arthictecture behind SIKKI and how we will implement it in the next setion. You can skip this section if you want.</blockquote><p>Up until now, we have built something that resembles a browser automation script. We opened a cloud browser. We visited a website. We extracted information. And we displayed the results.</p><p>That is useful, but it is not intelligence.</p><p>The truth is that many developers stop at this stage and call their projects AI agents. They build a browser script, attach an LLM somewhere in the pipeline, and assume they have built something autonomous.</p><p><strong>I don’t think that’s enough.</strong></p><p>An autonomous agent is not defined by the presence of an LLM. It is defined by its ability to observe an environment, reason about the information it receives, decide on actions, execute those actions, and continue this cycle until it reaches its objective.</p><p>In other words:</p><p>The browser is not the agent.</p><p>The model is not the agent.</p><p>The agent is the system that connects both.</p><p>This is the architectural philosophy behind SIKKI.</p><h4>SIKKI is Not A Scraper</h4><p>I intentionally avoided calling SIKKI a scraper.</p><p>Scrapers collect data. Agents pursue goals.</p><p>Suppose I ask SIKKI:</p><blockquote><em>Find the best gaming laptop under $1000.</em></blockquote><p>A traditional scraper might return the following:</p><pre>ProductPriceAcer Nitro V$899ASUS TUF$949MSI Thin$979</pre><p>Useful. But not intelligent. An actual agent should ask:</p><ul><li>Which products exceed the budget?</li><li>Which product has the highest rating?</li><li>Which seller has the most reviews?</li><li>Which laptop offers the best price-to-performance ratio?</li><li>Is the market trending upward or downward?</li></ul><p>And finally:</p><blockquote><em>Which one would I personally recommend?</em></blockquote><p>That is no longer data extraction. That is reasoning. And that is the moment a browser becomes an intelligent e-commerce agent.</p><h3>The Architecture Behind SIKKI</h3><p>Internally, SIKKI is composed of <strong>four independent layers.</strong> Each layer solves a completely different problem:</p><pre>SIKKI<br><br>Strategic Intelligence Commerce Kernel<br><br>┌──────────────────────────────┐<br>│ Browser Layer                │<br>│ Playwright + Bright Data     │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Extraction Layer             │<br>│ Product                      │<br>│ Price                        │<br>│ Rating                       │<br>│ Seller                       │<br>│ Availability                 │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ AI Layer                     │<br>│ Gemini                       │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Analysis Layer               │<br>│ Cheapest Products            │<br>│ Market Average               │<br>│ Competitor Comparison        │<br>│ Trend Analysis               │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>        Markdown / CSV<br>        Dashboard Export</pre><p>Because browser automation problems and reasoning problems are fundamentally different. If Gemini cannot understand your prompt, changing Playwright selectors won’t fix it.</p><p>If Bright Data cannot open a page, increasing Gemini’s context window won’t help. Each layer has a different responsibility. And each layer can evolve independently.</p><h4>Building The Extraction Layer</h4><p>Let’s make SIKKI more useful. Instead of extracting a single CNN headline, let’s teach it how to understand products.</p><p>In the real world, commerce websites display several critical pieces of information:</p><ul><li>Product title</li><li>Current price</li><li>Rating</li><li>Review count</li><li>Seller information</li><li>Availability</li><li>Product link</li></ul><p>A human sees these immediately. Our goal is to teach the browser to see them too.</p><p>Inside Playwright, we can execute JavaScript directly in the page context using page.evaluate().</p><p>For example:</p><pre>const products = await page.evaluate(() =&gt; {const items = [];<br>    document.querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach(card =&gt; {<br>        const title =<br>          card.querySelector(&#39;h2 span&#39;)?.innerText;<br>        const price =<br>          card.querySelector(&#39;.a-price .a-offscreen&#39;)<br>          ?.innerText;<br>        const rating =<br>          card.querySelector(&#39;.a-icon-alt&#39;)<br>          ?.innerText;<br>        const link =<br>          card.querySelector(&#39;h2 a&#39;)<br>          ?.href;<br>        if(title &amp;&amp; price){<br>            items.push({<br>                title,<br>                price,<br>                rating,<br>                link<br>            });<br>        }<br>    });<br>    return items;<br>});<br>console.log(products);</pre><p>The output will look like this:</p><pre>[<br> {<br>   title: &quot;Acer Nitro V Gaming Laptop&quot;,<br>   price: &quot;$899&quot;,<br>   rating: &quot;4.5 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> },<br><br>{<br>   title: &quot;ASUS TUF Gaming A15&quot;,<br>   price: &quot;$949&quot;,<br>   rating: &quot;4.4 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> }<br>]</pre><p>At this point, SIKKI has eyes.</p><p>But it still doesn’t know what it is looking at.</p><p>That is where Gemini enters the architecture.</p><h4>Giving SIKKI A Brain</h4><p>I personally think many developers misunderstand LLMs. Gemini is not a magical replacement for code. It is a reasoning engine. This makes it perfect for commerce intelligence.</p><p>After extracting products, we simply send structured JSON to Gemini.</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze the following products.<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest product<br>2. Average price<br>3. Best rated product<br>4. Summary of the market<br>5. Recommendation<br>`;</pre><p><strong>Gemini may answer:</strong></p><blockquote><em>I analyzed 12 products. The cheapest option is Acer Nitro V at $899.</em></blockquote><blockquote><em>The average market price is $942.</em></blockquote><blockquote><em>ASUS TUF has slightly better reviews but is more expensive.</em></blockquote><blockquote><em>Based on value and user ratings, Acer Nitro V provides the best balance between performance and affordability.</em></blockquote><p><em>Now SIKKI is not only obtaining information but also </em>analyzing<em> the output.</em></p><h3>Building the Final SIKKI Agent</h3><p>At this point, we already have everything we need.</p><ul><li>A cloud browser powered by Bright Data</li><li>Playwright connected through CDP</li><li>Gemini API access</li><li>A local Node.js project</li></ul><p>Now, let’s put everything together and build the final version of SIKKI.</p><p>The goal is straightforward:</p><ol><li>Open an e-commerce website.</li><li>Search for a product.</li><li>Extract product information.</li><li>Ask Gemini to analyze the results.</li><li>Export the findings into a Markdown report.</li></ol><p>By the end of this section, you will have a fully functional browser-use AI Agent running locally.</p><h4>Step 1: Create the Agent File</h4><p>Replace your previous local Sikki project index.js file (if you didn’t follow through with our initial “Building Sikki Agent” section) and import the required modules. Paste your Browser CDP endpoint inside your index.js file if you want instant access or follow best practice by creating an .env file (using the dotenv library) to secure your API keys:</p><pre>import &quot;dotenv/config&quot;; //to use environment variables from .env file<br>import fs from &quot;fs&quot;; //to read and write files<br><br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br><br><br>//api keys and endpoints from environment variables<br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;</pre><p>Initialize Gemini with a fixed prompt text first, then we will make it dynamic:</p><pre><br>//initialize the GoogleGenAI client with the Gemini API key<br><br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br><br>//the prompt to send to the Gemini API<br>const prompt = &quot;Write a short introduction to the Gemini API.&quot;; <br><br>const response = await ai.models.generateContent({<br>  model: &quot;gemini-2.5-flash&quot;,<br>  contents: prompt,<br>});<br><br>console.log(response.text);</pre><p>Here is the results in our local terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KeCur01ZzyY3QiFTTK2EoA.png" /></figure><h4>Step 2: Setup Playwright to connect to Bright Data’s WebSocket</h4><p>As I have already shown you how to set up Bright Data with Playwright earlier, I will go straight to searching for e-commerce products.</p><blockquote>Note: Unlike a Playwright’s normal local browser chromium.launch() we used chromium.connectOverCDP(). This browser runs inside Bright Data’s infrastructure. IP rotation, browser fingerprinting, and anti-bot protection are handled automatically. Your local machine only sends instructions.</blockquote><p>To test our playwright and bright data working properly, let’s search for “gaming laptops” from amazon:</p><pre><br>//setup Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br><br>  const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br><br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br><br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br><br>  await browser.close();<br>}<br><br>main();</pre><p>Here is our terminal output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*vtYG8DdY2ZFFiB4p6vz2ng.png" /></figure><p>You can replace Amazon with: BestBuy, Walmart, Product Hunt, g2, Ebay etc. The logic remains <strong>exactly </strong>the same.</p><h4>Step 3: Extract Product Information</h4><p>Now let’s collect structured data.</p><pre><br><br>// Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br><br>  const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br><br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br><br>  const products = await page.evaluate(() =&gt; {<br>    const data = [];<br>    document<br>      .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach((card) =&gt; {<br>        const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>        const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>        const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>        if (title &amp;&amp; price) {<br>          data.push({<br>            title,<br>            price,<br>            rating,<br>          });<br>        }<br>      });<br>    return data;<br>  });<br><br>  console.log(&quot;Step 3: Extract Product Information&quot;);<br>  console.log(products);<br><br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br><br>  await browser.close();<br>}<br><br>main();</pre><p>Our Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Duwp4jXdve2Ms-H-zos-7g.png" /><figcaption>Using playwright to connect to Bright Data’s WebSocket endpoint and navigate to Amazon search results for “gaming laptop”</figcaption></figure><p>At this point, SIKKI has successfully observed the environment.</p><p>Now we give it the ability to reason.</p><h4>Step 4: Ask Gemini To Analyze The Market</h4><p>Create a prompt:</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;</pre><p>Generate:</p><pre>const result = await model.generateContent(prompt);<br>const analysis =<br>result.response.text();</pre><p>Terminal output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sM_jJvKHXTMnNM9ZcZyxEA.png" /></figure><p>Here is the “Best reated product” result and analysis that I pasted from my terminal:</p><pre>### 3. Best Rated Product<br>There are three products tied for the highest rating of **5.0 out of 5 stars**:<br>1.  **HP OMEN 16&quot; Gaming Laptop Computer** (Intel Ultra 9 285H, NVIDIA GeForce RTX 5070 8GB, 16GB DDR5, 1TB PCIe SSD, 144Hz IPS WUXGA Display) at **$1,745.99**<br>2.  **HP OMEN 16 Slim RTX 5070 Gaming Laptop** (Intel Ultra 9 285H, NVIDIA RTX 5070, 32GB DDR5, 1TB SSD, 16&quot; FHD+ Anti-Glare) at **$1,929.00**<br>3.  **ASUS ROG Strix G16 Gaming Laptop** (Intel Core i7 14650HX, NVIDIA RTX 5060, 32 GB DDR5 RAM, 1 TB SSD, 16&quot; FHD+ LED Display, &amp; Gaming Accessories) at **$1,999.99**<br><br>**Analysis:** It&#39;s noteworthy that two HP OMEN laptops achieved perfect ratings, both featuring high-end Ultra 9 CPUs and RTX 5070 GPUs. <br>This suggests strong customer satisfaction with HP&#39;s premium gaming line. <br>The ASUS ROG Strix G16 also achieved a 5.0 rating, <br>despite having a slightly lower-tier GPU (RTX 5060) than the <br>HP OMENs in this bracket, possibly due to the included <br>&quot;Gaming Accessories&quot; and overall perceived value. <br>The Alienware product has no rating, so it cannot be considered here.</pre><p>Notice what just happened? The browser extracted raw information.</p><p>Gemini transformed it into business intelligence. That small architectural separation is what turns automation into an AI Agent.</p><h4>Step 5: Export The Sikki Market Report</h4><p>Now we save the scraped product data and Gemini analysis into real files.</p><p>Instead of dumping raw JSON into the output, the final agent:</p><ul><li>extracts clean product titles</li><li>normalizes Amazon URLs</li><li>writes a Markdown report</li><li>writes a CSV table</li><li>writes a short summary.txt dashboard</li></ul><p>Example report generation:</p><pre>const report = `<br># SIKKI Market Report<br>## Search Query<br>${query}<br><br>## Products<br>${JSON.stringify(products, null, 2)}<br><br>## Gemini Analysis<br>${analysis}<br><br>Generated: ${new Date().toISOString()}<br>`;<br><br>fs.writeFileSync(reportPath, report, &quot;utf8&quot;);</pre><p>You will see <strong>sikki-report.md</strong> after running this agent in your terminal.</p><p>Here is the full code:</p><pre>import &quot;dotenv/config&quot;; // use environment variables from .env file<br>import fs from &quot;fs&quot;;<br><br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br><br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;<br><br>if (!BRIGHT_WS_ENDPOINT) {<br>  throw new Error(&quot;Missing BRIGHT_WS_ENDPOINT environment variable.&quot;);<br>}<br><br>if (!GEMINI_API_KEY) {<br>  throw new Error(&quot;Missing GEMINI_API_KEY environment variable.&quot;);<br>}<br><br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br><br>async function retryWithBackoff(fn, maxRetries = 5, initialDelayMs = 2000) {<br>  for (let attempt = 1; attempt &lt;= maxRetries; attempt++) {<br>    try {<br>      return await fn();<br>    } catch (error) {<br>      const errorMsg = error?.message || error?.status || JSON.stringify(error);<br>      if (attempt === maxRetries) {<br>        console.error(`Final attempt failed. Error: ${errorMsg}`);<br>        throw error;<br>      }<br>      const delayMs = initialDelayMs * Math.pow(2, attempt - 1);<br>      console.log(`Attempt ${attempt} failed: ${errorMsg}`);<br>      console.log(`Retrying in ${delayMs}ms... (${attempt}/${maxRetries})`);<br>      await new Promise((resolve) =&gt; setTimeout(resolve, delayMs));<br>    }<br>  }<br>}<br><br>async function main() {<br>  let browser;<br>  try {<br>    browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>    const page = await browser.newPage();<br><br>    const query = &quot;gaming laptop&quot;;<br>    const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br><br>    console.log(&quot;Connecting Playwright to Bright Data...&quot;);<br>    console.log(&quot;Navigating to:&quot;, searchUrl);<br><br>    await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br><br>    const products = await page.evaluate(() =&gt; {<br>      const data = [];<br>      document<br>        .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>        .forEach((card) =&gt; {<br>          const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>          const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>          const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>          if (title &amp;&amp; price) {<br>            data.push({<br>              title,<br>              price,<br>              rating,<br>            });<br>          }<br>        });<br>      return data;<br>    });<br><br>    console.log(`Extracted ${products.length} products.`);<br><br>    const analysisPrompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;<br><br>    console.log(&quot;Sending products to Gemini for analysis (with retry logic)...&quot;);<br>    const analysisResult = await retryWithBackoff(async () =&gt; {<br>      return await ai.models.generateContent({<br>        model: &quot;gemini-2.5-flash&quot;,<br>        contents: analysisPrompt,<br>      });<br>    }, 5, 2000);<br><br>    const analysis = analysisResult.text || &quot;No analysis text returned.&quot;;<br><br>    const report = `# SIKKI Market Report<br><br>## Search Query<br>${query}<br><br>## Products<br>${JSON.stringify(products, null, 2)}<br><br>## Gemini Analysis<br>${analysis}<br><br>Generated: ${new Date().toISOString()}<br>`;<br><br>    fs.writeFileSync(&quot;sikki-report.md&quot;, report, &quot;utf8&quot;);<br><br>    console.log(&quot;Step 5: Export the Results&quot;);<br>    console.log(&quot;Report generated: sikki-report.md&quot;);<br>    console.log(&quot;Final analysis saved. Open sikki-report.md to review the result.&quot;);<br><br>    await browser.close();<br>  } catch (error) {<br>    console.error(&quot;Error:&quot;, error.message || error);<br>    if (browser) {<br>      await browser.close().catch(() =&gt; {});<br>    }<br>    process.exit(1);<br>  }<br>}<br><br>main();</pre><p>Here is the output of Sikki market report:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*EokCFUKVxH46KVwQt3kY_A.png" /></figure><h4>Step 6: Teach SIKKI To Capture Evidence</h4><p>Now that SIKKI can scrape product metadata, the next job is proof.</p><p>Capture evidence by taking:</p><ul><li>one search-results summary screenshot</li><li>a product card screenshot for the top result</li><li>direct product page screenshots for the highest-ranked items</li></ul><p>Here is how:</p><pre>const searchScreenshot = path.join(screenshotDir, &quot;search-results.png&quot;);<br>await page.screenshot({ path: searchScreenshot, fullPage: true });<br>const summaryPath = path.join(screenshotDir, &quot;top-product-summary.png&quot;);<br>await cards[0].screenshot({ path: summaryPath });</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy62kFUiEDbIBnbmhNO3vQ.png" /></figure><h4>Step 7: Capture Every Product Page</h4><p>Now we&#39;re able to extract product information using Bright Data (Playwright) without getting blocked by antibot walls, analyze the market using Gemini, and make a report that will be stored inside our /Reports directory. SIKKI should visit each selected product URL and save the page image and it should be graceful without error loops.</p><p><strong>Here is the fun part: </strong>we don’t want only search result screenshots; we want each product page detail picked by Gemini intelligence. We will generate up to five screenshots; the first screenshot will be a summary. The remaining 4 screenshots should be: top products and individual product details pages. They will be generated based on the user search query and carefully analyzed by Gemini.</p><p>Let&#39;s update our code, but this code is too long to paste here (you should check my git repo) so I will explain what I am changing along the way.</p><p>lets first have a look at what changes our new updated code made. This time I will search for “ryzen processor”:</p><p>Key points we are making:<br>- normalize the URL first<br>- visit the direct product page<br>- wait briefly for the page to render<br>- save up to 4 product screenshots</p><p>Example:</p><pre>const normalized = normalizeAmazonUrl(p.url, p.title);<br>await retryWithBackoff(async () =&gt; <br> await page.goto(normalized, { waitUntil: &quot;domcontentloaded&quot;, timeout: 120000 }), <br> 3, <br> 1500<br>);<br>await page.waitForTimeout(800);<br>await page.screenshot({ path: outPath, fullPage: true });</pre><p>Here is our intelligent agent picking the top product from Bright Data&#39;s extracted data after a successful analysis and saving a screenshot inside the “screenshot” folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7H_CiDrvw1Ow-RnAZfMi_g.png" /></figure><p>This turns SIKKI from “just data” into “evidence-backed market intelligence.”</p><h4>Step 8: Create a CSV Export</h4><p>A CSV file is essential for downstream analysis and makes the agent practical.</p><p>Write a simple export with:<br>- title<br>- price<br>- rating<br>- normalized URL</p><p>Example:</p><pre>const csvLines = [&quot;TITLE,PRICE,RATING,URL&quot;];<br>enriched.forEach((p) =&gt; {<br> const safe = (s) =&gt; `&quot;${String(s || &quot;&quot;).replace(/&quot;/g, &#39;&quot;&quot;&#39;)}&quot;`;<br> csvLines.push([safe(p.title), safe(p.price), safe(p.rating || &quot;&quot;), safe(p.url || &quot;&quot;)].join(&quot;,&quot;));<br>});<br>fs.writeFileSync(csvPath, csvLines.join(&quot;\n&quot;), &quot;utf8&quot;);</pre><p>The result is a readable products.csv file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*tcWFASsFweuBNThMT3JLHg.png" /></figure><h4>Step 9: Generate A Dashboard Summary</h4><p>Finally, create a human-readable summary file with the important metrics.</p><p>Compute:<br>- total products extracted<br>- cheapest offer<br>- average price<br>- best rated product<br>- top 5 product summary</p><p>Example:</p><pre>const priced = enriched.filter((p) =&gt; !isNaN(p.priceValue));<br>const cheapestObj = priced.length ? priced.reduce((a, b) =&gt; (a.priceValue &lt;= b.priceValue ? a : b)) : null;<br>const avgPriceVal = priced.length ? (priced.reduce((s, p) =&gt; s + p.priceValue, 0) / priced.length).toFixed(2) : “N/A”;<br>const bestRatedObj = enriched.slice().sort((a, b) =&gt; {<br> const ra = parseFloat((a.rating || “”).split(“ “)[0]) || 0;<br> const rb = parseFloat((b.rating || “”).split(“ “)[0]) || 0;<br> return rb — ra;<br>})[0] || null;</pre><p>Then write:</p><pre><br>const dashboard = [];<br>dashboard.push(“==================================”);<br>dashboard.push(“SIKKI MARKET DASHBOARD”);<br>dashboard.push(“==================================”);<br>dashboard.push(`Query: ${query}`);<br>dashboard.push(`Products Extracted: ${enriched.length}`);<br>dashboard.push(`Cheapest Product: ${cheapestObj ? `${cheapestObj.title} | ${cheapestObj.price}` : “N/A”}`);<br>dashboard.push(`Average Price: ${avgPriceVal === “N/A” ? “N/A” : `$${avgPriceVal}`}`);<br>dashboard.push(`Best Rated: ${bestRatedObj ? `${bestRatedObj.title} | ${bestRatedObj.rating || “N/A”}` : “N/A”}`);<br>dashboard.push(“\nTop 5 Products:”);<br>enriched.slice(0, 5).forEach((p, i) =&gt; {<br> dashboard.push(`${i + 1}. ${p.title} | ${p.price} | ${p.rating || “N/A”} | ${p.url || “N/A”}`);<br>});<br>fs.writeFileSync(dashboardPath, dashboard.join(“\n”), “utf8”);</pre><p>Lets have a look at the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoqHjs89wn6dRSIWzxPFww.png" /><figcaption>SIKKI summary report</figcaption></figure><p>That’s it for today. What we’ve built is a foundation, not a finished product. The interesting part is what you scale it into, and there’s a lot of room.</p><p>Here is the github repo of this project (SIKKI agent): <a href="https://github.com/codewithshahan/sikki-agent">https://github.com/codewithshahan/sikki-agent</a></p><h3>Where To Go From Here</h3><p>This article intentionally focused on the foundations. But SIKKI can become significantly more powerful. You can extend it with:</p><ul><li>Multi-site product comparison</li><li>Competitor tracking</li><li>Scheduled market reports</li><li>Interactive dashboards</li><li>Price trend monitoring</li><li>Autonomous shopping assistants</li><li>Agent memory using databases</li><li>Multi-agent workflows</li></ul><p>You could even create an agent that monitors hundreds of e-commerce websites every day and sends market intelligence directly to your inbox.</p><p>The possibilities become surprisingly large once you stop thinking of browser automation as scraping and start thinking about it as an intelligent system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*86rF-qdPxPgB5v7dr4aOwg.png" /></figure><p><em>If you’re serious about mastering clean code and taking your programming career to the next level, then my book is for you: </em><a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><em>Clean Code Zero to One</em></a><em>. I am offering a 50% discount using the code “earlybird” during checkout ;only for the first 50 copies! Plus, enjoy a 30-day money-back guarantee. no risk, all reward.</em></p><h3>Conclusion</h3><p>Many developers think AI Agents begin with LLMs. I think they begin with architecture. An agent is not just a prompt.</p><p>It is not just a browser. It is not just an API.</p><p>It is the coordination between observation, reasoning, and action.</p><p>That is why I built SIKKI: What began as a simple browser session eventually became something much more interesting.</p><p>A system capable of exploring the web, interpreting information, and transforming raw data into actionable knowledge.</p><p>And I believe this is only the beginning.</p><p>The future of browser automation isn’t scraping pages.</p><p>It’s building agents that can understand them.</p><p><em>Thousands of developers share what they’re building, learning, and discovering across our publications every month. One account connects you to our entire network of publications and communities. </em><a href="https://plainenglish.io/write-for-us"><strong><em>Explore more at plainenglish.io</em></strong><em>.</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=834927667e87" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-build-an-unrestricted-browser-automation-ai-agent-using-node-js-834927667e87">How to Build an Unrestricted Browser Automation AI Agent using Node.js,</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build an Unrestricted AI Agent for Browser Automation using Bright Data, Gemini, and…]]></title>
            <link>https://codewithshahan.medium.com/how-to-build-an-anonymous-ai-agent-for-browser-automation-using-bright-data-gemini-and-playwright-4554e064a0cf?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/4554e064a0cf</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Sun, 05 Jul 2026 05:26:04 GMT</pubDate>
            <atom:updated>2026-07-05T05:38:20.957Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Build an Unrestricted AI Agent for Browser Automation using Bright Data, Gemini, and Playwright</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFGWyBZ5Xve3LWLE8ZLNqg.gif" /><figcaption>image by author</figcaption></figure><p><strong>In this full guide, you’ll learn:</strong></p><ul><li>Why <a href="https://medium.com/stackademic/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">most AI browser agents fail</a> on modern websites.</li><li>How browser fingerprinting and anti-bot systems work.</li><li>How to build an AI browser agent using JavaScript (Node.js) that combines Gemini, <a href="https://playwright.dev/">Playwright</a>, and <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data</a> to browse real websites, extract, analyze, reasoning and generate reports locally without maintaining fragile anti-bot infrastructure ourselves that breaks 5 days later.</li><li>How to setup Bright Data production-ready <a href="https://get.brightdata.com/free-proxies">browser sessions</a> for AI agent automation without user’s assistance manually.</li></ul><h3>Introduction</h3><p>Building unrestricted anonymous browser automation has developed far beyond writing Playwright scripts that click buttons and scrape HTML. Modern websites actively detect automated traffic using <a href="https://www.firefox.com/en-US/features/block-fingerprinting/">browser fingerprints</a>, <a href="https://www.ibm.com/docs/en/ibm-mq/10.0.x?topic=tls-digital-signatures-in-ssltls">TLS signatures</a>, IP reputation, and behavioral analysis, making reliable automation significantly more challenging than it was just a few years ago.</p><p>Modern AI browser agents don’t usually fail because they’re arbitrary. Their reasoning, prompts, and planning loops are often sophisticated. The execution layer underneath is fragile.</p><p>Most tutorials show how to connect an LLM to a browser, execute a few <a href="https://docs.brightdata.com/integrations/playwright">Playwright commands</a>, and declare you’ve built an autonomous agent.</p><pre>await page.goto(url)<br>await page.click(selector)<br>await page.type(selector, text)</pre><p>In reality, you’ve ONLY automated a browser. Commercial sites don’t gauge how intelligent your agent is. They judge whether they believe your browser is genuine.</p><p>Before a page even finishes loading, they inspect what your browser actually is: the <a href="https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/">TLS handshake</a>, IP reputation, browser fingerprints, <a href="https://www.todetect.net/article/canvas/webgl-fingerprint/">canvas and WebGL fingerprints</a>, cookies, device characteristics, and even the rhythm of your connection. Dozens of signals are examined in the time it takes the page to start loading.</p><p>If those signals don’t look authentic, your agent rarely reaches the real application. Instead, it encounters CAPTCHA challenges, verification pages, <a href="https://wiki.c2.com/?QuickSilentRedirect">silent redirects</a>, incomplete datasets, or <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200">HTTP 200 responses</a> that quietly return entirely different content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*4QLzOVjoNVSoetQPpjGytg.png" /><figcaption>Fake 200 response from amazon after sending raw request without browser fingerprint</figcaption></figure><p>This is one of the biggest challenges in modern browser automation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-I21bruIGslPJeI0_OUew.png" /><figcaption>raw http request vs. Bright Data Web Unlocker API gateway</figcaption></figure><p>I’ve always wanted to <a href="https://blog.stackademic.com/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">build an autonomous software system</a> that could function on the web as naturally as a human, not another scraper that extracts a few HTML elements or another automation script that breaks the moment a production website changes.</p><p>Like many developers, I started with HTTP requests, graduated to browser automation, and eventually began building AI agents powered by large language models.</p><p>Along the way, I realized something surprising: intelligence without <a href="https://sajidalianjum.substack.com/p/ai-without-internet-how-offline-ai">reliable web access</a> is meaningless.</p><p>Fortunately, solving this problem doesn’t require <a href="https://fingerprint.com/blog/browser-fingerprinting-techniques/">building your own fingerprinting</a> or <a href="https://get.brightdata.com/bypass-antibot-walls">anti-detection infrastructure</a>.</p><p>Instead, we’ll let <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data handle browser identity</a>, network reputation, and anti-bot bypass while our AI agent focuses on reasoning and execution.</p><p>Because on today’s web, access is an engineering problem.</p><h3>What We Are Building</h3><p>By the end of this article, we’ll build a fully functional browser automation AI agent called <strong>SIKKI Agent</strong>.</p><p>Think of it as an unpaid intern who somehow thinks harder at 3 a.m. than I do: it clicks, scrolls, extracts products, grabs ratings, checks prices, and patiently does the repetitive work I’d rather avoid; the<a href="https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic"> most overqualified intern you’ll never have to pay.</a></p><p>The entire project is built with plain JavaScript. No proprietary framework. No billion-dollar AI platform. Just Node.js, Playwright, Bright Data, and Gemini working together.</p><p>Here’s a quick overview of what we’re going to build:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1AFVtiBkcxQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1AFVtiBkcxQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1AFVtiBkcxQ%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fd6651784d427fea7f93adfbaa064e7/href">https://medium.com/media/8fd6651784d427fea7f93adfbaa064e7/href</a></iframe><blockquote>Note: The complete source code is available on GitHub at the end of this article.</blockquote><p>At a high level, the agent follows this workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mkQ8KOZJNkp8OjYmlYuURw.png" /><figcaption>our sikki agent’s blueprint</figcaption></figure><p>And this is the engineering architecture we’ll build throughout the tutorial:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HtaHnxOaa3goelKXTMQig.png" /></figure><h4>Prerequisite</h4><ul><li><strong>Basic JavaScript/TypeScript or Python. E</strong>ven though I used javascript all over this project, you can follow through this article if you know any programming language. But familiarity with asynchronous programming (async/await) is required, as both scraping and AI calls rely heavily on it.</li><li><strong>Fundamental Node.js or Python Environment:</strong> Ability to install packages via npm or pip and manage local environment variables (.env).</li><li><strong>API Keys:</strong> Active accounts and API keys for both <a href="https://aistudio.google.com/">Google AI Studio (Gemini API)</a> and Bright Data. <strong>Both are free to use.</strong></li><li><strong>Basic DOM Understanding:</strong> A general awareness of HTML structure, though our SIKKI AI agent will minimize the need for complex CSS selectors.</li></ul><p><strong>We will use:</strong></p><ul><li>Gemini as the reasoning engine</li><li>Node.js as the runtime</li><li>Playwright as the browser controller</li><li>Bright Data Scraping Browser as the cloud browser infrastructure</li><li>Memory and retry loops for robustness</li><li>Structured outputs and screenshots for observation</li></ul><p><strong>Our Sikki agent will:</strong></p><ul><li>Accept natural language goals</li><li>Plan browser actions dynamically</li><li>Connect to a remote cloud browser over CDP (Chrome DevTools Protocol)</li><li>Access real websites</li><li>Extract structured information</li><li>Take screenshots</li><li>Recover from failures</li><li>Produce clean results by itself</li></ul><p>But more importantly</p><p>You will understand <strong>why</strong> browser AI agents fail. Why local Playwright breaks. Why websites detect automation. Why browser identity matters.</p><p>And how modern AI agents separate rational thinking from execution to run successfully on the real web.</p><p>We are NOT building another toy model. We are building an architecture.</p><p>And like all architectures, we begin with the foundations.</p><h3>Building Sikki Project</h3><p>In this section, I will show you how to setup Sikki project locally using Gemini, Playwright, and Bright Data and run a quick result in terminal to extract information from CNN website. You can skips this section if you know exactly how to integrate Gemini, Playwright, and Bright Data locally.</p><p>Then in the coming section, I will go deeper building the final Sikki agent engine by showing the blueprint and functional implementations step by step.</p><p>So lets start with a basic test to see whether our API keys and tech stacks are working properly:</p><h4>Step 1: Create the Project</h4><p>Open terminal:</p><pre>mkdir sikki-agent<br>cd sikki-agent<br>npm init -y</pre><p>Enable ES Modules:</p><pre>npm pkg set type=module</pre><p><strong>Note:</strong> Node.js treats .js files as legacy CommonJS by default. We enable ES Modules to cleanly use modern import statements and native await commands at the root level of our AI agent script</p><p><strong>Now install the necessary dependencies:</strong></p><pre>npm install playwright</pre><pre>npm install @google/genai<br>npm install dotenv<br>npm install chalk<br>npm install ora</pre><p>Our project’s folder structure should look like this (create these other directories manually):</p><pre>sikki-agent<br> index.js<br> .env<br> screenshots/<br> reports/<br> package.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*KqlQsgLxLf288edEJVozow.png" /><figcaption>project’s folder structure</figcaption></figure><h4>Step 2: Get Gemini API Key</h4><p>Go to: <a href="https://aistudio.google.com/">https://aistudio.google.com</a></p><p>Create Gemini API Key by creating a new project called “Sikki-Agent”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEYeQ7EAOphXKn1ddnnnAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*kbT7aW_3DndPRlJtVvIUzA.png" /><figcaption>gemini api key project dashboard</figcaption></figure><p>Inside your .env file, paste your Gemini API key:</p><pre>GEMINI_API_KEY = your_gemini_api_key</pre><pre>BRIGHT_WS_ENDPOINT = //i will show you later</pre><h4>Step 3 : Setting up Bright Data Cloud Browser Infrastructure</h4><p>Visit the official gateway link at <a href="https://get.brightdata.com/browser-api">https://get.brightdata.com/browser-api</a> to log into your control panel dashboard.</p><p>Once you are inside the main console sidebar, do not search for generic proxy settings. Navigate directly to the <strong>Web Access API</strong> section on the left-hand navigation menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XI0TP2MXSTn4-TWfKcfIA.png" /></figure><p>Click on the Top right corner “Create API” and choose option labeled <strong>Browser API:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hb9RwKyawl31-u44ruJa2w.png" /></figure><p>then click “continue” and name your API key or leave it default.</p><p>Now click “Add API”; you will find your unique <strong>WebSocket Connection Endpoint</strong>. Copy that first puppeteer/playwright endpoint starting with “wss://brd-customer-hl…” Paste it in your .env file in your local project.</p><pre>BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;</pre><p>It will look exactly like this perpetual connection string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*g-7xVXrsB6omv9Tmv91sKQ.png" /><figcaption>Bright data browser api key</figcaption></figure><p>This is Because:</p><p>We are NOT launching:</p><pre>chromium.launch()</pre><p>Instead:</p><pre>chromium.connectOverCDP()</pre><p>Meaning: Your browser lives in the cloud.</p><p>To help you understand lets write a simple code block to browse CNN’s title from our local terminal using Playwright and Bright Data.</p><h4>Step 4: Connect Playwright to Bright Data</h4><p>Inside your index.js file write that below to access CNN title from terminal:</p><pre>import { chromium }<br>from &quot;playwright&quot;;</pre><pre>const BRIGHT_WS_ENDPOINT = &quot;your_endpoint&quot;</pre><pre>const browser =<br>await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT<br>);</pre><pre>const page =<br>await browser.newPage();<br>await page.goto(<br>&quot;https://cnn.com&quot;<br>);</pre><pre>console.log(<br>await page.title()<br>);</pre><p>If you run this on the terminal, you will see a real CNN website title has been shown. We successfully extracted information and displayed the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*N1aDNB8B7okhpwux8J-2Iw.png" /></figure><p>If you now look at your Bright Data <em>event log</em> inside <strong>web access</strong> panel, you will see successful authentication. That means our BrightData and Playwright are working properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JCKv3hKvVf0G_-U2ELphyQ.png" /><figcaption>bright data event log panel to check if our api calls are successful</figcaption></figure><p>So connectOverCDP() does NOT launch a browser locally.</p><p>Instead, this is what happened:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPUS2oD8qw_iW7lmxENX8Q.png" /><figcaption>image by author</figcaption></figure><p>This separation is one of the most important notions in today’s browser agents:</p><blockquote>Your AI reasons locally. Your browser executes remotely.</blockquote><p>Hope that makes sense.</p><h3>Going Deeper into SIKKI Agent Before Implementation</h3><blockquote>Wait! in this section I will not show you the actual Sikki codebase. I will explain the arthictecture behind SIKKI and how we will implement it in the next setion. You can skip this section if you want.</blockquote><p>Up until now, we have built something that resembles a browser automation script. We opened a cloud browser. We visited a website. We extracted information. And we displayed the results.</p><p>That is useful, but it is not intelligence.</p><p>The truth is that many developers stop at this stage and call their projects AI agents. They build a browser script, attach an LLM somewhere in the pipeline, and assume they have built something autonomous.</p><p><strong>I don’t think that’s enough.</strong></p><p>An autonomous agent is not defined by the presence of an LLM. It is defined by its ability to observe an environment, reason about the information it receives, decide on actions, execute those actions, and continue this cycle until it reaches its objective.</p><p>In other words:</p><p>The browser is not the agent.</p><p>The model is not the agent.</p><p>The agent is the system that connects both.</p><p>This is the architectural philosophy behind SIKKI.</p><h4>SIKKI is Not A Scraper</h4><p>I intentionally avoided calling SIKKI a scraper.</p><p>Scrapers collect data. Agents pursue goals.</p><p>Suppose I ask SIKKI:</p><blockquote>Find the best gaming laptop under $1000.</blockquote><p>A traditional scraper might return the following:</p><pre>ProductPriceAcer Nitro V$899ASUS TUF$949MSI Thin$979</pre><p>Useful. But not intelligent. An actual agent should ask:</p><ul><li>Which products exceed the budget?</li><li>Which product has the highest rating?</li><li>Which seller has the most reviews?</li><li>Which laptop offers the best price-to-performance ratio?</li><li>Is the market trending upward or downward?</li></ul><p>And finally:</p><blockquote>Which one would I personally recommend?</blockquote><p>That is no longer data extraction. That is reasoning. And that is the moment a browser becomes an intelligent e-commerce agent.</p><h3>The Architecture Behind SIKKI</h3><p>Internally, SIKKI is composed of <strong>four independent layers.</strong> Each layer solves a completely different problem:</p><pre>SIKKI<br><br>Strategic Intelligence Commerce Kernel<br>┌──────────────────────────────┐<br>│ Browser Layer                │<br>│ Playwright + Bright Data     │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Extraction Layer             │<br>│ Product                      │<br>│ Price                        │<br>│ Rating                       │<br>│ Seller                       │<br>│ Availability                 │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ AI Layer                     │<br>│ Gemini                       │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>┌──────────────────────────────┐<br>│ Analysis Layer               │<br>│ Cheapest Products            │<br>│ Market Average               │<br>│ Competitor Comparison        │<br>│ Trend Analysis               │<br>└──────────────────────────────┘<br>                │<br>                ▼<br>        Markdown / CSV<br>        Dashboard Export</pre><p>Because browser automation problems and reasoning problems are fundamentally different. If Gemini cannot understand your prompt, changing Playwright selectors won’t fix it.</p><p>If Bright Data cannot open a page, increasing Gemini’s context window won’t help. Each layer has a different responsibility. And each layer can evolve independently.</p><h4>Building The Extraction Layer</h4><p>Let’s make SIKKI more useful. Instead of extracting a single CNN headline, let’s teach it how to understand products.</p><p>In the real world, commerce websites display several critical pieces of information:</p><ul><li>Product title</li><li>Current price</li><li>Rating</li><li>Review count</li><li>Seller information</li><li>Availability</li><li>Product link</li></ul><p>A human sees these immediately. Our goal is to teach the browser to see them too.</p><p>Inside Playwright, we can execute JavaScript directly in the page context using page.evaluate().</p><p>For example:</p><pre>const products = await page.evaluate(() =&gt; {const items = [];<br>    document.querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach(card =&gt; {<br>        const title =<br>          card.querySelector(&#39;h2 span&#39;)?.innerText;<br>        const price =<br>          card.querySelector(&#39;.a-price .a-offscreen&#39;)<br>          ?.innerText;<br>        const rating =<br>          card.querySelector(&#39;.a-icon-alt&#39;)<br>          ?.innerText;<br>        const link =<br>          card.querySelector(&#39;h2 a&#39;)<br>          ?.href;<br>        if(title &amp;&amp; price){<br>            items.push({<br>                title,<br>                price,<br>                rating,<br>                link<br>            });<br>        }<br>    });<br>    return items;<br>});<br>console.log(products);</pre><p>The output will look like this:</p><pre>[<br> {<br>   title: &quot;Acer Nitro V Gaming Laptop&quot;,<br>   price: &quot;$899&quot;,<br>   rating: &quot;4.5 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> },<br><br>{<br>   title: &quot;ASUS TUF Gaming A15&quot;,<br>   price: &quot;$949&quot;,<br>   rating: &quot;4.4 out of 5 stars&quot;,<br>   link: &quot;https://...&quot;<br> }<br>]</pre><p>At this point, SIKKI has eyes.</p><p>But it still doesn’t know what it is looking at.</p><p>That is where Gemini enters the architecture.</p><h4>Giving SIKKI A Brain</h4><p>I personally think many developers misunderstand LLMs. Gemini is not a magical replacement for code. It is a reasoning engine. This makes it perfect for commerce intelligence.</p><p>After extracting products, we simply send structured JSON to Gemini.</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze the following products.<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest product<br>2. Average price<br>3. Best rated product<br>4. Summary of the market<br>5. Recommendation<br>`;</pre><p><strong>Gemini may answer:</strong></p><blockquote><em>I analyzed 12 products. The cheapest option is Acer Nitro V at $899.</em></blockquote><blockquote><em>The average market price is $942.</em></blockquote><blockquote><em>ASUS TUF has slightly better reviews but is more expensive.</em></blockquote><blockquote><em>Based on value and user ratings, Acer Nitro V provides the best balance between performance and affordability.</em></blockquote><p><em>Now SIKKI is not only obtaining information but also </em>analyzing<em> the output.</em></p><h3>Building the Final SIKKI Agent</h3><p>At this point, we already have everything we need.</p><ul><li>A cloud browser powered by Bright Data</li><li>Playwright connected through CDP</li><li>Gemini API access</li><li>A local Node.js project</li></ul><p>Now, let’s put everything together and build the final version of SIKKI.</p><p>The goal is straightforward:</p><ol><li>Open an e-commerce website.</li><li>Search for a product.</li><li>Extract product information.</li><li>Ask Gemini to analyze the results.</li><li>Export the findings into a Markdown report.</li></ol><p>By the end of this section, you will have a fully functional browser-use AI Agent running locally.</p><h4>Step 1: Create the Agent File</h4><p>Replace your previous local Sikki project index.js file (if you didn’t follow through with our initial “Building Sikki Agent” section) and import the required modules. Paste your Browser CDP endpoint inside your index.js file if you want instant access or follow best practice by creating an .env file (using the dotenv library) to secure your API keys:</p><pre>import &quot;dotenv/config&quot;; //to use environment variables from .env file<br>import fs from &quot;fs&quot;; //to read and write files<br><br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br>//api keys and endpoints from environment variables<br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;</pre><p>Initialize Gemini with a fixed prompt text first, then we will make it dynamic:</p><pre>//initialize the GoogleGenAI client with the Gemini API key<br><br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br>//the prompt to send to the Gemini API<br>const prompt = &quot;Write a short introduction to the Gemini API.&quot;; <br>const response = await ai.models.generateContent({<br>  model: &quot;gemini-2.5-flash&quot;,<br>  contents: prompt,<br>});<br>console.log(response.text);</pre><p>Here is the results in our local terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KeCur01ZzyY3QiFTTK2EoA.png" /></figure><h4>Step 2: Setup Playwright to connect to Bright Data’s WebSocket</h4><p>As I have already shown you how to set up Bright Data with Playwright earlier, I will go straight to searching for e-commerce products.</p><blockquote>Note: Unlike a Playwright’s normal local browser chromium.launch() we used chromium.connectOverCDP(). This browser runs inside Bright Data’s infrastructure. IP rotation, browser fingerprinting, and anti-bot protection are handled automatically. Your local machine only sends instructions.</blockquote><p>To test our playwright and bright data working properly, let’s search for “gaming laptops” from amazon:</p><pre>//setup Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br><br>const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br>  await browser.close();<br>}<br>main();</pre><p>Here is our terminal output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*vtYG8DdY2ZFFiB4p6vz2ng.png" /></figure><p>You can replace Amazon with: BestBuy, Walmart, Product Hunt, g2, Ebay etc. The logic remains <strong>exactly </strong>the same.</p><h4>Step 3: Extract Product Information</h4><p>Now let’s collect structured data.</p><pre>// Playwright to connect to Bright Data&#39;s WebSocket endpoint and navigate to Amazon search results for &quot;gaming laptop&quot;<br>async function main(){<br>  const browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>  const page = await browser.newPage();<br><br>const query = &quot;gaming laptop&quot;;<br>  const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>  console.log(&quot;Navigating Bright Data Playwright to:&quot;, searchUrl);<br>  await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>  const products = await page.evaluate(() =&gt; {<br>    const data = [];<br>    document<br>      .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>      .forEach((card) =&gt; {<br>        const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>        const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>        const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>        if (title &amp;&amp; price) {<br>          data.push({<br>            title,<br>            price,<br>            rating,<br>          });<br>        }<br>      });<br>    return data;<br>  });<br>  console.log(&quot;Step 3: Extract Product Information&quot;);<br>  console.log(products);<br>  const title = await page.title();<br>  console.log(&quot;Amazon search page title:&quot;, title);<br>  console.log(&quot;Bright Data navigation complete for query:&quot;, query);<br>  await browser.close();<br>}<br>main();</pre><p>Our Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Duwp4jXdve2Ms-H-zos-7g.png" /><figcaption>Using playwright to connect to Bright Data’s WebSocket endpoint and navigate to Amazon search results for “gaming laptop”</figcaption></figure><p>At this point, SIKKI has successfully observed the environment.</p><p>Now we give it the ability to reason.</p><h4>Step 4: Ask Gemini To Analyze The Market</h4><p>Create a prompt:</p><pre>const prompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;</pre><p>Generate:</p><pre>const result = await model.generateContent(prompt);<br>const analysis =<br>result.response.text();</pre><p>Terminal output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sM_jJvKHXTMnNM9ZcZyxEA.png" /></figure><p>Here is the “Best reated product” result and analysis that I pasted from my terminal:</p><pre>### 3. Best Rated Product<br>There are three products tied for the highest rating of **5.0 out of 5 stars**:<br>1.  **HP OMEN 16&quot; Gaming Laptop Computer** (Intel Ultra 9 285H, NVIDIA GeForce RTX 5070 8GB, 16GB DDR5, 1TB PCIe SSD, 144Hz IPS WUXGA Display) at **$1,745.99**<br>2.  **HP OMEN 16 Slim RTX 5070 Gaming Laptop** (Intel Ultra 9 285H, NVIDIA RTX 5070, 32GB DDR5, 1TB SSD, 16&quot; FHD+ Anti-Glare) at **$1,929.00**<br>3.  **ASUS ROG Strix G16 Gaming Laptop** (Intel Core i7 14650HX, NVIDIA RTX 5060, 32 GB DDR5 RAM, 1 TB SSD, 16&quot; FHD+ LED Display, &amp; Gaming Accessories) at **$1,999.99**<br><br>**Analysis:** It&#39;s noteworthy that two HP OMEN laptops achieved perfect ratings, both featuring high-end Ultra 9 CPUs and RTX 5070 GPUs. <br>This suggests strong customer satisfaction with HP&#39;s premium gaming line. <br>The ASUS ROG Strix G16 also achieved a 5.0 rating, <br>despite having a slightly lower-tier GPU (RTX 5060) than the <br>HP OMENs in this bracket, possibly due to the included <br>&quot;Gaming Accessories&quot; and overall perceived value. <br>The Alienware product has no rating, so it cannot be considered here.</pre><p>Notice what just happened? The browser extracted raw information.</p><p>Gemini transformed it into business intelligence. That small architectural separation is what turns automation into an AI Agent.</p><h4>Step 5: Export The Sikki Market Report</h4><p>Now we save the scraped product data and Gemini analysis into real files.</p><p>Instead of dumping raw JSON into the output, the final agent:</p><ul><li>extracts clean product titles</li><li>normalizes Amazon URLs</li><li>writes a Markdown report</li><li>writes a CSV table</li><li>writes a short summary.txt dashboard</li></ul><p>Example report generation:</p><pre>const report = `<br># SIKKI Market Report<br>## Search Query<br>${query}<br><br>## Products<br>${JSON.stringify(products, null, 2)}<br>## Gemini Analysis<br>${analysis}<br>Generated: ${new Date().toISOString()}<br>`;<br>fs.writeFileSync(reportPath, report, &quot;utf8&quot;);</pre><p>You will see <strong>sikki-report.md</strong> after running this agent in your terminal.</p><p>Here is the full code:</p><pre>import &quot;dotenv/config&quot;; // use environment variables from .env file<br>import fs from &quot;fs&quot;;<br><br><br>import { chromium } from &quot;playwright&quot;;<br>import { GoogleGenAI } from &quot;@google/genai&quot;;<br>const BRIGHT_WS_ENDPOINT = process.env.BRIGHT_WS_ENDPOINT;<br>const GEMINI_API_KEY = process.env.GEMINI_API_KEY;<br>if (!BRIGHT_WS_ENDPOINT) {<br>  throw new Error(&quot;Missing BRIGHT_WS_ENDPOINT environment variable.&quot;);<br>}<br>if (!GEMINI_API_KEY) {<br>  throw new Error(&quot;Missing GEMINI_API_KEY environment variable.&quot;);<br>}<br>const ai = new GoogleGenAI({<br>  apiKey: GEMINI_API_KEY,<br>});<br>async function retryWithBackoff(fn, maxRetries = 5, initialDelayMs = 2000) {<br>  for (let attempt = 1; attempt &lt;= maxRetries; attempt++) {<br>    try {<br>      return await fn();<br>    } catch (error) {<br>      const errorMsg = error?.message || error?.status || JSON.stringify(error);<br>      if (attempt === maxRetries) {<br>        console.error(`Final attempt failed. Error: ${errorMsg}`);<br>        throw error;<br>      }<br>      const delayMs = initialDelayMs * Math.pow(2, attempt - 1);<br>      console.log(`Attempt ${attempt} failed: ${errorMsg}`);<br>      console.log(`Retrying in ${delayMs}ms... (${attempt}/${maxRetries})`);<br>      await new Promise((resolve) =&gt; setTimeout(resolve, delayMs));<br>    }<br>  }<br>}<br>async function main() {<br>  let browser;<br>  try {<br>    browser = await chromium.connectOverCDP(BRIGHT_WS_ENDPOINT);<br>    const page = await browser.newPage();<br>    const query = &quot;gaming laptop&quot;;<br>    const searchUrl = `https://www.amazon.com/s?k=${encodeURIComponent(query)}`;<br>    console.log(&quot;Connecting Playwright to Bright Data...&quot;);<br>    console.log(&quot;Navigating to:&quot;, searchUrl);<br>    await page.goto(searchUrl, { waitUntil: &quot;domcontentloaded&quot; });<br>    const products = await page.evaluate(() =&gt; {<br>      const data = [];<br>      document<br>        .querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;)<br>        .forEach((card) =&gt; {<br>          const title = card.querySelector(&quot;h2 span&quot;)?.innerText;<br>          const price = card.querySelector(&quot;.a-price .a-offscreen&quot;)?.innerText;<br>          const rating = card.querySelector(&quot;.a-icon-alt&quot;)?.innerText;<br>          if (title &amp;&amp; price) {<br>            data.push({<br>              title,<br>              price,<br>              rating,<br>            });<br>          }<br>        });<br>      return data;<br>    });<br>    console.log(`Extracted ${products.length} products.`);<br>    const analysisPrompt = `You are an ecommerce analyst.<br>Analyze these products:<br>${JSON.stringify(products)}<br>Return:<br>1. Cheapest Product<br>2. Average Market Price<br>3. Best Rated Product<br>4. Competitor Comparison<br>5. Final Recommendation<br>`;<br>    console.log(&quot;Sending products to Gemini for analysis (with retry logic)...&quot;);<br>    const analysisResult = await retryWithBackoff(async () =&gt; {<br>      return await ai.models.generateContent({<br>        model: &quot;gemini-2.5-flash&quot;,<br>        contents: analysisPrompt,<br>      });<br>    }, 5, 2000);<br>    const analysis = analysisResult.text || &quot;No analysis text returned.&quot;;<br>    const report = `# SIKKI Market Report<br>## Search Query<br>${query}<br>## Products<br>${JSON.stringify(products, null, 2)}<br>## Gemini Analysis<br>${analysis}<br>Generated: ${new Date().toISOString()}<br>`;<br>    fs.writeFileSync(&quot;sikki-report.md&quot;, report, &quot;utf8&quot;);<br>    console.log(&quot;Step 5: Export the Results&quot;);<br>    console.log(&quot;Report generated: sikki-report.md&quot;);<br>    console.log(&quot;Final analysis saved. Open sikki-report.md to review the result.&quot;);<br>    await browser.close();<br>  } catch (error) {<br>    console.error(&quot;Error:&quot;, error.message || error);<br>    if (browser) {<br>      await browser.close().catch(() =&gt; {});<br>    }<br>    process.exit(1);<br>  }<br>}<br>main();</pre><p>Here is the output of Sikki market report:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*EokCFUKVxH46KVwQt3kY_A.png" /></figure><h4>Step 6: Teach SIKKI To Capture Evidence</h4><p>Now that SIKKI can scrape product metadata, the next job is proof.</p><p>Capture evidence by taking:</p><ul><li>one search-results summary screenshot</li><li>a product card screenshot for the top result</li><li>direct product page screenshots for the highest-ranked items</li></ul><p>Here is how:</p><pre>const searchScreenshot = path.join(screenshotDir, &quot;search-results.png&quot;);<br>await page.screenshot({ path: searchScreenshot, fullPage: true });<br>const summaryPath = path.join(screenshotDir, &quot;top-product-summary.png&quot;);<br>await cards[0].screenshot({ path: summaryPath });</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy62kFUiEDbIBnbmhNO3vQ.png" /></figure><h4>Step 7: Capture Every Product Page</h4><p>Now we’re able to extract product information using Bright Data (Playwright) without getting blocked by antibot walls, analyze the market using Gemini, and make a report that will be stored inside our /Reports directory. SIKKI should visit each selected product URL and save the page image and it should be graceful without error loops.</p><p><strong>Here is the fun part: </strong>we don’t want only search result screenshots; we want each product page detail picked by Gemini intelligence. We will generate up to five screenshots; the first screenshot will be a summary. The remaining 4 screenshots should be: top products and individual product details pages. They will be generated based on the user search query and carefully analyzed by Gemini.</p><p>Let’s update our code, but this code is too long to paste here (you should check my git repo) so I will explain what I am changing along the way.</p><p>Let’s first have a look at what changes our new updated code made. This time I will search for “ryzen processor”:</p><p>Key points we are making:<br>- normalize the URL first<br>- visit the direct product page<br>- wait briefly for the page to render<br>- save up to 4 product screenshots</p><p>Example:</p><pre>const normalized = normalizeAmazonUrl(p.url, p.title);<br>await retryWithBackoff(async () =&gt; <br> await page.goto(normalized, { waitUntil: &quot;domcontentloaded&quot;, timeout: 120000 }), <br> 3, <br> 1500<br>);<br>await page.waitForTimeout(800);<br>await page.screenshot({ path: outPath, fullPage: true });</pre><p>Here is our intelligent agent picking the top product from Bright Data’s extracted data after a successful analysis and saving a screenshot inside the “screenshot” folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7H_CiDrvw1Ow-RnAZfMi_g.png" /></figure><p>This turns SIKKI from “just data” into “evidence-backed market intelligence.”</p><h4>Step 8: Create a CSV Export</h4><p>A CSV file is essential for downstream analysis and makes the agent practical.</p><p>Write a simple export with:<br>- title<br>- price<br>- rating<br>- normalized URL</p><p>Example:</p><pre>const csvLines = [&quot;TITLE,PRICE,RATING,URL&quot;];<br>enriched.forEach((p) =&gt; {<br> const safe = (s) =&gt; `&quot;${String(s || &quot;&quot;).replace(/&quot;/g, &#39;&quot;&quot;&#39;)}&quot;`;<br> csvLines.push([safe(p.title), safe(p.price), safe(p.rating || &quot;&quot;), safe(p.url || &quot;&quot;)].join(&quot;,&quot;));<br>});<br>fs.writeFileSync(csvPath, csvLines.join(&quot;\n&quot;), &quot;utf8&quot;);</pre><p>The result is a readable products.csv file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*tcWFASsFweuBNThMT3JLHg.png" /></figure><h4>Step 9: Generate A Dashboard Summary</h4><p>Finally, create a human-readable summary file with the important metrics.</p><p>Compute:<br>- total products extracted<br>- cheapest offer<br>- average price<br>- best rated product<br>- top 5 product summary</p><p>Example:</p><pre>const priced = enriched.filter((p) =&gt; !isNaN(p.priceValue));<br>const cheapestObj = priced.length ? priced.reduce((a, b) =&gt; (a.priceValue &lt;= b.priceValue ? a : b)) : null;<br>const avgPriceVal = priced.length ? (priced.reduce((s, p) =&gt; s + p.priceValue, 0) / priced.length).toFixed(2) : “N/A”;<br>const bestRatedObj = enriched.slice().sort((a, b) =&gt; {<br> const ra = parseFloat((a.rating || “”).split(“ “)[0]) || 0;<br> const rb = parseFloat((b.rating || “”).split(“ “)[0]) || 0;<br> return rb — ra;<br>})[0] || null;</pre><p>Then write:</p><pre>const dashboard = [];<br>dashboard.push(“==================================”);<br>dashboard.push(“SIKKI MARKET DASHBOARD”);<br>dashboard.push(“==================================”);<br>dashboard.push(`Query: ${query}`);<br>dashboard.push(`Products Extracted: ${enriched.length}`);<br>dashboard.push(`Cheapest Product: ${cheapestObj ? `${cheapestObj.title} | ${cheapestObj.price}` : “N/A”}`);<br>dashboard.push(`Average Price: ${avgPriceVal === “N/A” ? “N/A” : `$${avgPriceVal}`}`);<br>dashboard.push(`Best Rated: ${bestRatedObj ? `${bestRatedObj.title} | ${bestRatedObj.rating || “N/A”}` : “N/A”}`);<br>dashboard.push(“\nTop 5 Products:”);<br>enriched.slice(0, 5).forEach((p, i) =&gt; {<br> dashboard.push(`${i + 1}. ${p.title} | ${p.price} | ${p.rating || “N/A”} | ${p.url || “N/A”}`);<br>});<br>fs.writeFileSync(dashboardPath, dashboard.join(“\n”), “utf8”);</pre><p>Lets have a look at the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoqHjs89wn6dRSIWzxPFww.png" /><figcaption>SIKKI summary report</figcaption></figure><p>That’s it for today. What we’ve built is a foundation, not a finished product. The interesting part is what you scale it into, and there’s a lot of room.</p><p>Here is the github repo of this project (SIKKI agent): <a href="https://github.com/codewithshahan/sikki-agent">https://github.com/codewithshahan/sikki-agent</a></p><h3>Where To Go From Here</h3><p>This article intentionally focused on the foundations. But SIKKI can become significantly more powerful. You can extend it with:</p><ul><li>Multi-site product comparison</li><li>Competitor tracking</li><li>Scheduled market reports</li><li>Interactive dashboards</li><li>Price trend monitoring</li><li>Autonomous shopping assistants</li><li>Agent memory using databases</li><li>Multi-agent workflows</li></ul><p>You could even create an agent that monitors hundreds of e-commerce websites every day and sends market intelligence directly to your inbox.</p><p>The possibilities become surprisingly large once you stop thinking of browser automation as scraping and start thinking about it as an intelligent system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*86rF-qdPxPgB5v7dr4aOwg.png" /></figure><p><em>If you’re serious about mastering clean code and taking your programming career to the next level, then my book is for you: </em><a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><em>Clean Code Zero to One</em></a><em>. I am offering a 50% discount using the code “earlybird” during checkout ;only for the first 50 copies! Plus, enjoy a 30-day money-back guarantee. no risk, all reward.</em></p><h3>Conclusion</h3><p>Many developers think AI Agents begin with LLMs. I think they begin with <a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one">architecture</a>. An agent is not just a prompt.</p><p>It is not just a browser. It is not just an API.</p><p>It is the coordination between observation, reasoning, and action.</p><p>That is why I built SIKKI: What began as a simple browser session eventually became something much more interesting.</p><p>A system capable of exploring the web, interpreting information, and transforming raw data into actionable knowledge.</p><p>And I am convinced this is only the beginning.</p><p>The future of browser automation isn’t scraping pages anymore. It’s building agents that can understand them.</p><h3>Frequently Asked Questions</h3><h4>1. Why use Bright Data instead of running Playwright locally?</h4><p>Local Playwright is perfect for development and testing, but production websites often evaluate browser fingerprints, IP reputation, TLS signatures, and other anti-bot signals before serving content. <a href="https://get.brightdata.com/scraping-browser-signup">Bright Data</a> provides a production-ready browser infrastructure that handles these challenges behind the scenes that allows your AI agent to interact with websites more reliably while you focus on building application logic.</p><h4>2. Do I still need Playwright if I’m using Bright Data?</h4><p>Yes. Bright Data and Playwright solve different problems. <a href="https://playwright.dev/">Playwright</a> controls the browser by clicking, typing, navigating, and extracting data, while <a href="https://get.brightdata.com/scraping-browser-signup">Bright Data</a> provides a cloud browser environment designed to access modern websites reliably. Together they create a much more robust browser automation stack than using either tool alone.</p><h4>3. What kinds of AI agents can I build with Bright Data?</h4><p>Once you have reliable browser access, the possibilities extend far beyond web scraping. The same architecture can power shopping assistants, market research agents, competitor monitoring systems, travel assistants, browser testing agents, lead generation workflows, news monitoring, and autonomous research assistants. By combining an LLM for reasoning, Playwright for browser control, and Bright Data for browser infrastructure, you can build AI agents capable of operating on real websites with minimal changes to the overall architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4554e064a0cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Bypass Anti-Bot Walls for Production-Ready Apps]]></title>
            <link>https://codewithshahan.medium.com/how-to-bypass-anti-bot-walls-for-production-ready-apps-4e5b141219be?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e5b141219be</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 23:23:11 GMT</pubDate>
            <atom:updated>2026-07-05T05:44:13.810Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADjJrp6Hzox-xVgspIZ0VQ.png" /><figcaption>Image by author</figcaption></figure><p>In this guide, you’ll learn:</p><ul><li>Why traditional scraping approaches fail against modern anti-bot systems, even when using rotating User-Agents or browser automation.</li><li>How enterprise websites actually detect and block automated traffic through fingerprinting, reputation scoring, behavioral analysis, and network signals.</li><li>How to architect a production-ready scraping pipeline using cloud browsers, proxies, and AI agents instead of brittle scripts.</li><li>How to build a multi-target autonomous agent called <strong>Vanguard</strong> that can reliably collect data from modern websites at scale.</li></ul><p>If you’re anything like me, you’ve probably found that many web scraping tutorials stop being useful the moment you point them at a real production website.</p><p>The common advice is surprisingly predictable: use<em> fetch()</em>, automate a browser with <a href="https://autify.com/blog/playwright-vs-puppeteer">Playwright or Puppeteer</a>, rotate a User-Agent, maybe add a proxy, and you’re supposedly ready to scrape almost anything.</p><p>That approach might work against a small personal website. It usually falls apart against companies like Amazon, Product Hunt, G2, Walmart, or CNN.</p><p>Developers often assume anti-bot protection is just another HTTP check that can be bypassed by changing a few request headers. Modern detection systems work very differently: they review browser fingerprints, TLS characteristics, IP reputation, behavioral patterns, request timing, JavaScript execution, and dozens of other signals before deciding whether your traffic looks human.</p><p>Changing your User-Agent is only one tiny piece of that puzzle.</p><p>To understand why so many automation projects eventually fail, we first need to understand how modern <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">Web Application Firewalls (WAFs)</a> actually inspect and classify traffic.</p><p><strong>Corporate website’s WAF ecosystem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*CkL5isup9Hj-B9843b3Xzg.png" /><figcaption>Corporate website’s WAF ecosystem</figcaption></figure><p>If you’ve built automation that kept getting blocked after a few days, you’re not alone. I’ve written far more broken scraping systems than successful ones, and every failure taught me something about how these defenses actually work.</p><p>The good news is that the problem usually isn’t your code. It’s the architecture behind it.</p><p>Throughout this guide, we’ll look beyond individual requests and focus on designing systems that can survive production environments. Regardless of how you’re building a price-monitoring platform, collecting market intelligence, or <a href="https://get.brightdata.com/codewithshahan-scraping-browser">fueling AI agents with fresh web data</a>, the underlying principles remain the same.</p><p>By the end, you’ll understand the mechanics behind modern bot detection and build a fully operational multi-target agent called Vanguard. More importantly, you’ll understand <em>why</em> its architecture continues working long after traditional scraping scripts have failed.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs8tXrYsGmUY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds8tXrYsGmUY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs8tXrYsGmUY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href">https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href</a></iframe><p><strong>Prerequisite:</strong> All examples use plain JavaScript with Node.js so we can focus on the underlying architecture instead of framework-specific details</p><h3>I — The Illusion of the Clean Browser</h3><p>When an automation script fails, developers immediately look for a quick proxy patch. They focus on changing their actions to make progress toward the goal (which is low impact) instead of fundamentally changing how their connection behaves so that success naturally follows (which is high impact).</p><p>Typically, developers write a script, test it on their local machine, and watch it succeed. They look at a target link (e,g.<a href="https://www.amazon.com/s?k=ddr5+ram+128gb,"> https://www.amazon.com/s?k=ddr5+ram+128gb),</a> paste it into their personal browser, and see the clean results page layout load instantly without a single CAPTCHA block:</p><figure><img alt="normal agentic script for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/800/1*KWlou6_OorKdl-ZN4r9efQ.gif" /></figure><p>They assume the target is wide open. But they are trying to build a great pipeline on a rotting foundation.</p><p>Your personal browser loads that link because it brings a lifetime of clean human history. It presents a validated residential IP address, deep cookie pools, active browser session context, and a highly complex, hardware-accelerated <a href="https://fingerprint.com/blog/what-is-tls-fingerprinting-transport-layer-security/">TLS cryptographic fingerprint</a>. Your browser doesn’t have to “grind” or “prove” it’s human; its natural behavior inherently aligns with what the security system requires.</p><p>A vanilla automated script has none of this context. To show you exactly how fast a standard production system rejects unmanaged automation, let’s look at the naive code most engineers write when they are being lazy.</p><h3>II — The Anatomy of an Immediate Rejection</h3><p>If you want to understand how anti-bot engines work, you must look at how they treat raw, unmanaged server requests.</p><p>If this doesn’t make sense, let’s run through an example.</p><p>When you execute this, your connection is dropped. Amazon’s WAF doesn’t care that your string header says “Mozilla”. It looks at the <a href="https://github.com/CarterPerez-dev/Cybersecurity-Projects/blob/main/SYNOPSES/intermediate/JA3.JA4.TLS.Fingerprinting.Tool.md">TCP handshake</a> behavior, notices that your <a href="https://www.tenable.com/audits/items/CIS_MS_IIS_10_v1.2.1_Level_2.audit:402c63d34c7c6a259868d26c647860af">TLS cipher suite order</a> doesn’t match an actual Windows Chrome installation, maps your datacenter or unrotated local IP, and flags the machine instantly.</p><p>So… security systems read what your connection does. Your headers are irreverent. Take a look:</p><figure><img alt="amazon anti bot walls firewall" src="https://cdn-images-1.medium.com/max/1024/1*1OT-lDFIr9QKjBEBGKFGZA.png" /></figure><figure><img alt="how bot protection works on corporate sites" src="https://cdn-images-1.medium.com/max/1024/1*gBVrQTaGsYH0AwUxS3672Q.png" /><figcaption>Concept art by <a href="https://medium.com/u/f63fe8afc87">Shahan Chowdhury</a></figcaption></figure><p>Do you think the real human browser has to “grind” to bypass a CAPTCHA? Does their machine have to trick the target to load a product page? To you, it may seem like a <a href="https://dev.to/codewithshahan/your-first-backend-application-using-nodejs-45i">basic request </a>on the surface, but the truth is that the security gateway cannot see them as anything other than authentic. The human browser has to try incredibly hard to trigger an anti-bot wall. The bare automated script has to force its way through a firewall, and <a href="https://www.buzzstream.com/blog/publishers-block-ai-study/">it gets flagged every single second of it.</a></p><p>To some developers, a professional enterprise proxy mesh seems extreme and over-engineered. To me, it’s natural, and I don’t say that to contrast it with any other kind of architecture. I simply enjoy running production systems that do not break. When my peers tell me that I should just use a basic string rotation utility… I hold my tongue from telling them, “If your scripts are constantly breaking, why are you doing what you’re doing?”</p><p>This next sentence may sound simple, <em>but it is baffling how many people don’t get it.</em></p><p>If you want to scrape enterprise websites reliably, the request itself is only part of the equation. Modern Web Application Firewalls (WAFs) inspect your browser fingerprint, network behavior, TLS fingerprint, session history, IP reputation, and many other signals before deciding whether you’re a legitimate user or an automated bot.</p><p>To understand why most scraping scripts eventually fail, we first need to look at how modern WAFs make those decisions.</p><h3>III — The “Fake” 200 Response Trap</h3><p>Lets look at a real-world scenario where all corporate websites play with agentic AI developers by using <em>“soft block”</em> tricks. I will be using<a href="https://www.npmjs.com/package/axios"> </a><a href="http://node.js/">Node.js</a> <a href="https://www.npmjs.com/package/axios">axios</a> library locally to send asynchronous network requests to REST endpoints, in this case our target URL endpoint is Amazon&#39;s DDR5 ram listing page (you can use any website you like for scraping data):</p><pre>// The Lazy Scraping Pattern (Guaranteed to fail at scale)<br><br>const axios = require(&#39;axios&#39;);<br>async function naiveScrape() {<br>const targetUrl = &#39;https://www.amazon.com/s?k=ddr5+ram+128gb&#39;;<br>try {<br>const response = await axios.get(targetUrl, {<br>headers: { &#39;User-Agent&#39;: &#39;Mozilla/5.0…&#39; }<br>});<br>console.log(&quot;Success! Status:&quot;, response.status, &quot;Data Length:&quot;,<br>response.data.length);<br>} catch (error) {<br>console.error(&quot;Blocked!&quot;);<br>}<br>}<br>naiveScrape();</pre><p>If you run this code inside your terminal right now, you might see an output that looks exactly like this:</p><figure><img alt="amazon soft block exposes with 200 respose status in terminal" src="https://cdn-images-1.medium.com/max/803/1*Y9Pr9zxoNGoIdoOEr5XP6Q.png" /></figure><p>When scraping a gigantic popular website, a 200 OK response status is often a false victory. Large e-commerce sites use a technique called a <strong>Soft Block</strong>.</p><p>You look at that output. You see nearly a megabyte of data. You see no errors. You see a pristine “200 Success” code. You assume your <a href="https://dev.to/codewithshahan/writing-clean-reusable-components-in-react-best-practices-2gka">code cleanly outsmarted the infrastructure</a>. You are wrong.</p><p>This is the cleverest trap in modern web architecture. High-tier platforms rarely throw a loud <a href="https://seocom.agency/en/blog/web-errors-404-403-503-502-401-meaning-and-solutions/">403 Forbidden or 503 Error code</a> to standard scripts anymore. If they give you an error code, you know instantly you’re blocked, and you immediately start changing your code.</p><p>Instead, they route your connection away from the raw data asset entirely. Let’s prove exactly what is inside that 650KB+ length data string. Add these logging lines directly into your try block inside the above codeblock:</p><pre>console.log(&quot;Does it contain Amazon&#39;s soft-block tag?&quot;, response.data.includes(&quot;a-no-js&quot;));<br>console.log(&quot;First 300 characters of the page code:\n&quot;, response.data.substring(0, 300));</pre><p>When you run it, you won’t see the actual marketplace data from amazon. You will see lines of obfuscated, tracking JavaScript loops meant to run in a real browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*4QLzOVjoNVSoetQPpjGytg.png" /></figure><p>See? Your terminal <em>exposed</em> the trap. The real clue is the content that was returned. Instead of the product page DOM you expected, Amazon responded with its <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-captcha-and-challenge.html">verification challenge wrapper</a>. In other words, AWS WAF intercepted your request and served a challenge page rather than the actual marketplace content because your script wasn’t operating as a real browser session. Because your script lacked a continuous browsing fingerprint, AWS WAF silently intercepted your connection and handed you a dead-end sandbox loop.</p><p>Your script spends precious compute power downloading and trying to parse almost a megabyte of empty authentication wrappers, completely blind to the fact that it didn’t capture a single item. Automated agents cannot run the tracking scripts required to clear that page, putting your pipeline at a complete dead end.</p><p>Even though a target website tricks your code with a fake success redirect or drops you completely with a <em>403</em> Forbidden block, you are losing the exact same thing: <strong>access to the data layer.:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3A0IQCmGDIWGnlK_83qmw.png" /></figure><p>I will now use CNN news website as target URL, instead of falling into Amazon’s tricky “soft block” trap, you will receive an instant block because they use <strong>Cloudflare</strong>, which will instantly reject your vanilla Axios request with a hard <strong>HTTP 403 Forbidden</strong> error code and crash the script. Have a look:</p><pre>const axios = require(&#39;axios&#39;);<br>async function naiveScrape() {<br>// Switching to a Cloudflare-protected target for a clean firewall error<br>const targetUrl = &#39;https://www.cnn.com/&#39;;<br>try {<br><br>console.log(&quot;Initiating naive data extraction request…&quot;);<br>const response = await axios.get(targetUrl, {<br>headers: {<br>&#39;User-Agent&#39;: &#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64)<br>AppleWebKit/537.36&#39;<br>}<br>});<br><br>console.log(&quot;Success! Data Length:&quot;, response.data.length);<br>} catch (error) {<br><br>console.error(&quot;\n❌ Request Crushed by Anti-Bot Wall.&quot;);<br>if (error.response) {<br>// This will capture and print the hard 403 error code<br>console.error(`Status Code: ${error.response.status}`);<br>console.error(`Status Text: ${error.response.statusText}`);<br>console.error(&quot;Reason: Cloudflare WAF rejected the vanilla Axios<br>handshake.&quot;);<br><br>} else {<br><br>console.error(&quot;Error Message:&quot;, error.message);<br><br>}<br>}<br>}<br>naiveScrape();</pre><p><strong>Here is the result inside the terminal:</strong></p><figure><img alt="agent get blocked by CCN’s cloudflare" src="https://cdn-images-1.medium.com/max/801/1*IqHJCXriGpCsAdsWRi0nMQ.png" /></figure><p>A 403 Forbidden error is universally recognized by developers as a <a href="https://brightdata.com/blog/leadership/web-unlocker-site-unblocking-capabilities"><strong>hard security rejection</strong>.</a> It removes all ambiguity. The errors will be the same for<a href="http://g2.com/"> g2.com</a> or any other protected sites and your automated agents cannot run that script, so your code is completely stuck at a dead end.</p><h3>IV — Moving to an Automated Gateway</h3><p>I realized I couldn’t spend my life engineering custom solutions for every single browser fingerprint update, JS challenge modification, or proxy rotation algorithm. It’s an endless game of whack-a-mole. I needed a production-ready infrastructure that handled the network-level deception for me so I could focus purely on writing data logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zss3CQrkl6NqNHF0YWK0Dg.png" /></figure><p>That is why I migrated this workflow to <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data’s Web Unlocker</a>. It treats the entire bypass pipeline as a simple managed endpoint. It acts as an abstraction layer that intercepts your raw request, automatically executes the necessary TLS handshakes, decrypts hidden challenges, mimics human behavior, and pipes back the clean HTML data.</p><p>Here is exactly how to set this up and test it without turning your local computer into a messy testing ground.</p><h4>Step 1: Account Activation and Token Generation</h4><p>First, you need access to the proxy cluster infrastructure.</p><ol><li>Sign up for a console dashboard account on <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data Web Unlocker</a>.</li><li>From the main dashboard sidebar, navigate to <strong>Web Access</strong>:</li></ol><figure><img alt="Bright data web unlocoker setup for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/1024/1*c6fCPuncBiv2DTgBixjmYA.png" /></figure><p>3. Select <strong>Web Unlocker API </strong>and press continue. This is the specialized cluster that houses the machine-learning-driven browser emulation layer:</p><figure><img alt="Bright data web unlocoker api setup for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/1024/1*fWK0en34LvSVSdGnoeX8Pg.png" /></figure><p>4. Name your routing zone (default is: web_unlocker1), activate it, and generate an API Token by clicking into the “API key” box.</p><p>5. Allow Your Server IP: Before sending requests, there’s one important configuration step that’s easy to miss.</p><p>Open your Web Unlocker zone settings, go to the configuration tab, then security settings, and finally check <strong>Allowed IPs</strong>. Make sure to add your current IPs in the allowlist. Go to “Configuration, then “Security Settings”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*EloMNNQcteIKwxsAORC-Ww.png" /></figure><p>Here is “Add allowed IP” box. Paste your current IP from your machine or check “recent IPs allowlist”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*GhFQkkdCIEdcHq4Udt6wCA.png" /></figure><p>Without this step, your API key may be valid and your zone may be configured correctly, but your requests can still fail because Bright Data rejects connections from unauthorized IP addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*0ZXwMs_IFSEfQ4vQfC2sOg.png" /></figure><p>Once your IP has been added and the changes have propagated, you’re ready to send your first request.</p><h4>Step 2: Testing Inside the Native Playground</h4><p>Before you deploy a single line of application code to your servers, you can visually verify that the unlocking layer works by using their built-in <strong>Playground</strong>. It allows you to run requests directly from the cloud console to check how targets respond.</p><ol><li>Paste your target address directly into the <strong>Target URL</strong> field. For example: https://www.amazon.com/s?k=ddr5+ram+128gb</li><li>Keep the configuration to <strong>API</strong> mode and device type to <strong>desktop.</strong></li><li>Hit the blue <strong>Run Request</strong> button:</li></ol><figure><img alt="Bright data web unlcoker built in playground for web access without getting blocked" src="https://cdn-images-1.medium.com/max/1024/1*Zej2mP90U6GuhmxBLpZ9yg.png" /></figure><p>The interface will display a green<em> RESPONSE 200</em> success state. If you look at the bottom visual block, you’ll see a rendering preview of the exact Amazon product directory list. You’ll also find the pure market tables and real product tags instead of the hidden a-no-js container structures. It managed to bypass the <em>security wall</em> seamlessly.</p><p>It is a 3-in-1 tool that manages IP rotation, dynamic browser fingerprinting, and CAPTCHA solving automatically. The API bypasses the anti-bot wall and returns the clean HTML source code to the software in a single response.</p><p><strong><em>Note on verification:</em> </strong>If you download that specific raw response file from the playground UI, your computer will automatically open it up inside a local web browser, rendering it visually. If you want to see the actual raw data your backend will process, simply open that downloaded file with a basic text editor like VS Code. You will find thousands of lines of pristine, uninhibited DOM structural code strings.</p><h3>V — Building LaunchRadar Agent</h3><p>If you are trying to feed live web data into an LLM using basic Axios configurations or unmanaged connection structures, you are forcing your AI agent to ride a bicycle with flat tires. Modern security layers look for advanced browser behaviors and TLS cipher sequences. If you try to manually concatenate your configuration parameters as raw text blocks, a single trailing comma will break strict backend string parsing, throwing a frustrating 400 Bad Request or an empty payload block.</p><p>Therefore, we need to install Bright Data’s official SDK in our project. With this, we completely eliminate Axios-style network proxy bugs and let Bright Data handle them.</p><p>Lets go trough the code blocks step by step to build our first AI agent using Bright Data. We are going to assemble a product hunt’s trend intelligence agent called LaunchRadar. Its target is specific: it bypasses the tracking walls of<a href="https://www.producthunt.com/"> Product Hunt</a>, ingests the real-time tech product feeds, and structures raw document strings into clean text data arrays ready to feed straight into an LLM context window.</p><h4>Setup LaunchRadar Project from Scratch</h4><p>To ensure your runtime application environment maps dependencies cleanly, we will completely drop out of folders controlled by cloud backup networks (like Microsoft OneDrive or iCloud) that lock active file permissions and disrupt local script loops.</p><p>Open your terminal window (Terminal app on macOS, or your preferred shell) and run these clean setup commands sequentially to construct an isolated project workspace from scratch:</p><pre># 1. Move directly to your local User Home root path to avoid file syncing errors<br>cd ~<br><br># 2. Provision a dedicated application folder<br>mkdir LaunchRadar<br><br># 3. Enter your newly initialized project workspace<br>cd LaunchRadar<br><br># 4. Initialize an isolated local package architecture<br>npm init -y<br><br># 5. Tell the Node.js runtime to process modern ES Module imports natively<br>npm pkg set type=&quot;module&quot;</pre><p>Now install the official bright data SDK locally using node.js:</p><pre>npm install @brightdata/sdk </pre><p>Now, create a fresh file named index.js inside your application directory workspace and paste this exact production script to scrap raw HTML data from Product Hunt:</p><pre><br><br> /**<br> * Project: LaunchRadar<br> * Core Stack: Node.js + Official Bright Data JavaScript SDK<br> */<br><br><br>import { bdclient } from &#39;@brightdata/sdk&#39;;<br><br><br>const BRIGHTDATA_KEY = process.env.BRIGHTDATA_API_KEY || &#39;&#39;;<br><br><br>async function deployLaunchRadar() {<br>    // Targeting Product Hunt&#39;s active daily launch asset path<br>    const targetUrl = &#39;https://www.producthunt.com/&#39;;<br>   <br>    console.log(&quot;🤖 [LaunchRadar]: Initializing autonomous target ingestion loop...&quot;);<br><br><br>    try {<br>        // Initialize the client gateway via the native constructor<br>        const client = new bdclient({<br>            apiKey: BRIGHTDATA_KEY<br>        });<br><br><br>        console.log(&quot;🤖 [LaunchRadar]: Tunneling through Web Unlocker cluster...&quot;);<br>       <br>        // Execute the single-step browser-emulated extraction natively<br>        const htmlResponse = await client.scrapeUrl(targetUrl, {<br>            zone: &#39;web_unlocker1&#39;,<br>            format: &#39;raw&#39; // Streams the target webpage as a raw HTML text string<br>        });<br><br><br>        console.log(&quot;\n=================== PIPELINE SUCCESS ===================&quot;);<br>        console.log(`🤖 [LaunchRadar]: Ingestion complete. Streamed: ${htmlResponse.length} bytes.`);<br>        console.log(&quot;========================================================\n&quot;);<br>       <br>        // This will print true—proving your paid credit bypassed the security loop<br>        const dataIsValid = htmlResponse.includes(&quot;Product Hunt&quot;);<br>        console.log(`🤖 [LaunchRadar]: Target Data Authenticated: ${dataIsValid}`);<br><br><br>        // Gracefully disconnect active execution sockets<br>        await client.close();<br><br><br>    } catch (error) {<br>        console.error(&quot;❌ [LaunchRadar Fatal]: Pipeline exception encountered.&quot;);<br>        console.error(`Reason: ${error.message}`);<br>    }<br>}<br><br><br>deployLaunchRadar();</pre><p>If you run that code inside your terminal window, you will see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*ob-VWM_Yj9029eJd_-JU4w.png" /><figcaption>LaunchRadar terminal output image</figcaption></figure><p><em>Congratulations! You extracted nearly a ~megabyte of raw HTML data. Now you understand how we can collect raw HTML data, it&#39;s time to build our final agent application: </em><strong><em>Vanguard Agent. </em></strong><em>It interfaces directly with Bright Data’s official JavaScript SDK, targets the verified backend data pipeline endpoint natively, and bypasses the front-end rendering layer completely to return beautifully structured insights straight to your terminal window.</em></p><h3>VI — Building Our Final Vanguard Agent Application</h3><p>Now that Web Unlocker is handling browser fingerprinting, JavaScript challenges, TLS negotiation, and request routing behind the scenes, we can focus on the part that actually creates value: extracting useful information.</p><p>Now let&#39;s build <strong>Vanguard Agent. </strong>It will work as a lightweight agent that searches live CNN articles, extracts relevant headlines, and automatically generates a structured Markdown report.</p><p>Instead of supporting multiple unrelated websites with different search endpoints and DOM structures, we’ll focus on a single production-quality example. The same architecture can later be extended to other targets by swapping the parser while keeping the networking layer exactly the same.</p><p>First, install Cheerio:</p><pre>npm install cheerio</pre><p>Then, trigger the Bright data SDK request with the following:</p><pre>const htmlResponse = await client.scrapeUrl(targetUrl, {<br>zone: &quot;web_unlocker1&quot;,<br>format: &quot;raw&quot;,<br>country: &quot;us&quot;,<br>dataFormat: &quot;html&quot;<br>});</pre><p><em>dataFormat: “html”</em> is the correct SDK option for returning rendered HTML. Browser emulation is already handled internally by Web Unlocker, so no additional rendering flag is required.</p><p>Next I will point the application directly at CNN’s search endpoint. This produces reproducible search results while keeping the extraction logic straightforward.</p><p>After that, the HTML has been retrieved by Bright Data, Cheerio loads the document and extracts article links.</p><p>Once the extraction finishes, Vanguard writes the collected results into a Markdown report that can be consumed by downstream AI agents, summarization pipelines, or analytics workflows. I will explain more clearly inside the code blocks one by one.</p><p>Here is the full source code of our agent that is copy-pastable for testing on your local machine:</p><pre><br>/**<br>* Project: Vanguard Agent<br>* Function: Autonomous CNN Trend &amp; Headline Generator<br>* Core Stack: Node.js (ESM) + Official Bright Data JavaScript SDK + Cheerio<br>*<br>* IMPORTANT: CNN&#39;s own robots.txt disallows /search (Disallow: /search),<br>* so Bright Data&#39;s Web Unlocker refuses it in immediate-access mode —<br>* that&#39;s not a bug, it&#39;s the site opting out of that specific path for<br>* compliant bots. Instead, this hits CNN&#39;s own News Sitemap<br>* (https://www.cnn.com/sitemap/news.xml), which robots.txt explicitly<br>* lists as a Sitemap: entry — meaning it&#39;s meant to be fetched by bots.<br>* It contains real headline titles and real publish timestamps for the<br>* last ~48 hours of coverage across every section, which is arguably a<br>* better fit for &quot;trend monitoring&quot; than a search page anyway.<br>*/<br><br>import fs from &#39;fs&#39;;<br>import readline from &#39;readline&#39;;<br>import * as cheerio from &#39;cheerio&#39;;<br>import { bdclient } from &#39;@brightdata/sdk&#39;;<br><br>const REPORT_FILE = &#39;vanguard_trend_report.md&#39;;<br>const CNN_NEWS_SITEMAP = &#39;https://www.cnn.com/sitemap/news.xml&#39;;<br><br>// Key comes ONLY from the environment — no hardcoded fallback, ever.<br>// If a real key has been pasted into a file, a chat, or a log at any<br>// point, treat it as compromised and rotate it in your Bright Data<br>// dashboard immediately, even after removing it from the code.<br>const BRIGHTDATA_KEY = process.env.BRIGHTDATA_API_KEY || &#39;&#39;;<br><br>if (!BRIGHTDATA_KEY) {<br>    console.error(<br>        &quot;\n❌ [Vanguard Config Error] BRIGHTDATA_API_KEY is not set.\n&quot; +<br>        &quot;   Run it like this instead:\n\n&quot; +<br>        &quot;   PowerShell:   $env:BRIGHTDATA_API_KEY=\&quot;your_actual_key\&quot;; node vanguard.mjs\n&quot; +<br>        &quot;   cmd.exe:      set BRIGHTDATA_API_KEY=your_actual_key &amp;&amp; node vanguard.mjs\n&quot; +<br>        &quot;   macOS/Linux:  BRIGHTDATA_API_KEY=your_actual_key node vanguard.mjs\n&quot;<br>    );<br>    process.exit(1);<br>}<br><br>// CNN article URLs follow /YYYY/MM/DD/category/slug — used here purely to<br>// derive a topic category for the breakdown, not for date (the sitemap<br>// gives us a real publish timestamp directly).<br>const CNN_ARTICLE_PATTERN = /^\/(\d{4})\/(\d{2})\/(\d{2})\/([a-z0-9-]+)\//i;<br><br>const printDashboardHeader = () =&gt; {<br>    console.clear();<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; ┌────────────────────────────────────────────────────────┐&quot;);<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; │   VANGUARD INTELLIGENCE SERVICE // CNN TREND ENGINE     │&quot;);<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; └────────────────────────────────────────────────────────┘&quot;);<br>};<br><br>const promptUser = (queryMessage) =&gt; {<br>    const interfaceInstance = readline.createInterface({<br>        input: process.stdin,<br>        output: process.stdout<br>    });<br>    return new Promise((resolve) =&gt; {<br>        interfaceInstance.question(queryMessage, (inputAnswer) =&gt; {<br>            interfaceInstance.close();<br>            resolve(inputAnswer.trim());<br>        });<br>    });<br>};<br><br>function escapeRegExp(string) {<br>    return string.replace(/[.*+?^${}()|[\]\\]/g, &#39;\\$&amp;&#39;);<br>}<br><br>function categoryFromUrl(loc) {<br>    try {<br>        const path = new URL(loc).pathname;<br>        const dated = path.match(CNN_ARTICLE_PATTERN);<br>        if (dated) return dated[4].replace(/-/g, &#39; &#39;);<br><br>        // Some CNN URLs skip the date prefix entirely (e.g. video pages<br>        // like /politics/video/slug). Fall back to the first path segment<br>        // instead of dumping everything into &quot;uncategorized&quot;.<br>        const segment = path.split(&#39;/&#39;).filter(Boolean)[0];<br>        return segment ? segment.replace(/-/g, &#39; &#39;) : &#39;uncategorized&#39;;<br>    } catch {<br>        return &#39;uncategorized&#39;;<br>    }<br>}<br><br>async function deployVanguardService() {<br>    printDashboardHeader();<br><br>    console.log(&quot;\x1b[38;5;244m%s\x1b[0m&quot;, &quot;\n [CONFIGURE INTELLIGENCE FILTER]&quot;);<br>    const searchQuery = await promptUser(&#39;🔍 Enter a keyword to filter recent CNN headlines (e.g., startup, election, climate): &#39;);<br><br>    if (!searchQuery) {<br>        console.error(&quot;\n❌ [Vanguard Error] Input token context empty. Pipeline aborted.&quot;);<br>        return;<br>    }<br><br>    printDashboardHeader();<br>    console.log(`\n\x1b[38;5;214m🤖 [Vanguard]: Connecting to proxy fabric for target: ${CNN_NEWS_SITEMAP}\x1b[0m`);<br>    console.log(&quot;🤖 [Vanguard]: Initializing automated browser emulation...&quot;);<br><br>    const client = new bdclient({ apiKey: BRIGHTDATA_KEY });<br><br>    try {<br>        // dataFormat: &#39;html&#39; returns the raw response body as-is, which<br>        // works fine for XML too — we just parse it with cheerio&#39;s XML<br>        // mode below instead of treating it as an HTML page.<br>        const xmlResponse = await client.scrapeUrl(CNN_NEWS_SITEMAP, {<br>            zone: &#39;web_unlocker1&#39;,<br>            dataFormat: &#39;html&#39;,<br>            country: &#39;us&#39;<br>        });<br><br>        console.log(`\x1b[38;5;46m🤖 [Vanguard]: Data stream ingestion complete. Length: ${xmlResponse.length} bytes.\x1b[0m`);<br><br>        if (!xmlResponse || xmlResponse.length &lt; 500) {<br>            const preview = xmlResponse ? xmlResponse.slice(0, 300) : &#39;(empty response)&#39;;<br>            throw new Error(<br>                `Target returned only ${xmlResponse ? xmlResponse.length : 0} bytes — this is too small to be ` +<br>                `a real sitemap. Raw response below:\n\n${preview}\n\n` +<br>                `Checklist:\n` +<br>                `  1. Confirm BRIGHTDATA_API_KEY is a valid, active key.\n` +<br>                `  2. Confirm &#39;web_unlocker1&#39; matches an active Web Unlocker zone name in your ` +<br>                `Bright Data dashboard — zone names are account-specific.\n` +<br>                `  3. If the text above mentions a block/captcha, retry in a moment or try a ` +<br>                `different &#39;country&#39; value.`<br>            );<br>        }<br><br>        console.log(&quot;🤖 [Vanguard]: Processing resilient extraction analytics...&quot;);<br><br>        // xmlMode: true keeps namespaced tags (e.g. news:title) intact<br>        // instead of cheerio&#39;s default HTML-parsing/lowercasing behavior.<br>        const $ = cheerio.load(xmlResponse, { xmlMode: true });<br>        const insights = [];<br><br>        $(&#39;url&#39;).each((_, el) =&gt; {<br>            const loc = $(el).find(&#39;loc&#39;).first().text().trim();<br>            const title = $(el).find(&#39;news\\:title&#39;).first().text().trim();<br>            const pubDateRaw = $(el).find(&#39;news\\:publication_date&#39;).first().text().trim()<br>                || $(el).find(&#39;lastmod&#39;).first().text().trim();<br><br>            if (!loc || !title) return; // skip entries without a real headline (e.g. galleries/video-only)<br><br>            insights.push({<br>                title: title.replace(/\s+/g, &#39; &#39;),<br>                date: pubDateRaw ? pubDateRaw.slice(0, 10) : &#39;unknown&#39;,<br>                category: categoryFromUrl(loc),<br>                postUrl: loc<br>            });<br>        });<br><br>        const uniqueRawInsights = Array.from(new Map(insights.map(item =&gt; [item.postUrl, item])).values());<br><br>        // Sort newest first using the sitemap&#39;s own publish timestamp.<br>        uniqueRawInsights.sort((a, b) =&gt; (a.date &lt; b.date ? 1 : a.date &gt; b.date ? -1 : 0));<br><br>        // Whole-word match, not substring — plain .includes() would match<br>        // &quot;war&quot; inside &quot;Warner&quot; or &quot;warrant&quot;, which are false positives<br>        // for a search on &quot;war&quot;. \b enforces a real word boundary.<br>        const keywordPattern = new RegExp(`\\b${escapeRegExp(searchQuery)}\\b`, &#39;i&#39;);<br>        let filteredInsights = uniqueRawInsights.filter(item =&gt; keywordPattern.test(item.title));<br><br>        // Phase 2: fallback to the newest overall headlines if no direct match<br>        let isFallbackMode = false;<br>        if (filteredInsights.length === 0) {<br>            filteredInsights = uniqueRawInsights;<br>            isFallbackMode = true;<br>        }<br><br>        const uniqueInsights = filteredInsights.slice(0, 10);<br><br>        if (uniqueInsights.length === 0) {<br>            throw new Error(&#39;Zero real headline entries isolated inside the sitemap buffer.&#39;);<br>        }<br><br>        const categoryCounts = uniqueRawInsights.reduce((acc, item) =&gt; {<br>            acc[item.category] = (acc[item.category] || 0) + 1;<br>            return acc;<br>        }, {});<br>        const topCategories = Object.entries(categoryCounts)<br>            .sort((a, b) =&gt; b[1] - a[1])<br>            .slice(0, 5);<br><br>        console.log(&quot;\n\x1b[38;5;51m┌────────────────────────────────────────────────────────────────────────┐&quot;);<br>        console.log(`│ ► VANGUARD INTELLIGENCE STREAM // CNN // &#39;${searchQuery}&#39;`.padEnd(76, &#39; &#39;) + &#39;│&#39;);<br>        console.log(&quot;└────────────────────────────────────────────────────────────────────────┘\x1b[0m&quot;);<br><br>        if (isFallbackMode) {<br>            console.log(`\x1b[33m ⚠️ [Notice] No direct matches for &#39;${searchQuery}&#39;. Showing newest CNN headlines instead.\x1b[0m\n`);<br>        }<br><br>        uniqueInsights.forEach((item, index) =&gt; {<br>            console.log(` \x1b[38;5;46m[${String(index + 1).padStart(2, &#39;0&#39;)}]\x1b[0m \x1b[1m${item.title.substring(0, 75)}\x1b[0m`);<br>            console.log(`     ├─ Category : ${item.category}`);<br>            console.log(`     ├─ Date     : ${item.date}`);<br>            console.log(`     └─ Link     : \x1b[38;5;39m\x1b[4m${item.postUrl}\x1b[0m\n`);<br>        });<br>        console.log(&quot;\x1b[38;5;51m└────────────────────────────────────────────────────────────────────────┘\x1b[0m&quot;);<br><br>        console.log(&#39;\x1b[38;5;244m📊 Top categories in this result set:\x1b[0m&#39;);<br>        topCategories.forEach(([cat, count]) =&gt; console.log(`   • ${cat} (${count})`));<br><br>        const markdownReport = [<br>            `# Vanguard CNN Intelligence Digest`,<br>            `* **Search Keyword:** \`${searchQuery}\``,<br>            `* **Source:** CNN News Sitemap (robots.txt-approved)`,<br>            `* **Data Capture Status:** ${isFallbackMode ? &#39;Newest-headlines fallback&#39; : &#39;Direct keyword match&#39;}`,<br>            `* **Timestamp:** ${new Date().toISOString()}`,<br>            `\n## Top Categories`,<br>            ...topCategories.map(([cat, count]) =&gt; `* **${cat}** — ${count} article(s)`),<br>            `\n## Headlines`,<br>            ...uniqueInsights.map((p, idx) =&gt;<br>                `### ${idx + 1}. ${p.title}\n* **Date:** ${p.date}\n* **Category:** ${p.category}\n* **Link:** [${p.postUrl}](${p.postUrl})`<br>            )<br>        ].join(&#39;\n&#39;);<br><br>        fs.writeFileSync(REPORT_FILE, markdownReport, &#39;utf8&#39;);<br>        console.log(`\x1b[38;5;46m💾 [Vanguard] System Report written successfully -&gt; ${REPORT_FILE}\x1b[0m\n`);<br><br>    } catch (pipelineException) {<br>        console.error(&quot;\n❌ [Vanguard Fatal]: Operational routine aborted.&quot;);<br>        console.error(`Reason: ${pipelineException.message}`);<br>    } finally {<br>        await client.close();<br>    }<br>}<br><br>deployVanguardService();</pre><p>At this point, the application submits a keyword, retrieves the rendered page through Web Unlocker, extracts structured information, and generates a clean report automatically. The anti-bot layer is handled by the gateway, allowing your application to stay focused on parsing and processing data instead of maintaining browser fingerprints or bypass logic.</p><p>Here is our agent functionality; you can scale it as you wish:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs8tXrYsGmUY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds8tXrYsGmUY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs8tXrYsGmUY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href">https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href</a></iframe><h3>VII — <strong>Moving </strong>Past<strong> The Anti-Bot Maintenance</strong></h3><p>As websites continue strengthening their anti-bot systems, maintaining custom bypass logic becomes an increasingly expensive engineering task. Every browser update, fingerprinting change, or new challenge introduces additional maintenance that doesn’t contribute to your product.</p><p>Using a managed gateway such as Bright Data Web Unlocker shifts that responsibility away from your application. Instead of maintaining infrastructure that keeps requests alive, you can focus on collecting, processing, and analyzing the data your users actually care about.</p><p>Whenever you’re building AI agents, market intelligence platforms, monitoring systems, or large-scale data pipelines, separating anti-bot handling from your business logic results in <a href="https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic">software that is easier to maintain</a>, easier to scale, and more reliable over time.</p><h3>Frequently Asked Questions</h3><h4>Can Web Unlocker scrape JavaScript-heavy websites?</h4><p>Yes. Web Unlocker performs browser emulation behind the scenes, allowing it to retrieve rendered HTML from websites that rely heavily on JavaScript, anti-bot challenges, or advanced fingerprinting.</p><h4>Do I still need to rotate proxies manually?</h4><p>No. Proxy rotation, browser fingerprint management, retry logic, and challenge handling are managed by the Web Unlocker infrastructure, so your application can focus on extracting data instead of maintaining network logic.</p><h4>Can I use this architecture for AI agents?</h4><p>Absolutely. AI agents often require reliable access to fresh web data. By separating data collection from application logic, you can feed structured information into LLM workflows without continually rebuilding scraping infrastructure.</p><h4>Can I extend Vanguard to other websites?</h4><p>Yes. The networking layer remains the same. In most cases, you only need to replace the target URL and update the parsing logic for the new site’s HTML structure while continuing to use the same Web Unlocker workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*86rF-qdPxPgB5v7dr4aOwg.png" /></figure><p><em>If you’re serious about mastering clean code and taking your programming career to the next level, then my book is for you: </em><a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one"><em>Clean Code Zero to One</em></a><em>. I am offering a 50% discount using the code “earlybird” during checkout ;only for the first 50 copies! Plus, enjoy a 30-day money-back guarantee. no risk, all reward.</em></p><p><strong>Related DEV Article:</strong><br><a href="https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic">https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e5b141219be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Bypass Anti-Bot Walls for Production-Ready Apps]]></title>
            <link>https://blog.stackademic.com/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488?source=rss-f63fe8afc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bf799e34488</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shahan Chowdhury]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 07:00:13 GMT</pubDate>
            <atom:updated>2026-07-02T07:00:13.541Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADjJrp6Hzox-xVgspIZ0VQ.png" /><figcaption>Image by author</figcaption></figure><p>In this guide, you’ll learn:</p><ul><li>Why traditional scraping approaches fail against modern anti-bot systems, even when using rotating User-Agents or browser automation.</li><li>How enterprise websites actually detect and block automated traffic through fingerprinting, reputation scoring, behavioral analysis, and network signals.</li><li>How to architect a production-ready scraping pipeline using cloud browsers, proxies, and AI agents instead of crumbling scripts.</li><li>How to build a multi-target autonomous agent called <strong>Vanguard</strong> that can reliably collect data from modern websites at scale.</li></ul><p>If you’re anything like me, you’ve probably found that many web scraping tutorials stop being useful the moment you point them at a real production website.</p><p>The common advice is surprisingly predictable: use<em> fetch()</em>, automate a browser with <a href="https://autify.com/blog/playwright-vs-puppeteer">Playwright or Puppeteer</a>, rotate a User-Agent, maybe add a proxy, and you’re supposedly ready to scrape almost anything.</p><p>That approach might work against a small personal website. It usually falls apart against companies like Amazon, Product Hunt, G2, Walmart, or CNN.</p><p>Developers often assume anti-bot protection is just another HTTP check that can be bypassed by changing a few request headers. <strong>Modern detection systems work quite differently:</strong> they review <a href="https://nordlayer.com/learn/browser-security/browser-fingerprinting/">browser fingerprints</a>, <a href="https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/">TLS characteristics</a>, IP reputation, <a href="https://abnormal.ai/glossary/ip-reputation">behavioral patterns</a>, request timing, JavaScript execution, and dozens of other signals before deciding whether your traffic looks human.</p><p>Changing your User-Agent is only one tiny piece of that puzzle.</p><p>To understand why so many automation projects eventually fail, we first need to understand how modern <a href="https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/">Web Application Firewalls (WAFs)</a> actually inspect and classify traffic.</p><p><strong>Corporate website’s WAF ecosystem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*CkL5isup9Hj-B9843b3Xzg.png" /><figcaption>Corporate website’s WAF ecosystem</figcaption></figure><p>If you’ve built automation that kept getting blocked after a few days, you’re not alone. I’ve written far more broken scraping systems than successful ones, and every failure taught me something about how these defenses actually work.</p><p>The good news is that the problem usually isn’t your code. It’s the <a href="https://codewithshahan.gumroad.com/l/cleancode-zero-to-one">architecture</a> behind it.</p><p>Throughout this guide, we’ll look beyond individual requests and focus on designing systems that can survive production environments. Regardless of how you’re building a price-monitoring platform, collecting market intelligence, or <a href="https://get.brightdata.com/codewithshahan-scraping-browser">fueling AI agents with fresh web data</a>, the underlying principles remain the same.</p><p>By the end, you’ll understand the mechanics behind modern bot detection and build a fully operational multi-target agent called Vanguard. More importantly, you’ll understand <em>why</em> its architecture continues working long after traditional scraping scripts have failed.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs8tXrYsGmUY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds8tXrYsGmUY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs8tXrYsGmUY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href">https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href</a></iframe><p><strong>Prerequisite:</strong> All examples use plain JavaScript with Node.js so we can focus on the underlying architecture instead of framework-specific details</p><h3>I — The Illusion of the Clean Browser</h3><p>When an automation script fails, developers immediately look for a quick proxy patch. They focus on changing their actions to make progress toward the goal (which is low impact) instead of fundamentally changing how their connection behaves so that success naturally follows (which is high impact).</p><p>Typically, developers write a script, test it on their local machine, and watch it succeed. They look at a target link (e,g.<a href="https://www.amazon.com/s?k=ddr5+ram+128gb,"> https://www.amazon.com/s?k=ddr5+ram+128gb),</a> paste it into their personal browser, and see the clean results page layout load instantly without a single CAPTCHA block:</p><figure><img alt="normal agentic script for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/800/1*KWlou6_OorKdl-ZN4r9efQ.gif" /></figure><p>They assume the target is wide open. But they are trying to build a great pipeline on a rotting foundation.</p><p>Your personal browser loads that link because it brings a lifetime of clean human history. It presents a validated residential IP address, deep cookie pools, active browser session context, and a highly complex, hardware-accelerated <a href="https://fingerprint.com/blog/what-is-tls-fingerprinting-transport-layer-security/">TLS cryptographic fingerprint</a>. Your browser doesn’t have to “grind” or “prove” it’s human; its natural behavior inherently aligns with what the security system requires.</p><p>A vanilla automated script has none of this context. To show you exactly how fast a standard production system rejects unmanaged automation, let’s look at the naive code most engineers write when they are being lazy.</p><h3>II — The Anatomy of an Immediate Rejection</h3><p>If you want to understand how anti-bot engines work, you must look at how they treat raw, unmanaged server requests.</p><p>If this doesn’t make sense, let’s run through an example.</p><p>When you execute this, your connection is dropped. Amazon’s WAF doesn’t care that your string header says “Mozilla”. It looks at the <a href="https://github.com/CarterPerez-dev/Cybersecurity-Projects/blob/main/SYNOPSES/intermediate/JA3.JA4.TLS.Fingerprinting.Tool.md">TCP handshake</a> behavior, notices that your <a href="https://www.tenable.com/audits/items/CIS_MS_IIS_10_v1.2.1_Level_2.audit:402c63d34c7c6a259868d26c647860af">TLS cipher suite order</a> doesn’t match an actual Windows Chrome installation, maps your datacenter or unrotated local IP, and flags the machine instantly.</p><p>So… security systems read what your connection does. Your headers are irreverent. Take a look:</p><figure><img alt="amazon anti bot walls firewall" src="https://cdn-images-1.medium.com/max/1024/1*1OT-lDFIr9QKjBEBGKFGZA.png" /></figure><figure><img alt="how bot protection works on corporate sites" src="https://cdn-images-1.medium.com/max/1024/1*gBVrQTaGsYH0AwUxS3672Q.png" /><figcaption>Concept art by <a href="https://medium.com/u/f63fe8afc87">Shahan Chowdhury</a></figcaption></figure><p>Do you think the real human browser has to “grind” to bypass a CAPTCHA? Does their machine have to trick the target to load a product page? To you, it may seem like a <a href="https://dev.to/codewithshahan/your-first-backend-application-using-nodejs-45i">basic request </a>on the surface, but the truth is that the security gateway cannot see them as anything other than authentic. The human browser has to try incredibly hard to trigger an anti-bot wall. The bare automated script has to force its way through a firewall, and <a href="https://www.buzzstream.com/blog/publishers-block-ai-study/">it gets flagged every single second of it.</a></p><p>To some developers, a professional enterprise proxy mesh seems extreme and over-engineered. To me, it’s natural, and I don’t say that to contrast it with any other kind of architecture. I simply enjoy running production systems that do not break. When my peers tell me that I should just use a basic string rotation utility… I hold my tongue from telling them, “If your scripts are constantly breaking, why are you doing what you’re doing?”</p><p>This next sentence may sound simple, <em>but it is baffling how many people don’t get it.</em></p><p>If you want to scrape enterprise websites reliably, the request itself is only part of the equation. Modern Web Application Firewalls (WAFs) inspect your browser fingerprint, network behavior, TLS fingerprint, session history, <a href="https://www.ipqualityscore.com/ip-reputation-check">IP reputation</a>, and many other signals before deciding whether you’re a legitimate user or an automated bot.</p><p>To understand why most scraping scripts eventually fail, we first need to look at how modern WAFs make those decisions.</p><h3>III — The “Fake” 200 Response Trap</h3><p>Lets look at a real-world scenario where all corporate websites play with agentic AI developers by using <em>“soft block”</em> tricks. I will be using<a href="https://www.npmjs.com/package/axios"> </a><a href="http://node.js/">Node.js</a> <a href="https://www.npmjs.com/package/axios">axios</a> library locally to send asynchronous network requests to REST endpoints, in this case our target URL endpoint is Amazon’s DDR5 ram listing page (you can use any website you like for scraping data):</p><pre>// The Lazy Scraping Pattern (Guaranteed to fail at scale)<br><br>const axios = require(&#39;axios&#39;);<br>async function naiveScrape() {<br>const targetUrl = &#39;https://www.amazon.com/s?k=ddr5+ram+128gb&#39;;<br>try {<br>const response = await axios.get(targetUrl, {<br>headers: { &#39;User-Agent&#39;: &#39;Mozilla/5.0…&#39; }<br>});<br>console.log(&quot;Success! Status:&quot;, response.status, &quot;Data Length:&quot;,<br>response.data.length);<br>} catch (error) {<br>console.error(&quot;Blocked!&quot;);<br>}<br>}<br>naiveScrape();</pre><p>If you run this code inside your terminal right now, you might see an output that looks exactly like this:</p><figure><img alt="amazon soft block exposes with 200 respose status in terminal" src="https://cdn-images-1.medium.com/max/803/1*Y9Pr9zxoNGoIdoOEr5XP6Q.png" /></figure><p>When scraping a gigantic popular website, a 200 OK response status is often a false victory. Large e-commerce sites use a technique called a <strong>Soft Block</strong>.</p><p>You look at that output. You see nearly a megabyte of data. You see no errors. You see a pristine “200 Success” code. You assume your <a href="https://dev.to/codewithshahan/writing-clean-reusable-components-in-react-best-practices-2gka">code cleanly outsmarted the infrastructure</a>. You are wrong.</p><p>This is the cleverest trap in modern web architecture. High-tier platforms rarely throw a loud <a href="https://seocom.agency/en/blog/web-errors-404-403-503-502-401-meaning-and-solutions/">403 Forbidden or 503 Error code</a> to standard scripts anymore. If they give you an error code, you know instantly you’re blocked, and you immediately start changing your code.</p><p>Instead, they route your connection away from the raw data asset entirely. Let’s prove exactly what is inside that 650KB+ length data string. Add these logging lines directly into your try block inside the above codeblock:</p><pre>console.log(&quot;Does it contain Amazon&#39;s soft-block tag?&quot;, response.data.includes(&quot;a-no-js&quot;));<br>console.log(&quot;First 300 characters of the page code:\n&quot;, response.data.substring(0, 300));</pre><p>When you run it, you won’t see the actual marketplace data from amazon. You will see lines of obfuscated, tracking JavaScript loops meant to run in a real browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*4QLzOVjoNVSoetQPpjGytg.png" /></figure><p>See? Your terminal <em>exposed</em> the trap. The real clue is the content that was returned. Instead of the product page DOM you expected, Amazon responded with its <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-captcha-and-challenge.html">verification challenge wrapper</a>. In other words, AWS WAF intercepted your request and served a challenge page rather than the actual marketplace content because your script wasn’t operating as a real browser session. Because your script lacked a continuous browsing fingerprint, AWS WAF silently intercepted your connection and handed you a dead-end sandbox loop.</p><p>Your script spends precious compute power downloading and trying to parse almost a megabyte of empty authentication wrappers, completely blind to the fact that it didn’t capture a single item. Automated agents cannot run the tracking scripts required to clear that page, putting your pipeline at a complete dead end.</p><p>Even though a target website tricks your code with a fake success redirect or drops you completely with a <em>403</em> Forbidden block, you are losing the exact same thing: <strong>access to the data layer.:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3A0IQCmGDIWGnlK_83qmw.png" /></figure><p>I will now use CNN news website as target URL, instead of falling into Amazon’s tricky “soft block” trap, you will receive an instant block since CNN use <strong>Cloudflare</strong>;<strong> </strong>a<strong> </strong>service that will instantly reject your vanilla Axios request with a hard HTTP <strong><em>403 Forbidden</em></strong> error code and terminate your script. Have a look:</p><pre>const axios = require(&#39;axios&#39;);<br>async function naiveScrape() {<br>// Switching to a Cloudflare-protected target for a clean firewall error<br>const targetUrl = &#39;https://www.cnn.com/&#39;;<br>try {<br><br>console.log(&quot;Initiating naive data extraction request…&quot;);<br>const response = await axios.get(targetUrl, {<br>headers: {<br>&#39;User-Agent&#39;: &#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64)<br>AppleWebKit/537.36&#39;<br>}<br>});<br>console.log(&quot;Success! Data Length:&quot;, response.data.length);<br>} catch (error) {<br>console.error(&quot;\n❌ Request Crushed by Anti-Bot Wall.&quot;);<br>if (error.response) {<br>// This will capture and print the hard 403 error code<br>console.error(`Status Code: ${error.response.status}`);<br>console.error(`Status Text: ${error.response.statusText}`);<br>console.error(&quot;Reason: Cloudflare WAF rejected the vanilla Axios<br>handshake.&quot;);<br>} else {<br>console.error(&quot;Error Message:&quot;, error.message);<br>}<br>}<br>}<br><br>naiveScrape();</pre><p><strong>Here is the result inside the terminal:</strong></p><figure><img alt="agent get blocked by CCN’s cloudflare" src="https://cdn-images-1.medium.com/max/801/1*IqHJCXriGpCsAdsWRi0nMQ.png" /></figure><p>A 403 Forbidden error is universally recognized by developers as a <a href="https://brightdata.com/blog/leadership/web-unlocker-site-unblocking-capabilities"><strong>hard security rejection</strong>.</a> It removes all ambiguity. The errors will be the same for<a href="http://g2.com/"> g2.com</a> or any other protected sites, and your automated agents cannot run that script, so your code is completely stuck at a dead end.</p><h3>IV — Moving to an Automated Gateway</h3><p>I realized I couldn’t spend my life engineering custom solutions for every single browser fingerprint update, JS challenge modification, or proxy rotation algorithm. It’s an endless game of whack-a-mole. I needed a production-ready infrastructure that handled the network-level deception for me so I could focus purely on writing data logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zss3CQrkl6NqNHF0YWK0Dg.png" /></figure><p>That is why I migrated this workflow to <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data’s Web Unlocker</a>. It treats the entire bypass pipeline as a simple managed endpoint. It acts as an abstraction layer that intercepts your raw request, automatically executes the necessary TLS handshakes, decrypts hidden challenges, mimics human behavior, and pipes back the clean HTML data.</p><p>Here is exactly how to set this up and test it without turning your local computer into a messy testing ground.</p><h4>Step 1: Account Activation and Token Generation</h4><p>First, you need access to the proxy cluster infrastructure.</p><ol><li>Signup/login to the dashboard account on <a href="https://get.brightdata.com/bypass-antibot-walls">Bright Data Web Unlocker</a>.</li><li>From the main dashboard sidebar, navigate to <strong>Web Access</strong>:</li></ol><figure><img alt="Bright data web unlocoker setup for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/1024/1*c6fCPuncBiv2DTgBixjmYA.png" /></figure><p>3. Select <strong>Web Unlocker API </strong>and press continue. This is the specialized cluster that houses the machine-learning-driven browser emulation layer:</p><figure><img alt="Bright data web unlocoker api setup for bypassing anti bot walls" src="https://cdn-images-1.medium.com/max/1024/1*fWK0en34LvSVSdGnoeX8Pg.png" /></figure><p>4. Name your routing zone (default is: web_unlocker1), activate it, and generate an API Token by clicking into the “API key” box.</p><p>5. Allow Your Server IP: Before sending requests, there’s one important configuration step that’s easy to miss.</p><p>Open your Web Unlocker zone settings, go to the configuration tab, then security settings, and finally check <strong>Allowed IPs</strong>. Make sure to add your current IPs in the allowlist. Go to “Configuration, then “Security Settings”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*EloMNNQcteIKwxsAORC-Ww.png" /></figure><p>Here is “Add allowed IP” box. Paste your current IP from your machine or check “recent IPs allowlist”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*GhFQkkdCIEdcHq4Udt6wCA.png" /></figure><p>Without this step, your API key may be valid and your zone may be configured correctly, but your requests can still fail because <a href="https://brightdata.com/blog/proxy-101/proxy-error-codes">Bright Data rejects connections from unauthorized IP addresses</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*0ZXwMs_IFSEfQ4vQfC2sOg.png" /></figure><blockquote>Once your IP has been added and the changes have propagated, you’re ready to send your first request.</blockquote><h4>Step 2: Testing Inside the Native Playground</h4><p>Before you deploy a single line of application code to your servers, you can visually verify that the unlocking layer works by using their <a href="https://get.brightdata.com/browser-api">built-in Playground</a>. It allows you to run requests directly from the cloud console to check how targets respond.</p><ol><li>Paste your target address directly into the <strong>Target URL</strong> field. For example: <a href="https://www.amazon.com/s?k=ddr5+ram+128gb">https://www.amazon.com/s?k=ddr5+ram+128gb</a></li><li>Keep the configuration to <strong>API</strong> mode and device type to <strong>desktop.</strong></li><li>Hit the blue <strong>Run Request</strong> button:</li></ol><figure><img alt="Bright data web unlcoker built in playground for web access without getting blocked" src="https://cdn-images-1.medium.com/max/1024/1*Zej2mP90U6GuhmxBLpZ9yg.png" /></figure><p>The interface will display a green<em> </em><a href="https://dev.to/codewithshahan/your-first-backend-application-using-nodejs-45i"><em>RESPONSE 200</em></a> success state. If you look at the bottom visual block, you’ll see a rendering preview of the exact Amazon product directory list. You’ll also find the pure market tables and real product tags by managing to bypass the <em>security wall</em> without any problems.</p><p>It is a 3-in-1 tool that manages IP rotation, dynamic browser fingerprinting, and CAPTCHA solving automatically. <a href="https://get.brightdata.com/bypass-antibot-walls">The API bypasses the anti-bot wall</a> and returns the clean HTML source code to the software in a single response.</p><p><strong><em>Note on verification:</em> </strong>If you download that specific raw response file from the playground UI, your computer will automatically open it up inside a local web browser, rendering it visually. If you want to see the actual raw data your backend will process, simply open that downloaded file with a basic text editor like VS Code. You will find thousands of lines of pristine, uninhibited DOM structural code strings.</p><h3>V — Building LaunchRadar Agent</h3><p>If you are trying to feed live web data into an LLM using basic Axios configurations or unmanaged connection structures, you are forcing your AI agent to ride a bicycle with flat tires. Modern security layers look for advanced browser behaviors and TLS cipher sequences. If you try to manually concatenate your configuration parameters as raw text blocks, a single trailing comma will break strict backend string parsing, throwing a frustrating 400 Bad Request or an empty payload block.</p><p>Therefore, we need to install Bright Data’s official SDK in our project. With this, we completely eliminate Axios-style network proxy bugs and let Bright Data handle them.</p><p>Lets go trough the code blocks step by step to build our first AI agent using bright data. We are going to assemble a product hunt’s trend intelligence agent called LaunchRadar. Its target is specific: it bypasses the tracking walls of<a href="https://www.producthunt.com/"> Product Hunt</a>, ingests the real-time tech product feeds, and structures raw document strings into clean text data arrays ready to feed straight into an LLM context window.</p><h4>Setup LaunchRadar Project from Scratch</h4><p>To ensure your runtime application environment maps dependencies cleanly, we will completely drop out of folders controlled by cloud backup networks (like Microsoft OneDrive or iCloud) that lock active file permissions and disrupt local script loops.</p><p>Open your terminal window (Terminal app on macOS, or your preferred shell) and run these clean setup commands sequentially to construct an isolated project workspace from scratch:</p><pre># 1. Move directly to your local User Home root path to avoid file syncing errors<br>cd ~<br><br># 2. Provision a dedicated application folder<br>mkdir LaunchRadar<br><br># 3. Enter your newly initialized project workspace<br>cd LaunchRadar<br><br># 4. Initialize an isolated local package architecture<br>npm init -y <br><br># 5. Tell the Node.js runtime to process modern ES Module imports natively<br>npm pkg set type=&quot;module&quot;</pre><p>Now install the official bright data SDK locally using node.js:</p><pre>npm install @brightdata/sdk</pre><p>Now, create a fresh file named index.js inside your application directory workspace and paste this exact production script to scrap raw HTML data from Product Hunt:</p><pre>/**<br> * Project: LaunchRadar<br> * Core Stack: Node.js + Official Bright Data JavaScript SDK<br> */<br><br>import { bdclient } from &#39;@brightdata/sdk&#39;;<br>const BRIGHTDATA_KEY = process.env.BRIGHTDATA_API_KEY || &#39;&#39;;<br>async function deployLaunchRadar() {<br>    // Targeting Product Hunt&#39;s active daily launch asset path<br>    const targetUrl = &#39;https://www.producthunt.com/&#39;;<br>   <br>    console.log(&quot;🤖 [LaunchRadar]: Initializing autonomous target ingestion loop...&quot;);<br>try {<br>        // Initialize the client gateway via the native constructor<br>        const client = new bdclient({<br>            apiKey: BRIGHTDATA_KEY<br>        });<br>console.log(&quot;🤖 [LaunchRadar]: Tunneling through Web Unlocker cluster...&quot;);<br>       <br>        // Execute the single-step browser-emulated extraction natively<br>        const htmlResponse = await client.scrapeUrl(targetUrl, {<br>            zone: &#39;web_unlocker1&#39;,<br>            format: &#39;raw&#39; // Streams the target webpage as a raw HTML text string<br>        });<br>console.log(&quot;\n=================== PIPELINE SUCCESS ===================&quot;);<br>        console.log(`🤖 [LaunchRadar]: Ingestion complete. Streamed: ${htmlResponse.length} bytes.`);<br>        console.log(&quot;========================================================\n&quot;);<br>       <br>        // This will print true-proving your paid credit bypassed the security loop<br>        const dataIsValid = htmlResponse.includes(&quot;Product Hunt&quot;);<br>        console.log(`🤖 [LaunchRadar]: Target Data Authenticated: ${dataIsValid}`);<br>// Gracefully disconnect active execution sockets<br>        await client.close();<br>} catch (error) {<br>        console.error(&quot;❌ [LaunchRadar Fatal]: Pipeline exception encountered.&quot;);<br>        console.error(`Reason: ${error.message}`);<br>    }<br>}<br>deployLaunchRadar();</pre><p>If you run that code inside your terminal window, you will see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*ob-VWM_Yj9029eJd_-JU4w.png" /><figcaption>LaunchRadar terminal output image</figcaption></figure><p><em>Congratulations! You extracted nearly a ~megabyte of raw HTML data. Now you understand how we can collect raw HTML data, it’s time to build our final agent application: </em><strong><em>Vanguard Agent. </em></strong><em>It interfaces directly with Bright Data’s official JavaScript SDK, targets the verified backend data pipeline endpoint natively, and bypasses the front-end rendering layer completely to return beautifully structured insights straight to your terminal window.</em></p><h3>VI — Building Vanguard Agent</h3><p>Now that Web Unlocker is handling browser fingerprinting, JavaScript challenges, TLS negotiation, and request routing behind the scenes, we can focus on the part that actually creates value: extracting useful information.</p><p>Now let’s build <strong>Vanguard Agent. </strong>It will work as a lightweight agent that searches live CNN articles, extracts relevant headlines, and automatically generates a structured Markdown report.</p><p>Instead of supporting multiple unrelated websites with different search endpoints and DOM structures, we’ll focus on a single production-quality example. The same architecture can later be extended to other targets by swapping the parser while keeping the networking layer exactly the same.</p><p>First, install Cheerio:</p><pre>npm install cheerio</pre><p>Then, trigger the Bright data SDK request with the following:</p><pre>const htmlResponse = await client.scrapeUrl(targetUrl, {<br>zone: &quot;web_unlocker1&quot;,<br>format: &quot;raw&quot;,<br>country: &quot;us&quot;,<br>dataFormat: &quot;html&quot;<br>});</pre><p><em>dataFormat: “html”</em> is the correct SDK option for returning rendered HTML. Browser emulation is already handled internally by Web Unlocker, so no additional rendering flag is required.</p><p>Next I will point the application directly at CNN’s search endpoint. This produces reproducible search results while keeping the extraction logic straightforward.</p><p>After that, the HTML has been retrieved by Bright Data; Cheerio loads the document and extracts article links.</p><p>Once the extraction finishes, Vanguard writes the collected results into a Markdown report that can be consumed by downstream AI agents, summarization pipelines, or analytics workflows. I will explain more clearly inside the code blocks one by one.</p><p>Here is the full source code of our agent to test on your local machine:</p><pre>/**<br>* Project: Vanguard Agent<br>* Function: Autonomous CNN Trend &amp; Headline Generator<br>* Core Stack: Node.js (ESM) + Official Bright Data JavaScript SDK + Cheerio<br>*<br>* IMPORTANT: CNN&#39;s own robots.txt disallows /search (Disallow: /search),<br>* so Bright Data&#39;s Web Unlocker refuses it in immediate-access mode -<br>* that&#39;s not a bug, it&#39;s the site opting out of that specific path for<br>* compliant bots. Instead, this hits CNN&#39;s own News Sitemap<br>* (https://www.cnn.com/sitemap/news.xml), which robots.txt explicitly<br>* lists as a Sitemap: entry - meaning it&#39;s meant to be fetched by bots.<br>* It contains real headline titles and real publish timestamps for the<br>* last ~48 hours of coverage across every section, which is arguably a<br>* better fit for &quot;trend monitoring&quot; than a search page anyway.<br>*/<br><br>import fs from &#39;fs&#39;;<br>import readline from &#39;readline&#39;;<br>import * as cheerio from &#39;cheerio&#39;;<br>import { bdclient } from &#39;@brightdata/sdk&#39;;<br>const REPORT_FILE = &#39;vanguard_trend_report.md&#39;;<br>const CNN_NEWS_SITEMAP = &#39;https://www.cnn.com/sitemap/news.xml&#39;;<br><br>// Key comes ONLY from the environment - no hardcoded fallback, ever.<br>// If a real key has been pasted into a file, a chat, or a log at any<br>// point, treat it as compromised and rotate it in your Bright Data<br>// dashboard immediately, even after removing it from the code.<br><br>const BRIGHTDATA_KEY = process.env.BRIGHTDATA_API_KEY || &#39;&#39;;<br>if (!BRIGHTDATA_KEY) {<br>    console.error(<br>        &quot;\n❌ [Vanguard Config Error] BRIGHTDATA_API_KEY is not set.\n&quot; +<br>        &quot;   Run it like this instead:\n\n&quot; +<br>        &quot;   PowerShell:   $env:BRIGHTDATA_API_KEY=\&quot;your_actual_key\&quot;; node vanguard.mjs\n&quot; +<br>        &quot;   cmd.exe:      set BRIGHTDATA_API_KEY=your_actual_key &amp;&amp; node vanguard.mjs\n&quot; +<br>        &quot;   macOS/Linux:  BRIGHTDATA_API_KEY=your_actual_key node vanguard.mjs\n&quot;<br>    );<br>    process.exit(1);<br>}<br><br>// CNN article URLs follow /YYYY/MM/DD/category/slug - used here purely to<br>// derive a topic category for the breakdown, not for date (the sitemap<br>// gives us a real publish timestamp directly).<br>const CNN_ARTICLE_PATTERN = /^\/(\d{4})\/(\d{2})\/(\d{2})\/([a-z0-9-]+)\//i;<br>const printDashboardHeader = () =&gt; {<br>    console.clear();<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; ┌────────────────────────────────────────────────────────┐&quot;);<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; │   VANGUARD INTELLIGENCE SERVICE // CNN TREND ENGINE     │&quot;);<br>    console.log(&quot;\x1b[38;5;39m%s\x1b[0m&quot;, &quot; └────────────────────────────────────────────────────────┘&quot;);<br>};<br><br>const promptUser = (queryMessage) =&gt; {<br>    const interfaceInstance = readline.createInterface({<br>        input: process.stdin,<br>        output: process.stdout<br>    });<br>    return new Promise((resolve) =&gt; {<br>        interfaceInstance.question(queryMessage, (inputAnswer) =&gt; {<br>            interfaceInstance.close();<br>            resolve(inputAnswer.trim());<br>        });<br>    });<br>};<br><br>function escapeRegExp(string) {<br>    return string.replace(/[.*+?^${}()|[\]\\]/g, &#39;\\$&amp;&#39;);<br>}<br><br>function categoryFromUrl(loc) {<br>    try {<br>        const path = new URL(loc).pathname;<br>        const dated = path.match(CNN_ARTICLE_PATTERN);<br>        if (dated) return dated[4].replace(/-/g, &#39; &#39;);<br>        // Some CNN URLs skip the date prefix entirely (e.g. video pages<br>        // like /politics/video/slug). Fall back to the first path segment<br>        // instead of dumping everything into &quot;uncategorized&quot;.<br>        const segment = path.split(&#39;/&#39;).filter(Boolean)[0];<br>        return segment ? segment.replace(/-/g, &#39; &#39;) : &#39;uncategorized&#39;;<br>    } catch {<br>        return &#39;uncategorized&#39;;<br>    }<br>}<br><br>async function deployVanguardService() {<br>    printDashboardHeader();<br>    console.log(&quot;\x1b[38;5;244m%s\x1b[0m&quot;, &quot;\n [CONFIGURE INTELLIGENCE FILTER]&quot;);<br>    const searchQuery = await promptUser(&#39;🔍 Enter a keyword to filter recent CNN headlines (e.g., startup, election, climate): &#39;);<br>    if (!searchQuery) {<br>        console.error(&quot;\n❌ [Vanguard Error] Input token context empty. Pipeline aborted.&quot;);<br>        return;<br>    }<br>    printDashboardHeader();<br>    console.log(`\n\x1b[38;5;214m🤖 [Vanguard]: Connecting to proxy fabric for target: ${CNN_NEWS_SITEMAP}\x1b[0m`);<br>    console.log(&quot;🤖 [Vanguard]: Initializing automated browser emulation...&quot;);<br>    const client = new bdclient({ apiKey: BRIGHTDATA_KEY });<br>    try {<br>        // dataFormat: &#39;html&#39; returns the raw response body as-is, which<br>        // works fine for XML too - we just parse it with cheerio&#39;s XML<br>        // mode below instead of treating it as an HTML page.<br>        const xmlResponse = await client.scrapeUrl(CNN_NEWS_SITEMAP, {<br>            zone: &#39;web_unlocker1&#39;,<br>            dataFormat: &#39;html&#39;,<br>            country: &#39;us&#39;<br>        });<br>        console.log(`\x1b[38;5;46m🤖 [Vanguard]: Data stream ingestion complete. Length: ${xmlResponse.length} bytes.\x1b[0m`);        if (!xmlResponse || xmlResponse.length &lt; 500) {            const preview = xmlResponse ? xmlResponse.slice(0, 300) : &#39;(empty response)&#39;;            throw new Error(                `Target returned only ${xmlResponse ? xmlResponse.length : 0} bytes - this is too small to be ` +                `a real sitemap. Raw response below:\n\n${preview}\n\n` +                `Checklist:\n` +                `  1. Confirm BRIGHTDATA_API_KEY is a valid, active key.\n` +                `  2. Confirm &#39;web_unlocker1&#39; matches an active Web Unlocker zone name in your ` +                `Bright Data dashboard - zone names are account-specific.\n` +                `  3. If the text above mentions a block/captcha, retry in a moment or try a ` +                `different &#39;country&#39; value.`            );        }        console.log(&quot;🤖 [Vanguard]: Processing resilient extraction analytics...&quot;);        // xmlMode: true keeps namespaced tags (e.g. news:title) intact        // instead of cheerio&#39;s default HTML-parsing/lowercasing behavior.<br>        const $ = cheerio.load(xmlResponse, { xmlMode: true });<br>        const insights = [];<br>        $(&#39;url&#39;).each((_, el) =&gt; {<br>            const loc = $(el).find(&#39;loc&#39;).first().text().trim();<br>            const title = $(el).find(&#39;news\\:title&#39;).first().text().trim();<br>            const pubDateRaw = $(el).find(&#39;news\\:publication_date&#39;).first().text().trim()<br>                || $(el).find(&#39;lastmod&#39;).first().text().trim();<br>            if (!loc || !title) return; // skip entries without a real headline (e.g. galleries/video-only)<br>            insights.push({<br>                title: title.replace(/\s+/g, &#39; &#39;),<br>                date: pubDateRaw ? pubDateRaw.slice(0, 10) : &#39;unknown&#39;,<br>                category: categoryFromUrl(loc),<br>                postUrl: loc<br>            });<br>        });<br>        const uniqueRawInsights = Array.from(new Map(insights.map(item =&gt; [item.postUrl, item])).values());<br>        // Sort newest first using the sitemap&#39;s own publish timestamp.        uniqueRawInsights.sort((a, b) =&gt; (a.date &lt; b.date ? 1 : a.date &gt; b.date ? -1 : 0));        // Whole-word match, not substring - plain .includes() would match        // &quot;war&quot; inside &quot;Warner&quot; or &quot;warrant&quot;, which are false positives        // for a search on &quot;war&quot;. \b enforces a real word boundary.        const keywordPattern = new RegExp(`\\b${escapeRegExp(searchQuery)}\\b`, &#39;i&#39;);        let filteredInsights = uniqueRawInsights.filter(item =&gt; keywordPattern.test(item.title));        // Phase 2: fallback to the newest overall headlines if no direct match        let isFallbackMode = false;        if (filteredInsights.length === 0) {            filteredInsights = uniqueRawInsights;            isFallbackMode = true;        }        const uniqueInsights = filteredInsights.slice(0, 10);        if (uniqueInsights.length === 0) {            throw new Error(&#39;Zero real headline entries isolated inside the sitemap buffer.&#39;);        }        const categoryCounts = uniqueRawInsights.reduce((acc, item) =&gt; {            acc[item.category] = (acc[item.category] || 0) + 1;<br>            return acc;<br>        }, {});<br>        const topCategories = Object.entries(categoryCounts)<br>            .sort((a, b) =&gt; b[1] - a[1])<br>            .slice(0, 5);<br>        console.log(&quot;\n\x1b[38;5;51m┌────────────────────────────────────────────────────────────────────────┐&quot;);<br>        console.log(`│ ► VANGUARD INTELLIGENCE STREAM // CNN // &#39;${searchQuery}&#39;`.padEnd(76, &#39; &#39;) + &#39;│&#39;);<br>        console.log(&quot;└────────────────────────────────────────────────────────────────────────┘\x1b[0m&quot;);<br>        if (isFallbackMode) {<br>            console.log(`\x1b[33m ⚠️ [Notice] No direct matches for &#39;${searchQuery}&#39;. Showing newest CNN headlines instead.\x1b[0m\n`);<br>        }<br>        uniqueInsights.forEach((item, index) =&gt; {<br>            console.log(` \x1b[38;5;46m[${String(index + 1).padStart(2, &#39;0&#39;)}]\x1b[0m \x1b[1m${item.title.substring(0, 75)}\x1b[0m`);<br>            console.log(`     ├─ Category : ${item.category}`);<br>            console.log(`     ├─ Date     : ${item.date}`);<br>            console.log(`     └─ Link     : \x1b[38;5;39m\x1b[4m${item.postUrl}\x1b[0m\n`);<br>        });<br>        console.log(&quot;\x1b[38;5;51m└────────────────────────────────────────────────────────────────────────┘\x1b[0m&quot;);<br>        console.log(&#39;\x1b[38;5;244m📊 Top categories in this result set:\x1b[0m&#39;);<br>        topCategories.forEach(([cat, count]) =&gt; console.log(`   • ${cat} (${count})`));<br>        const markdownReport = [<br>            `# Vanguard CNN Intelligence Digest`,<br>            `* **Search Keyword:** \`${searchQuery}\``,<br>            `* **Source:** CNN News Sitemap (robots.txt-approved)`,<br>            `* **Data Capture Status:** ${isFallbackMode ? &#39;Newest-headlines fallback&#39; : &#39;Direct keyword match&#39;}`,<br>            `* **Timestamp:** ${new Date().toISOString()}`,<br>            `\n## Top Categories`,<br>            ...topCategories.map(([cat, count]) =&gt; `* **${cat}** - ${count} article(s)`),<br>            `\n## Headlines`,<br>            ...uniqueInsights.map((p, idx) =&gt;<br>                `### ${idx + 1}. ${p.title}\n* **Date:** ${p.date}\n* **Category:** ${p.category}\n* **Link:** [${p.postUrl}](${p.postUrl})`<br>            )<br>        ].join(&#39;\n&#39;);<br>        fs.writeFileSync(REPORT_FILE, markdownReport, &#39;utf8&#39;);<br>        console.log(`\x1b[38;5;46m💾 [Vanguard] System Report written successfully -&gt; ${REPORT_FILE}\x1b[0m\n`);<br>    } catch (pipelineException) {<br>        console.error(&quot;\n❌ [Vanguard Fatal]: Operational routine aborted.&quot;);<br>        console.error(`Reason: ${pipelineException.message}`);<br>    } finally {<br>        await client.close();<br>    }<br>}<br>deployVanguardService();</pre><p>At this point, the application submits a keyword, retrieves the rendered page through Web Unlocker, extracts structured information, and generates a clean report automatically. The anti-bot layer is handled by the gateway, allowing your application to stay focused on parsing and processing data instead of maintaining browser fingerprints or bypass logic.</p><p>Here is our agent functionality; you can scale it as you wish:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs8tXrYsGmUY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds8tXrYsGmUY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs8tXrYsGmUY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href">https://medium.com/media/25eefef3ef9671b3e200a66e7ad59244/href</a></iframe><h3>VII — Moving Past The Anti-Bot Maintenance</h3><p>As websites continue strengthening their anti-bot systems, maintaining custom bypass logic becomes an increasingly expensive engineering task. Every browser update, fingerprinting change, or new challenge introduces additional maintenance that doesn’t contribute to your product.</p><p>Using a managed gateway such as Bright Data Web Unlocker shifts that responsibility away from your application. Instead of maintaining infrastructure that keeps requests alive, you can focus on collecting, processing, and analyzing the data your users actually care about.</p><p>Whenever you’re building AI agents, market intelligence platforms, monitoring systems, or large-scale data pipelines, separating anti-bot handling from your business logic results in software that is easier to maintain, easier to scale, and more reliable over time.</p><h3>Frequently Asked Questions</h3><h4>Can Web Unlocker scrape JavaScript-heavy websites?</h4><p>Yes. Web Unlocker performs browser emulation behind the scenes, allowing it to retrieve rendered HTML from websites that rely heavily on JavaScript, anti-bot challenges, or advanced fingerprinting.</p><h4>Do I still need to rotate proxies manually?</h4><p>No. Proxy rotation, browser fingerprint management, retry logic, and challenge handling are managed by the Web Unlocker infrastructure, so your application can focus on extracting data instead of maintaining network logic.</p><h4>Can I use this architecture for AI agents?</h4><p>Absolutely. AI agents often require reliable access to fresh web data. By separating data collection from application logic, you can feed structured information into LLM workflows without continually rebuilding scraping infrastructure.</p><h4>Can I extend Vanguard to other websites?</h4><p>Yes. The networking layer remains the same. In most cases, you only need to replace the target URL and update the parsing logic for the new site’s HTML structure while continuing to use the same Web Unlocker workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bf799e34488" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/how-to-bypass-anti-bot-walls-for-production-ready-apps-9bf799e34488">How to Bypass Anti-Bot Walls for Production-Ready Apps</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>