# How escalation works

Frankensurf starts with the cheapest tool and climbs a six-rung ladder only when a site pushes back.

Every way to fetch a page is a rung. Low rungs are fast and free; high rungs get
through more. Each read starts low and climbs only as far as it has to.

| Rung | What it does | Tools |
| --- | --- | --- |
| **T0** Markdown | Asks the site for `text/markdown` | [HTTP](/docs/integrations/http/) |
| **T1** Light fetch | Plain HTTP or a reader, no browser | [HTTP](/docs/integrations/http/), [Scrapling](/docs/integrations/scrapling/), [Jina Reader](/docs/integrations/jina-reader/) |
| **T2** Browser | A real browser renders the page | [Chromium](/docs/integrations/local-chromium/), [Steel](/docs/integrations/steel/), [Crawl4AI](/docs/integrations/crawl4ai/), [Browserbase](/docs/integrations/browserbase/), [Hyperbrowser](/docs/integrations/hyperbrowser/), [Browserless](/docs/integrations/browserless/), [Kernel](/docs/integrations/kernel/), [Anchor](/docs/integrations/anchor/), [Cloudflare](/docs/integrations/cloudflare-browser-run/) |
| **T3** Stealth and signed | Looks like a person, or signs as a verified agent | [Camoufox](/docs/integrations/camoufox/), [Scrapling](/docs/integrations/scrapling/), [Patchright](/docs/integrations/patchright/), [nodriver](/docs/integrations/nodriver/), [signed requests](/docs/blocked/signed-requests/) |
| **T4** Unblocker | Paid services built for the hardest walls | [Firecrawl](/docs/integrations/firecrawl/), [ZenRows](/docs/integrations/zenrows/), [fastCRW](/docs/integrations/fastcrw/), [Scrapfly](/docs/integrations/scrapfly/), [Bright Data](/docs/integrations/bright-data/), [Zyte](/docs/integrations/zyte/), [Apify](/docs/integrations/apify/) |
| **T5** You | A person clears the wall | [Human handoff](/docs/blocked/handoff/) |

## What counts as a failure

A tool "succeeding" isn't enough. Frankensurf checks what came back and climbs
when it sees:

- an app shell or unrendered template (`VISUAL_REQUIRED`);
- a rendered page with almost no text (`EMPTY_PAGE`);
- a challenge or "Just a moment…" page (`CAPTCHA`, `BLOCKED`);
- a sign-in page where content should be (`AUTH_REQUIRED`).

Sites also fake walls for bots: a sign-in redirect, or a 404, that a real
browser never sees. So on a public read:

- a `NOT_FOUND` from a plain fetch, or after another wall, gets one more try;
- a sign-in wall stops the climb only after `auth_wall_confirmations` (default
  5) tools in a row hit one;
- after a suspected fake wall, the tools that look most different from the one
  that was fooled go next (`fake_wall_confirmers`: Jina Reader, Camoufox, then
  the paid unblockers).

A page that is plainly a site's bot page (a final URL such as `/help/bots.html`
or `/captcha`, or text like "thinks you are a bot") counts as `CAPTCHA`, and a
short page that only asks you to sign in, in English, Spanish, Portuguese,
French, German, Italian or Dutch, counts as `AUTH_REQUIRED`. An
"access denied" title counts as a wall in German, French, Spanish, Italian,
Dutch, the Nordic languages, Polish, Czech, Hungarian, Russian, Japanese and
Chinese as well as English. A browser's own error page (DNS or
connection failure) or a site's maintenance page fails as `PROVIDER_DOWN`, so
it is never kept as the page.

Browsers read content inside open shadow roots too, so pages built from web
components keep their text.

Signed-in reads (identities and profiles) keep the strict rule: a sign-in wall
there means the session needs renewing, and the climb stops.

### Second opinion

A plain HTTP page can pass every check and still lack its content: a site that
loads results with JavaScript serves only its header and footer as text. So when
an automatic read lands on plain HTTP with scripts and under 5,000 characters of
text (`second_opinion_text_chars`), Frankensurf also asks a browser and keeps
whichever page has clearly more content (at least 1.5 times as much, and 1,000
characters more). `receipt.second_opinion` shows both. If the render fails or
isn't better, the HTTP page stands; the only cost is time.

### Completeness

Then every automatic read gets a structural check (`completeness.py`).
It looks at the page's shape:

- **Search and category pages** (a query parameter, or a path such as `/search`)
  need at least 10 distinct same-site item links (product, listing or detail
  URLs; never assets or service and legal pages) or 4 prices. Results that
  don't look like product links still count when they look like results: 8 or
  more links under one path prefix (`/packages/<name>`, `/project/<name>`), at
  least a third of which mention the query. A menu shares a prefix too, but
  not the query. Links to the page's own subdomains count as its results
  (posts on `name.substack.com`, albums on `artist.bandcamp.com`), but never
  service subdomains (`help.`, `blog.`, `careers.` and the like) or other sites
  on a shared platform.
- **Item pages** need a price or 1,500 characters of text.
- **Other pages** need 1,500 characters, or 400 without scripts.

