Scrape Info
Web ScrapingLong read

Anti-Bot Detection and Bypass Strategies for Agents

Web scrapers fail at detection layers one by one; this framework addresses them all.

Staff Writer · · 11 min read
Cover illustration for “Anti-Bot Detection and Bypass Strategies for Agents”
Web Scraping · July 28, 2026 · 11 min read · 2,449 words

Building an AI agent that actually works on the modern web is a layer cake of problems. Most developers discover this the hard way: they stand up a scraper, point it at a target, and watch it get blocked before it even loads the first page. The fix isn't one thing; it's a stack. And if any single layer is wrong, the whole thing falls apart.

Here's the framing that matters: per Cloudflare's own data, "user action" AI bots increased by over 15x throughout 2025. Detection systems evolved directly in response. At the same time, roughly 70% of generative AI models are trained primarily on scraped web data. Web access isn't optional infrastructure for AI agents; it's foundational. The core tension is that agents need to behave like humans to do useful work, and behaving like humans is exactly what detection systems are now trained to scrutinize.

This article isn't a cat-and-mouse overview; it's a layered technical framework, built from experience watching agents fail at every level, for building agents that navigate detection reliably.

How Modern Anti-Bot Systems Actually Evaluate a Request

The first thing to understand is that detection isn't a gate; it's a score.

Every request gets evaluated across multiple signals simultaneously. Each signal either improves or degrades a running trust score, a composite risk assessment that determines whether the session is allowed, challenged, or blocked. A single mismatch doesn't always kill the session outright, but it chips away at the score, and enough chips mean a block, a challenge, or a honeypot redirect.

Over 24 million active websites, at least 20% of all websites, run behind Cloudflare. That makes Cloudflare's detection stack the dominant system your agents will encounter. Here's how the layers fire, in order:

  • TLS fingerprinting (JA3/JA4). This happens before a single byte of page content loads. Python's requests, Go's net/http, and most standard HTTP clients produce TLS handshakes that look nothing like Chrome's. Cloudflare sees this immediately.
  • HTTP/2 SETTINGS frame inspection. The parameter ordering and values inside HTTP/2 handshakes differ between real browsers and HTTP libraries. Hard to fake with standard tooling.
  • Canvas and WebGL fingerprinting. Rendering output is used to create a device-class identifier, which is then cross-validated against the User-Agent and OS you claimed. Mismatches are a strong signal.
  • JavaScript challenges. These require actual browser execution. A headless browser that doesn't execute JS correctly fails here.
  • Behavioral analysis. Invisible event listeners monitor mouse movement curves, keystroke timing, scroll velocity, and how long the agent "reads" before acting. The irregularity of human behavior is itself the signal.
  • Turnstile. Combines all of the above into a pass/fail token. In non-interactive mode (the most common deployment), there's no visual puzzle; it's just background proof-of-work and accumulated behavioral signal.

Enterprise-tier deployments add per-customer anomaly detection on top of all this. A site can model what "normal" traffic looks like for its specific user base. Behavior that looks fine globally can still fail on a specific target.

Cloudflare also runs something called AI Labyrinth. Unlike static honeypots with fixed URLs, it dynamically generates plausible-looking content to trap scrapers that follow links indiscriminately. An agent wandering through it wastes cycles and burns its trust score without realizing it.

The key implication: piecemeal fixes don't work. "Just rotate IPs" fails because IP reputation is one signal out of dozens. A single layer mismatch can fail the whole session. You have to address all of them.

The TLS and HTTP Fingerprint Problem That Sinks Most Agents Before They Start

Most developers reach for requests first. It's the natural instinct; it's also the fastest path to getting blocked before any content is evaluated.

JA3 and JA4 fingerprints encode your cipher suite choices, TLS extensions, elliptic curve preferences, and ALPN extension ordering. A Python TLS handshake doesn't look like Chrome's handshake. It doesn't even look close. HTTP/2 adds another layer: SETTINGS frame parameter ordering and values differ between real browsers and raw HTTP clients. You can't spoof this by just changing headers.

The fix is to use a browser-grade TLS stack instead of a raw HTTP library.

  • curl_cffi: A Python library that presents a real Chrome TLS profile. It directly addresses the JA3/JA4 mismatch and should be your first swap.
  • curl-impersonate: A lower-level tool that impersonates specific browser TLS and HTTP/2 profiles, including ALPN negotiation and cipher suite ordering.

Partial matching still degrades the trust score. If you get the cipher suites right but miss extension ordering, you're still suspicious. This is also why undetected-chromedriver alone is not sufficient at the TLS layer. Get the whole profile right or don't bother.

Here's the thing about this layer: it costs basically nothing to fix compared to proxy spend. No new infrastructure, no ongoing fees, just a library swap. And yet it's the most frequently skipped step; establish it as a baseline requirement before you add anything else to the stack.

Browser Fingerprinting and Why Headless Chrome Needs Stealth Patches

Even with correct TLS, a headless browser leaks identity through the browser itself. The DOM is full of tells.

