Structured Output Extraction From Live Web Pages in Agents

Most live-web agent failures start with a bad fetch, not bad reasoning.

· 10 min read · Updated
Cover illustration for “Structured Output Extraction From Live Web Pages in Agents”
AI Agent Architecture · October 1, 2026 · 10 min read · 2,247 words

If an agent fails on a live website, it almost never fails because the model reasoned poorly. It fails because the page it was handed was never the page a human would see, and nothing in the pipeline caught the difference. Picture the sequence: an agent hits a site protected by a Cloudflare interstitial, the kind of "checking your browser" screen that appears for a second or two before a human visitor ever notices it. The agent reads it, finds no product data, and starts reasoning over a captcha as though it were a spec sheet.

That failure sits inside a loop every agent runs: observe, plan, act. Planning and acting can only be as good as what gets observed, and observation is exactly where live-web agents come apart. A 403 response, a Cloudflare challenge, and a JavaScript-rendered single-page app that returns an empty shell of HTML all register the same way to a tool-calling orchestrator: as a completed fetch. Nothing distinguishes a blocked request from a successful one at that layer, so the model downstream inherits garbage and treats it as ground truth. Scrapfly's 2026 agent guide catalogs the specific ways this goes wrong in production: anti-bot systems that return content-shaped blocks instead of errors, JavaScript-rendered DOM elements that simply never appear in a raw fetch, CSS selectors the model hallucinates and that drift the moment a site redesigns a page, and retry loops with no ceiling that burn through a token budget chasing a captcha that will never resolve on its own.

Session state breaks the same way, just more slowly. Geography compounds the problem in a way that produces no error at all: a datacenter IP based in one country requests a page that serves locally adjusted pricing, and the model has no way to know the number it just extracted belongs to the wrong market.

But even a clean, fully successful fetch does not solve the problem, because raw HTML carries its own failure mode. Grounding an agent in live data is a requirement for getting the right answer, not a nice-to-have for freshness. Daloopa's FinRetrieval benchmark results show accuracy fell from 90.8% with structured data APIs to 19.8% with web search alone, a 71 percentage point gap on the same underlying task.

The four distinct layers an agent needs to reach structured data

Everything in the failure modes above traces back to a single design mistake: treating "get data from a live web page" as one operation instead of four. Fetching, observation, session management, and tool integration are each distinct engineering problems with distinct failure modes, and collapsing them into a single undifferentiated step is the root cause of brittle agent pipelines.

Fetching means getting the raw page back from a web that is actively built to resist automated reads. Most modern sites render a meaningful share of their content with JavaScript, so if you pull only the initial HTML response, you miss most of what a human visitor actually sees on screen. The practical rule that falls out of this is a split by task type: a plain HTTP fetch, with JavaScript rendering turned on only when needed, handles read-only tasks well. A full cloud browser, the heavier and slower option, only earns its cost when the agent has to act on the page, clicking, filling a form, submitting something, rather than simply observing it.

Observation is the separate problem of turning a rendered page into something a model can actually reason over, and three methods are currently in production use. Tinyfish's 2026 web agent guide points to a fourth method still emerging rather than established: the WebMCP protocol, which lets a site expose structured tool schemas directly to an agent, bypassing visual perception. Where a site supports it, WebMCP cuts out the entire rendering-and-parsing stack in one step, which is a meaningful enough shift in how observation could work that it is worth watching closely as adoption grows.

Sessions are the third layer, and they matter because authentication state, cookies, and proxy identity all have to survive across every tool call in a multi-step task. If that continuity breaks mid-task, the model has no way to see it happen, and the agent starts producing confidently wrong output a few steps later, with nothing in its own reasoning trace flagging what changed underneath it.

Tool integration is the fourth layer, and it is where all three of the above get wired into whatever orchestration framework the agent runs on. You can ask the same agent to do open-ended research, shopping comparison, question answering, or ingest pages for a retrieval-augmented generation pipeline, and the same underlying fetch problem appears in each case; only the surface the agent calls into changes from one shape to the next. Vellum's 2026 search API guide frames search itself as the front door to this stack: search finds fresh, relevant sources, but everything after that point, actually getting usable content out of those sources, belongs to a separate part of the system. If you fold search and extraction into one step, the agent has to make an extra round trip for every single URL a search call returns.

Search and extraction are separate problems and must be treated as separate API calls

The clearest architectural decision available to anyone building a live-web agent is to stop treating search and extraction as the same call. Search finds pages; extraction gets their content. Merging the two into a single step is what produces the fragile, expensive pipelines described in the sections above, and separating them at the API layer may be the single highest-leverage change a team can make.

Start with what a search API actually hands back. A traditional search results wrapper returns URLs, titles, and short snippets: pointers toward content. Evaluating a search API for agent use means checking for a specific set of capabilities: whether it accepts semantic, objective-based queries instead of boolean keyword strings; how it handles freshness; whether it supports domain inclusion and exclusion filters; how well it extracts from JavaScript-heavy or CAPTCHA-protected pages; and whether it responds synchronously in under five seconds, since anything slower breaks a real-time agent workflow.

Extraction solves a different problem. Given a single URL, an extraction API returns clean content, whether that is markdown, structured JSON, or fields matched to a defined schema, without the caller having to stand up a browser, write an HTML parser, or manage a pool of proxies. Olostep's 2026 extraction platform guide walks through what a managed platform actually does behind a single request: it renders the page by executing its JavaScript, routes around anti-bot defenses using rotating proxies and residential IPs, and converts the resulting HTML into whatever output format was requested, all before the response ever reaches the caller.