An incomplete page is re-read along `completeness_ladder`: Jina Reader,
Scrapling, Camoufox, then Firecrawl, Zyte, ZenRows and Scrapfly when paid tools
are allowed, then Patchright and Bright Data. Each step is an ordinary read
pinned to one tool, with the usual checks and receipt. Frankensurf stops at the
first complete page and keeps the most complete one it saw. A search page that
passes only narrowly (fewer than `completeness_borderline_items`, 20, item
links and few prices) also gets one read from the strongest allowed tool, a
paid one when allowed. `completeness_max_extra_reads` (default 5) and
`completeness_deadline_seconds` (default 150) bound the extra work; each extra
tool gets `completeness_step_timeout_seconds` (default 45) before it is cut off
and the best page so far stands (`receipt.completeness.cut_off`). Measured on
the held-out sets, only Zyte ever ran past 45 seconds, mostly to time out.
`receipt.completeness` lists every step.

Climbing also stops when two browsers read the same page as the first read
(item links within one, text within 20%): that is the page, not an unfinished
one, and `completeness.agreed` says so (`completeness_stop_on_agreement`, on by
default).

It also stops when a round of free tools reads pages but none of them is
complete: more tools of the same kind rarely help. On held-out set 7 every
complete escalation came in the first round, and the three or four steps after
an incomplete one took 20 to 45 seconds and kept the first page anyway.
`completeness.no_progress` names the free tools it skipped
(`completeness_stop_without_progress`, on by default). Paid tools the call
allows still run, and a round where every tool was walled keeps climbing.

Free tools on the ladder race in pairs (`completeness_parallel`, default 2,
up to 4). The first complete page wins and the other read is cancelled.
Starts are half a second apart, so a site sees at most two extra reads at
once. Paid tools always run one at a time, so racing never pays twice. On the
139-site held-out set this cut the free tier's p90 from 50 s to 37 s and its
median from 5.6 s to 4.5 s.

### Placeholders and menus

Two more shapes of a page that came back without its content are caught on
every kind of page, not only search results:

- **Placeholders.** Prices of `$0` with no real price, or template values that
  leaked into the text (`{{ price }}`, `NaN`, `undefined`), mean the page had
  not loaded. `completeness.placeholder` is set and the read escalates.
- **Menus only.** When more than 80% of the text is link text and there is no
  price, the read got the site's navigation, not the page.
  `completeness.link_text_share` says how much.

Some pages are complete but hide their prices behind a choice ("select guests
to see prices"). No stronger tool would show more, so these don't escalate;
`completeness.needs_interaction` quotes the page so your agent knows why there
is no price.

### Pages a stronger tool can't fix

Some wrong pages look right to every tool, so Frankensurf names them instead of
climbing:

- **Off-query results.** A site that ignores an unknown search parameter shows
  its default feed, which passes the structure check. When the query is known
  (from parameters such as `q`, `kw` or `keywords`, or from your `expect_terms`),
  a results page whose items and text never mention it comes back observed but
  marked `completeness.off_query`. `receipt.next_step` says the search URL is
  probably wrong. A page still loading its results escalates as before. Once
  you know the right URL, a [site module](/docs/read/site-modules/) template
  keeps it.
- **Pages a site module vouches for.** When a saved module's assertions pass,
  the page is complete even if it has few links, because the module knows its
  results live in JSON. A module's `invalid` markers turn the site's own error
  or empty-feed page into `NOT_FOUND`.
- **Site error pages.** A redirect to an `error` or `404` path, an error title
  such as "Page not found", or a short page saying the page doesn't exist fails
  as `NOT_FOUND`. A plain fetch's error page gets one confirming read from a
  different tool, since some sites serve fake 404s to bots; then the read
  stops.

### When the URL is wrong

A URL can simply be wrong: a guessed search path, a product that moved, a
typo, a search address the site no longer honours. When a public read ends
`NOT_FOUND`, or lands on search results that ignore the query (`off_query`),
Frankensurf searches the site itself for what the URL asked for: its query
(`?q=air+fryer` is "air fryer", in any of the usual parameter names), the words
of its last path segment (`/p/brass-desk-lamp-123` is "brass desk lamp"), or the
one query value that is plain words.
It reads the site's home page, finds its search (schema.org `SearchAction`, the
search form, or the search box itself), and reads the results. They stand only
when they are complete and mention those words:

- `receipt.rescued` says it happened: `from` (the URL you asked for), `query`,
  `via` and `search_url`; the quality grade carries a `rescued` flag and
  `receipt.next_step` says these are search results, not the page itself.
- When the search finds nothing that fits, the read stays `NOT_FOUND` and
  `receipt.rescue` says what was tried.
- `rescue_not_found: false` turns it off.

## One small action

Some pages are one action away from their content: a cookie banner over the
article, a "load more" button under the first results, or a price that
appears only after you pick an option. When a page says it needs a choice
(`completeness.needs_interaction`) or is only a consent notice, the first
escalation step is `interact`: the local browser with three safe actions.