Detection looks for the navigator.webdriver flag, missing browser plugins, anomalous screen dimensions, mismatches between timezone, language, and font signals, and discrepancies in the AudioContext fingerprint. Canvas and WebGL fingerprinting checks rendering output against what the claimed User-Agent should produce on the claimed hardware. Headless Chrome, out of the box, fails most of these checks.

Here's the current tooling landscape as of early 2026, with no softening of the bad news:

  • puppeteer-stealth: Deprecated by its maintainers in February 2025. Does not bypass current Cloudflare versions. If your agent is still using this, it's failing silently.
  • FlareSolverr: Relies on undetected-chromedriver. Same limitations as puppeteer-stealth against current detection levels.
  • Nodriver: Maintained and working at current Cloudflare detection levels.
  • SeleniumBase UC Mode: Maintained, patches the most common fingerprint leaks.
  • Camoufox: Firefox-based stealth browser with active maintenance. Worth considering if Chrome-based detection gets particularly aggressive.

The resource cost reality is honest and non-negotiable: each Chrome instance requires approximately 500 MB of RAM. Browser-level evasion is inherently more expensive than HTTP-only approaches. You can't get around this.

Session isolation is also non-negotiable. Shared cookies or cache across sessions creates cross-contamination. Detection systems can identify it. One browser context per session, separate cookie stores, no exceptions.

How Proxy Choice Shapes the Trust Score Before Any Other Signal Fires

Before any behavioral analysis runs, before any fingerprint is checked, every IP address carries a risk score. It's derived from geolocation, ISP, and reputation history. You start every session with a score you didn't earn based on infrastructure choices you made earlier.

The proxy tier breakdown:

  • Datacenter IPs: Fast, cheap, and flagged by default. They're associated with automation because they almost always are automation. Success rates on heavily protected sites are often under 60%.
  • Residential IPs: Assigned by real ISPs to real home networks. Blocking them indiscriminately would catch too many legitimate users, so detection systems are more conservative. They score significantly better.
  • ISP proxies: The underused middle ground. These are datacenter-hosted servers with IPs assigned by real ISPs. You get datacenter speed with residential-level trust scores. Particularly useful for long sessions that need a stable IP, making them a natural fit for sticky session configurations.
  • Mobile proxies: Highest trust, highest cost. Mobile carrier IPs are less frequently flagged, which makes them valuable for the most protected targets.

Verified pricing ranges for 2025 to 2026:

  • Residential: approximately $1 to $8 per GB (Bright Data, Oxylabs, Decodo)
  • Datacenter: approximately $0.50 to $3 per GB, or a few dollars per IP per month
  • Mobile: approximately $2 to $15 per GB
  • ISP/static: approximately $1.50 to $5 per IP per month

The metric that actually matters is cost per successful request, not cost per GB, and this is the figure that should anchor your proxy procurement decisions. A datacenter proxy at $2/GB with a 30% success rate costs more per successful record than residential at $10/GB with an 85% success rate. Failed requests waste bandwidth and require retries. At 5TB of target data with a 40% success rate, actual bandwidth consumed is closer to 12.5TB. Your proxy cost math has to account for failure.

One more thing worth flagging: in January 2026, Google Cloud dismantled IPIDEA, the world's largest residential proxy network. This exposed that multiple proxy brands had been secretly reselling the same compromised device pools. Claimed pool size is no longer a reliable purchasing metric; vet your provider more carefully than the headline numbers suggest.

The strategic approach is mixing: datacenter for unprotected targets, residential or ISP for protected sites. The cost difference makes selective deployment necessary at any real scale.

Behavioral Signals and How Agents Can Pass as Human Users

Behavioral analysis doesn't run once at page load and then leave you alone; it runs continuously throughout the session via invisible event listeners. It's watching the whole time.

What detection monitors:

  • Mouse movement paths (curves, not straight lines)
  • Click timing relative to page load
  • Scroll velocity variation
  • Keystroke inter-arrival timing
  • How long the agent "reads" before acting

The core detection insight is that humans are irregular in ways that are genuinely hard to replicate algorithmically. Wrong keys, variable scroll speed, pauses before form fills. The weirdness is the signal.

Practical techniques that actually move the needle:

  • Randomize inter-request delays within plausible human ranges (500 to 3,000 ms works well) rather than fixed intervals.
  • Simulate mouse movement with Bézier curves instead of direct point-to-point jumps.
  • Introduce variable scroll events before clicking elements.
  • Keep Accept-Language, Accept, and Referer headers consistent within a session. Inconsistency flags session manipulation.
  • Persist cookies across pageviews on a sticky IP. Cookie absence, or cookies suddenly appearing mid-session, is anomalous.

Turnstile's non-interactive mode means that the accumulated behavioral score throughout the session determines whether a token is issued. There's no single moment of truth. You're being evaluated the whole time.