You.com's own API suite reflects this split directly; it does not treat it as an abstraction. The Web Search API covers the search layer, and it gives you real-time, cited results built for an LLM to consume. The Contents API covers extraction: you give it a URL and get back clean page content, without having to assemble rendering, proxy rotation, or parsing logic on your own. The Research API and Finance Research API build on top of both, and they run multi-step retrieval and synthesis across several sources rather than stopping at a single page. That pattern, iterating across multiple retrieval steps instead of answering off one search call, is what Vellum's research identifies as separating systems that perform well on complex multi-hop benchmarks from systems that fail them badly: standard LLMs relying on basic keyword search score below 10% on those same benchmarks, a gap wide enough to trace the difference to the architecture rather than the underlying model's raw capability.

Three extraction paradigms in production and their failure points

Separating search from extraction only tells a team where the seam is. Inside the extraction layer itself, three distinct paradigms are in production use today, and each one trades accuracy, flexibility, and cost differently enough that picking the wrong one for a given job is probably the second most common cause of a brittle pipeline, right behind conflating search and extraction.

Schema-based extraction has the caller define the fields it wants once, typically in a structured format like JSON Schema, the standard used by OpenAI's Structured Outputs API. The model then locates those fields by meaning rather than by position, wherever they happen to sit in a given page's HTML. Olostep's guide makes the case that this approach survives the kind of site redesign that would break a CSS selector overnight, because it targets what a field means rather than exactly where it sits in the markup, so a layout change does not necessarily break the extraction. The failure mode here is subtler than a broken selector: schema drift, where the underlying concept on the page shifts, a listed "price" quietly becomes a "subscription fee" or a "monthly rate", and the schema keeps matching a field with that label while extracting the wrong concept.

Prompt-based extraction asks the model to interpret a natural-language description of what to pull from the page, not to match a predefined schema. Controlled evaluations cited in the research found that if you run the identical prompt repeatedly, you get inconsistent output in a meaningful share of cases; so you need a separate consistency check on top of prompt-based extraction before you can use it for financial facts or anything compliance-sensitive.

Record-and-replay extraction, the approach behind systems like BardeenAgent and the WebLists line of research, works differently again: the agent records one successful extraction on the first item in a list, turns that recorded sequence of actions into a reusable program built around generalizable CSS selectors, then replays that same program across every remaining item and page. The practical ceiling on record-and-replay appears on high-churn sites, where a layout can change between the moment the agent records its program and the moment it replays it, sometimes within days.

A cost asymmetry decides which of the three choices a team can actually afford to run. AI-driven scrapers cost meaningfully more per page than traditional scraping methods and run slower, since every page has to clear an LLM call rather than a parser running at native speed, which makes pure-LLM extraction uneconomical once a pipeline reaches the millions-of-pages scale that many enterprise use cases require. LLM extraction earns its keep on one-off cleanup jobs: a single messy page, a PDF, a screenshot. It is not the right default for unverified production data, for financial facts, or for personal data collection running at volume. The practical rule that falls out of this is straightforward: schema-based or managed extraction APIs for anything running at production volume, and prompt-based LLM extraction reserved for the low-volume, high-ambiguity cases where defining a schema up front simply is not practical.

How the LLM token asymmetry forces pipeline decomposition

A harder constraint than bandwidth or anti-bot defenses shapes every extraction choice: the mismatch between how much an LLM can read and how much it can write back out. That mismatch is what forces any serious pipeline to break a large extraction task into smaller repeated subtasks rather than attempting it in one pass.

Current LLMs can ingest input in the millions of tokens, but output is capped far lower, typically in the tens of thousands of tokens at most. So if you ask a general-purpose web agent to extract a full site's worth of structured records, it hits that output ceiling almost immediately, long before it runs out of anything to read. The only way around the ceiling is to break the extraction task into smaller pieces and run the same sub-task repeatedly across every item on a list or every page in a crawl. Most general-purpose web agents are not built to do that kind of decomposition on their own, so they tend to post low recall on any extraction task involving more than a handful of items.

That limitation explains a specific number from the record-and-replay research discussed above. BardeenAgent's recall of 66.2% roughly doubles the baseline it was measured against, a real improvement. But a third of the target items still go unextracted at that recall rate, and that gap is the direct fingerprint of the token asymmetry: decomposing the task into repeatable sub-tasks has reduced the output ceiling's damage, not eliminated it.

Two architectural patterns have emerged in response, and each makes a different tradeoff. A search-first architecture has the agent query a search API, take the ranked list of URLs and excerpts it gets back, then call an extraction API on each of those URLs in turn or in parallel. A tool-use architecture instead puts search and extraction inside an LLM's own reasoning loop as callable tools, so the model can decide for itself when to search again, when to extract, and when it has gathered enough to answer. That buys more flexibility, at the cost of latency that varies more from one run to the next.

Which pattern fits a given product depends heavily on how much execution envelope it can tolerate. Agentic grounding tasks can run anywhere from roughly three seconds to thirty, depending on how complex the task is, and that spread is now a real architectural variable rather than a detail to tune later. Whether a pipeline's latency budget was chosen on purpose, or inherited by default from whichever architecture happened to be easiest to wire up first, determines how well it will hold up under load.

Sources

  1. WebLists: Extracting Structured Information From Complex Interactive Websites Using Executable LLM Agents
  2. You.com

More in AI Agent Architecture