- **dismiss_consent**: inside a cookie or consent banner, press reject or
  "necessary only". It never accepts; with no reject button it closes the
  banner.
- **reveal**: give a required dropdown that has no value its first real option.
- **load_more**: press "load more" or "show more" up to three times while the
  page keeps growing. Never "next page", which leaves the page.

Nothing is bought, booked, signed in to, submitted or typed: a guard refuses
any button whose words say buy, checkout, add to cart, subscribe, sign in,
pay, book or accept. `receipt.interactions` lists every press. Ask for the
actions on any browser read with `interactions` (for example
`["dismiss_consent", "load_more"]`).

## Walled deep links

A public read that ends at a wall (`BLOCKED`, `CAPTCHA`) gets one more try:
a stealth browser that opens the site's home page first and then follows to
the page, as a person arrives, instead of landing cold on a deep link.
`receipt.warm_up` says what happened (`warm_up_on_wall`, on by default). In
two runs on the 139-site set, at home and on a server, it recovered the same
walled sites (Bloomingdale's, OzBargain); it adds time to reads that stay
walled.

The local browser also keeps each site's cookies for a day
(`site_session_hours`), so a challenge it passed or a banner it rejected stays
that way on the next read. Only anonymous state: never a profile's or an
identity's.

## Racing a slow read (smart lightning)

A blocked or script-heavy site can take several tools in turn before one gets
through. Once an automatic read has run for 2 seconds without a page
(`hedge_after_seconds`, 0 turns it off), two more reads start beside it
(`hedge_racers`), pinned to the first free tools on the completeness ladder:
Jina Reader, which fetches from its own network, and Scrapling, a stealth
browser. The first complete page wins and the rest are cancelled. Most pages
are read well inside 2 seconds and never race, so a site sees extra requests
only for the reads that need them.

When nothing is complete, the more complete page stands, and when the main read
fails, the racers' best page does (`receipt.hedge.after_failure` names the
failure and `walled` the tools it met). Racers are free tools only. A racer
that wins becomes the site's route hint, so the next read starts there.
`receipt.hedge` records the race.

[Lightning mode](/docs/read/lightning/) starts the racers at once instead of
after 3 seconds.

## Skipping ahead

Four things reorder the ladder so repeat visits are fast:

| | What it does | Setting |
| --- | --- | --- |
| **Wall vendors** | A wall's response names the bot-defence service behind it (`receipt.wall_vendor`: Cloudflare, Akamai, DataDome, PerimeterX, Imperva, Kasada, AWS WAF, Vercel or Sucuri). Frankensurf counts which tools got past each vendor on this machine; once a tool has at least 3 tries and even odds, later reads that meet the same vendor on any site try it next, and a tool that has never got past it in 8 tries goes last (`receipt.routing.learned_for`). A fresh install starts from measured priors (`bundled_wall_priors.json`, worth up to 8 tries per tool), which count less with each of your own reads and not at all after 8 (`use_wall_priors`). Vendors, never site names. | `state_dir/wall-stats.json` |
| **Escalation** | After 4 failed tries in one read, free tools that fetch from their own network (Jina Reader) move ahead: a wall that blocks by address stops every tool on this machine alike, and some pages none of them render. When paid tools are allowed, they move ahead after the first wall (`paid_after_walls`; after two when a free tool usually beats that wall vendor), cheapest likely success first, behind [your real browser](/docs/blocked/real-browser/) when it is allowed; without paid tools, the real browser moves ahead after 4 walls. | `escalate_after_walls`, `paid_after_walls` |
| **Site hints** | When a read succeeds only after earlier tools failed, the tool that got through goes first on that site for 24 hours. | `origin_route_hint_ttl_seconds` |
| **Route memory** | After 3 clean reads in a row on the same path pattern, that tool goes first for that path. | `route_memory_min_samples` |

Measured on g2.com: 63.5 s before hints, 8.5 s on the first read with
escalation, 2.4 s with the hint.

A few sites need a particular tool from the first visit. Those live as data in
`bundled_route_seeds.json`, never as site code, and your own settings always
win.

## Pacing

Frankensurf is polite by default.

- Reads to one site are at least 2 seconds apart, across processes
  (`origin_min_interval_seconds`).
- A `BLOCKED`, `CAPTCHA` or `RATE_LIMITED` answer pauses direct reads of that
  site for 15 minutes (`origin_cooldown_seconds`).
- Paid unblockers, handoff and [your real browser](/docs/blocked/real-browser/)
  aren't held by the pause: a different service, a person or a real browser is
  handling the wall.

## Choosing yourself

| You want | Set |
| --- | --- |
| One specific tool, no fallback | `provider="zenrows"` |
| An exact order | `provider_candidates=["http", "camoufox"]` |
| Paid tools allowed, within a budget | `allow_paid_fallbacks=True`, `max_cost_usd=0.05` |
| Nothing on your machine | `allow_local_browser=False` |

  `receipt.attempts` shows every tool tried and why each stopped, and
  `receipt.routing.provider_plan.ordered` shows the order that was planned.