On the AI Labyrinth trap: agents that follow every link indiscriminately will wander into honeypot content. Apply semantic filtering on URLs. Don't follow links that break session context or lead outside the expected domain structure.

There's a detection blind spot worth noting. Defenders anticipating more legitimate AI agent traffic creates an environment where mimicking known AI agent patterns (declared User-Agent, structured request patterns) serves as its own form of camouflage. This is a moving target, but it's real.

When to Solve CAPTCHAs and When to Route Around Them

CAPTCHAs are the escalation path. Cloudflare deploys them when the trust score drops below a threshold. They're not the primary defense; if you're seeing CAPTCHAs frequently, something upstream is already failing.

The landscape by type:

  • reCAPTCHA v3: Invisible. It scores behavior throughout the session and never shows a challenge. Getting past v3 means having a good behavioral score, not solving a puzzle.
  • reCAPTCHA v2 and image CAPTCHAs: Third-party solving services are cost-effective at moderate volume. Pricing from services like 2Captcha and AntiCaptcha: approximately $0.50 per 1,000 for simple image CAPTCHAs, approximately $1 to $3 per 1,000 for reCAPTCHA v2 and v3.
  • Cloudflare Turnstile in non-interactive mode: Traditional image-based CAPTCHA services cannot solve this. There is no visual puzzle. The token comes from background signals only. Some automated browser-based solving services can generate valid tokens, but the real fix is upstream in your behavioral and fingerprint layers.

The decision framework is clean:

  • Image CAPTCHAs or reCAPTCHA v2 checkboxes? Use a solving service.
  • Turnstile or reCAPTCHA v3? Solving services don't apply. Fix the behavioral and proxy layers.
  • CAPTCHAs appearing at high frequency? That's a diagnostic signal, not just an obstacle. Something upstream is broken.

At high request volumes, CAPTCHA solving costs compound alongside proxy spend. Factor this into your build-versus-buy math before committing to a DIY architecture.

Putting the Layers Together as a Coherent Agent Architecture

Each layer addressed in isolation still fails if the others are misconfigured. Detection systems score everything simultaneously. You can't fix TLS and ignore behavior, or fix behavior and ignore proxies. It's all evaluated at once.

The minimum viable stack for a heavily protected target:

  • Request layer: curl_cffi or curl-impersonate for correct TLS and HTTP/2 fingerprinting.
  • Browser layer: Nodriver or SeleniumBase UC Mode, with strict session isolation. One browser context per session, separate cookie stores.
  • Proxy layer: Residential or ISP proxies for protected targets. Sticky sessions aligned to session lifetime. Health-checked pool with automatic rotation on failure.
  • Behavioral layer: Randomized delays, Bézier curve mouse paths, consistent session headers, cookie persistence throughout the session.
  • CAPTCHA layer: Third-party solver for image and v2 types. For Turnstile and v3, the fix is upstream.

A note on robots.txt compliance: a Duke University 2025 study found headless-browser agents comply with robots.txt directives, the de facto crawl access-control standard, around 10% of the time. If your agent is supposed to respect site policies, you have to build that logic in explicitly; it is not a default behavior in any of the tooling mentioned above.

The ongoing maintenance reality is where most teams underestimate the cost. Production scrapers require 4 to 8 hours per month minimum for simple targets, and 20 or more hours per month for heavily protected sites. Sites update their HTML structure. Anti-bot systems push updates. At a $75/hour developer rate, that's $300 to $1,500 per month before a single record is collected.

Session hygiene is one of the most common failure modes at scale. Shared state between sessions gets identified. Each session needs its own IP, cookie store, and browser context. Every time.

When Building and Maintaining This Stack In-House Stops Making Sense

The full DIY stack is not just code; it's a continuous operational burden. Proxy pool management, stealth patch updates, session logic, failure recovery, cost tracking. It never stabilizes. Detection systems keep evolving, and your stack has to keep pace.

For most teams collecting under 50TB monthly from protected sites, the total cost of ownership math favors managed solutions over DIY builds. Managed scraping APIs have matured significantly.

Pricing benchmarks from 2026:

  • Zyte API: $0.13 per 1,000 simple HTTP requests on pay-as-you-go pricing.

Managed APIs absorb the stealth patching, proxy pool maintenance, and session management. You pay per successful request instead of paying for failed bandwidth, developer hours, and infrastructure overhead separately.

The honest question to ask is this: is maintaining a scraping stack a core competency your team wants to develop, or is it infrastructure cost that's getting in the way of building the thing you actually care about? For teams where web access is foundational but scraping isn't the product, the answer is usually the latter. The DIY route is genuinely worth it when you need fine-grained control, have dedicated engineering capacity, or are operating at a scale where custom infrastructure pays for itself; at moderate volumes against protected targets, it usually doesn't.

The stack described in this article works. But working and being worth maintaining are two different things.

Sources

  1. scrapingant.com
  2. arxiv.org
  3. medium.com
  4. vouched.id
  5. zyte.com
  6. gptbots.ai
Filed underWeb Scraping

More in Web Scraping