[{"data":1,"prerenderedAt":3835},["ShallowReactive",2],{"/blog/lightpanda-vs-browser-use-vs-stagehand-2026":3,"related-/blog/lightpanda-vs-browser-use-vs-stagehand-2026":1474},{"id":4,"title":5,"authorId":6,"body":7,"category":1437,"created":1438,"description":1439,"extension":1440,"faqs":1441,"featurePriority":1451,"head":1452,"landingPath":1452,"meta":1453,"navigation":258,"ogImage":1452,"path":1464,"robots":1452,"schemaOrg":1452,"seo":1465,"sitemap":1466,"stem":1467,"tags":1468,"__hash__":1473},"blog/blog/1041.lightpanda-vs-browser-use-vs-stagehand-2026.md","Lightpanda vs Browser-Use vs Stagehand (2026)","salome-koshadze",{"type":8,"value":9,"toc":1425},"minimark",[10,40,51,60,83,88,95,98,109,112,117,159,162,218,221,413,416,419,424,427,432,442,520,523,527,531,534,541,581,584,758,761,764,777,784,788,792,795,798,814,817,843,848,1170,1173,1177,1180,1185,1190,1257,1262,1384,1388,1399,1403,1414,1418,1421],[11,12,14,22,28,34],"tldr-box",{"title":13},"TL;DR",[15,16,17,21],"p",{},[18,19,20],"strong",{},"Pick Lightpanda"," when you need a lighter CDP target than Chrome and can tolerate a few SPAs that won't render.",[15,23,24,27],{},[18,25,26],{},"Pick Browser-Use"," when the task is open-ended and writing selectors is the bottleneck.",[15,29,30,33],{},[18,31,32],{},"Pick Stagehand"," when you want most of the script deterministic and only the messy parts driven by AI.",[15,35,36,39],{},[18,37,38],{},"Stack them"," when performance matters and you want AI on top.",[15,41,42,43,46,47,50],{},"Browser automation is shifting from ",[18,44,45],{},"selector-based scripting"," to ",[18,48,49],{},"intent-driven workflows powered by AI",". Instead of manually defining every click and selector, developers can now rely on agents to interpret goals and execute tasks.",[52,53],"nuxt-picture",{":height":54,":width":55,"alt":56,"loading":57,"src":58,"provider":59},"620","825","Three-way comparison of Lightpanda, Browser-Use, and Stagehand across abstraction, determinism, and performance","lazy","/blog/lightpanda-vs-browser-use-vs-stagehand-2026/three-way-comparison.svg","none",[15,61,62,63,70,71,76,77,82],{},"Three tools sit at different layers of this shift: ",[64,65,69],"a",{"href":66,"rel":67},"https://lightpanda.io/",[68],"nofollow","Lightpanda",", a high-performance browser engine; ",[64,72,75],{"href":73,"rel":74},"https://github.com/browser-use/browser-use",[68],"Browser-Use",", a Python-based AI agent; and ",[64,78,81],{"href":79,"rel":80},"https://www.stagehand.dev/",[68],"Stagehand",", a hybrid TypeScript framework. Each solves a different part of the problem, and they can be stacked.",[84,85,87],"h2",{"id":86},"lightpanda-the-high-performance-browser-engine","Lightpanda: The High-Performance Browser Engine",[52,89],{":height":90,":width":91,"alt":92,"loading":57,"src":93,"format":94},"600","1200","Lightpanda headless browser GitHub repository preview","/blog/lightpanda-vs-browser-use-vs-stagehand-2026/1.png","webp",[15,96,97],{},"Lightpanda is a headless browser engine built in Zig, designed as a fast and memory-efficient alternative to Chrome Headless. It is compatible with the Chrome DevTools Protocol (CDP), allowing it to act as a drop-in backend for tools like Puppeteer and Playwright.",[15,99,100,101,104,105,108],{},"Its main appeal is reduced resource usage. In benchmark scenarios, its documentation reports up to ",[18,102,103],{},"16x lower memory usage"," and ",[18,106,107],{},"9-16x faster performance"," on certain workloads compared to Chrome. These gains depend heavily on the type of page and workload.",[15,110,111],{},"Lightpanda runs as a standalone server, accessible via CDP.",[15,113,114],{},[18,115,116],{},"Quick Start with Docker:",[118,119,124],"pre",{"className":120,"code":121,"language":122,"meta":123,"style":123},"language-bash shiki shiki-themes catppuccin-latte night-owl","docker run -d --name lightpanda -p 127.0.0.1:9222:9222 lightpanda/browser:nightly\n","bash","",[125,126,127],"code",{"__ignoreMap":123},[128,129,132,136,140,144,147,150,153,156],"span",{"class":130,"line":131},"line",1,[128,133,135],{"class":134},"sNstc","docker",[128,137,139],{"class":138},"sfrMT"," run",[128,141,143],{"class":142},"sPg8w"," -d",[128,145,146],{"class":142}," --name",[128,148,149],{"class":138}," lightpanda",[128,151,152],{"class":142}," -p",[128,154,155],{"class":138}," 127.0.0.1:9222:9222",[128,157,158],{"class":138}," lightpanda/browser:nightly\n",[15,160,161],{},"Or run the binary directly:",[118,163,165],{"className":120,"code":164,"language":122,"meta":123,"style":123},"curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux && chmod a+x ./lightpanda\n./lightpanda serve --host 127.0.0.1 --port 9222\n",[125,166,167,196],{"__ignoreMap":123},[128,168,169,172,175,178,180,183,187,190,193],{"class":130,"line":131},[128,170,171],{"class":134},"curl",[128,173,174],{"class":142}," -L",[128,176,177],{"class":142}," -o",[128,179,149],{"class":138},[128,181,182],{"class":138}," https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux",[128,184,186],{"class":185},"scGhl"," &&",[128,188,189],{"class":134}," chmod",[128,191,192],{"class":138}," a+x",[128,194,195],{"class":138}," ./lightpanda\n",[128,197,199,202,205,208,212,215],{"class":130,"line":198},2,[128,200,201],{"class":134},"./lightpanda",[128,203,204],{"class":138}," serve",[128,206,207],{"class":142}," --host",[128,209,211],{"class":210},"sZ_Zo"," 127.0.0.1",[128,213,214],{"class":142}," --port",[128,216,217],{"class":210}," 9222\n",[15,219,220],{},"You can then connect using standard tools:",[118,222,226],{"className":223,"code":224,"language":225,"meta":123,"style":123},"language-javascript shiki shiki-themes catppuccin-latte night-owl","import puppeteer from 'puppeteer-core';\n\nconst browser = await puppeteer.connect({ browserWSEndpoint: \"ws://127.0.0.1:9222\" });\nconst page = await browser.newPage();\nawait page.goto('https://example.com');\nconsole.log(await page.title());\nawait browser.disconnect();\n","javascript",[125,227,228,254,260,320,344,370,397],{"__ignoreMap":123},[128,229,230,234,238,241,245,248,251],{"class":130,"line":131},[128,231,233],{"class":232},"srhcd","import",[128,235,237],{"class":236},"s2kId"," puppeteer ",[128,239,240],{"class":232},"from",[128,242,244],{"class":243},"sbuKk"," '",[128,246,247],{"class":138},"puppeteer-core",[128,249,250],{"class":243},"'",[128,252,253],{"class":185},";\n",[128,255,256],{"class":130,"line":198},[128,257,259],{"emptyLinePlaceholder":258},true,"\n",[128,261,263,267,271,275,278,282,286,289,292,296,300,303,306,309,312,315,318],{"class":130,"line":262},3,[128,264,266],{"class":265},"s76yb","const",[128,268,270],{"class":269},"scsc5"," browser",[128,272,274],{"class":273},"s-_ek"," =",[128,276,277],{"class":232}," await",[128,279,281],{"class":280},"sP4PM"," puppeteer",[128,283,285],{"class":284},"s5FwJ",".",[128,287,288],{"class":134},"connect",[128,290,291],{"class":236},"(",[128,293,295],{"class":294},"sgNGR","{",[128,297,299],{"class":298},"s3XBt"," browserWSEndpoint",[128,301,302],{"class":273},":",[128,304,305],{"class":243}," \"",[128,307,308],{"class":138},"ws://127.0.0.1:9222",[128,310,311],{"class":243},"\"",[128,313,314],{"class":294}," }",[128,316,317],{"class":236},")",[128,319,253],{"class":185},[128,321,323,325,328,330,332,334,336,339,342],{"class":130,"line":322},4,[128,324,266],{"class":265},[128,326,327],{"class":269}," page",[128,329,274],{"class":273},[128,331,277],{"class":232},[128,333,270],{"class":280},[128,335,285],{"class":284},[128,337,338],{"class":134},"newPage",[128,340,341],{"class":236},"()",[128,343,253],{"class":185},[128,345,347,350,352,354,357,359,361,364,366,368],{"class":130,"line":346},5,[128,348,349],{"class":232},"await",[128,351,327],{"class":280},[128,353,285],{"class":284},[128,355,356],{"class":134},"goto",[128,358,291],{"class":236},[128,360,250],{"class":243},[128,362,363],{"class":138},"https://example.com",[128,365,250],{"class":243},[128,367,317],{"class":236},[128,369,253],{"class":185},[128,371,373,376,378,381,383,385,387,389,392,395],{"class":130,"line":372},6,[128,374,375],{"class":280},"console",[128,377,285],{"class":284},[128,379,380],{"class":134},"log",[128,382,291],{"class":236},[128,384,349],{"class":232},[128,386,327],{"class":280},[128,388,285],{"class":284},[128,390,391],{"class":134},"title",[128,393,394],{"class":236},"())",[128,396,253],{"class":185},[128,398,400,402,404,406,409,411],{"class":130,"line":399},7,[128,401,349],{"class":232},[128,403,270],{"class":280},[128,405,285],{"class":284},[128,407,408],{"class":134},"disconnect",[128,410,341],{"class":236},[128,412,253],{"class":185},[15,414,415],{},"Lightpanda is the execution layer: a fast, lightweight CDP target that other automation tools drive.",[15,417,418],{},"Lightpanda is not a full Chrome replacement. Expect compatibility gaps on complex pages, edge cases in rendering and JavaScript APIs, and a less mature ecosystem.",[420,421,423],"h3",{"id":422},"our-benchmark-lightpanda-vs-chrome-on-15-real-sites","Our benchmark: Lightpanda vs Chrome on 15 real sites",[15,425,426],{},"We ran the same CDP task - navigate, extract title, count links, capture body text - across fifteen public targets on both Lightpanda (nightly) and Chrome 147 Headless. Memory is reported as resident set size across the entire process tree, so Chrome's renderer and GPU processes are counted fairly against Lightpanda's single process.",[428,429],"article-signup-cta",{"heading":430,"subtitle":431},"Run AI Browser Agents on Any Web App","Webfuse lets you embed AI-driven automation directly into any web application without browser extensions or backend rebuilds. Pair fast headless engines with intent-driven agents and ship reliable, production-grade workflows on top of websites you do not control.",[15,433,434,435,104,438,441],{},"Lightpanda fully rendered fourteen of the fifteen targets, including Vite and Nuxt's marketing sites, three e-commerce demo rigs (Sauce Demo, DemoBlaze, automationexercise.com), both TodoMVC implementations, and content sites like Wikipedia, MDN, Hacker News, and dev.to. One target - Stripe's documentation SPA - loaded with a valid HTTP 200 and an extracted title, but rendered effectively no body text. The browser log surfaced the cause: a hydration failure originating from ",[125,436,437],{},"indexedDB is not defined",[125,439,440],{},"Element.scrollTo is not a function",". Both are Web APIs Lightpanda's beta does not yet implement, and Stripe's bundle assumes them during the first paint.",[443,444,445,461],"table",{},[446,447,448],"thead",{},[449,450,451,455,458],"tr",{},[452,453,454],"th",{},"Metric",[452,456,69],{"align":457},"right",[452,459,460],{"align":457},"Chrome 147 Headless",[462,463,464,476,487,498,509],"tbody",{},[449,465,466,470,473],{},[467,468,469],"td",{},"Targets rendered cleanly",[467,471,472],{"align":457},"14 / 15",[467,474,475],{"align":457},"15 / 15",[449,477,478,481,484],{},[467,479,480],{},"Median navigation time",[467,482,483],{"align":457},"308 ms",[467,485,486],{"align":457},"461 ms",[449,488,489,492,495],{},[467,490,491],{},"p95 navigation time",[467,493,494],{"align":457},"1,638 ms",[467,496,497],{"align":457},"4,085 ms",[449,499,500,503,506],{},[467,501,502],{},"Cold-start RSS",[467,504,505],{"align":457},"17 MB",[467,507,508],{"align":457},"931 MB",[449,510,511,514,517],{},[467,512,513],{},"Peak RSS across the run",[467,515,516],{"align":457},"324 MB",[467,518,519],{"align":457},"1,365 MB",[15,521,522],{},"The vendor's \"16x less memory\" claim is workload-specific. On a heterogeneous mix of real pages we measured a roughly 4x peak-memory advantage and a much larger cold-start advantage. Cold start matters for high-concurrency scraping, where you pay Chrome's fixed per-instance overhead hundreds of times over. The compatibility tax is real but narrow: it shows up as silent rendering failures on SPAs whose hydration paths touch APIs Lightpanda has not implemented yet. When a workload includes one of those targets, fall back to Chrome for that specific job rather than working around the gap.",[84,524,526],{"id":525},"browser-use-high-level-python-ai-agent","Browser-Use: High-Level Python AI Agent",[52,528],{":height":90,":width":91,"alt":529,"loading":57,"src":530,"format":94},"Browser-Use Python AI agent GitHub repository preview","/blog/lightpanda-vs-browser-use-vs-stagehand-2026/2.png",[15,532,533],{},"Browser-Use is a Python library for automating browser tasks using natural language. Instead of writing selectors and interaction logic, you define a task and an AI agent determines the steps required.",[15,535,536,537,540],{},"Setup is handled with ",[125,538,539],{},"uv",", and Python 3.11+ is required:",[118,542,544],{"className":120,"code":543,"language":122,"meta":123,"style":123},"uv init && uv add browser-use && uv sync\nuvx browser-use install\n",[125,545,546,571],{"__ignoreMap":123},[128,547,548,550,553,555,558,561,564,566,568],{"class":130,"line":131},[128,549,539],{"class":134},[128,551,552],{"class":138}," init",[128,554,186],{"class":185},[128,556,557],{"class":134}," uv",[128,559,560],{"class":138}," add",[128,562,563],{"class":138}," browser-use",[128,565,186],{"class":185},[128,567,557],{"class":134},[128,569,570],{"class":138}," sync\n",[128,572,573,576,578],{"class":130,"line":198},[128,574,575],{"class":134},"uvx",[128,577,563],{"class":138},[128,579,580],{"class":138}," install\n",[15,582,583],{},"A typical run defines a browser, an agent, and a language model:",[118,585,589],{"className":586,"code":587,"language":588,"meta":123,"style":123},"language-python shiki shiki-themes catppuccin-latte night-owl","from browser_use import Agent, Browser, ChatBrowserUse\nimport asyncio\n\nasync def main():\n    browser = Browser()\n    agent = Agent(\n        task=\"Find the number of stars of the browser-use repo on GitHub\",\n        llm=ChatBrowserUse(),\n        browser=browser\n    )\n    await agent.run()\n\nasyncio.run(main())\n","python",[125,590,591,614,621,625,642,656,668,686,701,713,719,735,740],{"__ignoreMap":123},[128,592,593,595,598,600,603,606,609,611],{"class":130,"line":131},[128,594,240],{"class":232},[128,596,597],{"class":236}," browser_use ",[128,599,233],{"class":232},[128,601,602],{"class":236}," Agent",[128,604,605],{"class":185},",",[128,607,608],{"class":236}," Browser",[128,610,605],{"class":185},[128,612,613],{"class":236}," ChatBrowserUse\n",[128,615,616,618],{"class":130,"line":198},[128,617,233],{"class":232},[128,619,620],{"class":236}," asyncio\n",[128,622,623],{"class":130,"line":262},[128,624,259],{"emptyLinePlaceholder":258},[128,626,627,630,633,636,639],{"class":130,"line":322},[128,628,629],{"class":265},"async",[128,631,632],{"class":265}," def",[128,634,635],{"class":134}," main",[128,637,341],{"class":638},"sMtgK",[128,640,641],{"class":185},":\n",[128,643,644,647,650,653],{"class":130,"line":346},[128,645,646],{"class":236},"    browser ",[128,648,649],{"class":273},"=",[128,651,608],{"class":652},"s75IF",[128,654,655],{"class":185},"()\n",[128,657,658,661,663,665],{"class":130,"line":372},[128,659,660],{"class":236},"    agent ",[128,662,649],{"class":273},[128,664,602],{"class":652},[128,666,667],{"class":185},"(\n",[128,669,670,674,676,678,681,683],{"class":130,"line":399},[128,671,673],{"class":672},"sIhCM","        task",[128,675,649],{"class":273},[128,677,311],{"class":243},[128,679,680],{"class":138},"Find the number of stars of the browser-use repo on GitHub",[128,682,311],{"class":243},[128,684,685],{"class":638},",\n",[128,687,689,692,694,697,699],{"class":130,"line":688},8,[128,690,691],{"class":672},"        llm",[128,693,649],{"class":273},[128,695,696],{"class":652},"ChatBrowserUse",[128,698,341],{"class":185},[128,700,685],{"class":638},[128,702,704,707,709],{"class":130,"line":703},9,[128,705,706],{"class":672},"        browser",[128,708,649],{"class":273},[128,710,712],{"class":711},"sqxXB","browser\n",[128,714,716],{"class":130,"line":715},10,[128,717,718],{"class":185},"    )\n",[128,720,722,725,728,730,733],{"class":130,"line":721},11,[128,723,724],{"class":232},"    await",[128,726,727],{"class":236}," agent",[128,729,285],{"class":185},[128,731,732],{"class":652},"run",[128,734,655],{"class":185},[128,736,738],{"class":130,"line":737},12,[128,739,259],{"emptyLinePlaceholder":258},[128,741,743,746,748,750,752,755],{"class":130,"line":742},13,[128,744,745],{"class":236},"asyncio",[128,747,285],{"class":185},[128,749,732],{"class":652},[128,751,291],{"class":185},[128,753,754],{"class":652},"main",[128,756,757],{"class":185},"())\n",[15,759,760],{},"This abstraction removes the need for manual selector management and enables rapid automation of multi-step tasks.",[15,762,763],{},"However, this flexibility comes with tradeoffs:",[765,766,767,771,774],"ul",{},[768,769,770],"li",{},"Lower determinism compared to scripted automation",[768,772,773],{},"Slower execution due to model reasoning",[768,775,776],{},"Potential failure on complex or ambiguous interfaces",[15,778,779,780,783],{},"Browser-Use works best for ",[18,781,782],{},"exploratory or open-ended tasks",", where defining exact steps upfront is difficult. It is less suited for strict, repeatable pipelines.",[84,785,787],{"id":786},"stagehand-hybrid-typescript-automation-framework","Stagehand: Hybrid TypeScript Automation Framework",[52,789],{":height":90,":width":91,"alt":790,"loading":57,"src":791,"format":94},"Stagehand Browserbase AI browser automation framework GitHub repository preview","/blog/lightpanda-vs-browser-use-vs-stagehand-2026/3.png",[15,793,794],{},"Stagehand is a TypeScript framework that combines traditional Playwright automation with AI-powered actions. It allows you to write deterministic scripts while delegating complex interactions or extraction tasks to an AI model.",[15,796,797],{},"You can scaffold a project with:",[118,799,801],{"className":120,"code":800,"language":122,"meta":123,"style":123},"npx create-browser-app my-stagehand-project\n",[125,802,803],{"__ignoreMap":123},[128,804,805,808,811],{"class":130,"line":131},[128,806,807],{"class":134},"npx",[128,809,810],{"class":138}," create-browser-app",[128,812,813],{"class":138}," my-stagehand-project\n",[15,815,816],{},"Core primitives include:",[765,818,819,825,831,837],{},[768,820,821,824],{},[125,822,823],{},"stagehand.act()"," - perform actions via natural language",[768,826,827,830],{},[125,828,829],{},"stagehand.extract()"," - extract structured data with schema validation",[768,832,833,836],{},[125,834,835],{},"stagehand.observe()"," - describe page state",[768,838,839,842],{},[125,840,841],{},"stagehand.agent()"," - run multi-step workflows",[15,844,845],{},[18,846,847],{},"Example:",[118,849,853],{"className":850,"code":851,"language":852,"meta":123,"style":123},"language-ts shiki shiki-themes catppuccin-latte night-owl","import { Stagehand } from \"@browserbasehq/stagehand\";\nimport { z } from \"zod\";\n\nconst stagehand = new Stagehand({ env: \"LOCAL\" });\nawait stagehand.init();\n\nconst page = stagehand.context.pages()[0];\nawait page.goto(\"https://github.com/browserbase/stagehand\");\n\nawait stagehand.act(\"click on the link for the latest pull request\");\n\nconst prData = await stagehand.extract(\n  \"extract the author and title of the PR\",\n  z.object({\n    author: z.string(),\n    title: z.string()\n  })\n);\n\nconsole.log(prData);\n","ts",[125,854,855,880,902,906,944,959,963,996,1019,1023,1047,1051,1071,1083,1099,1119,1135,1144,1151,1156],{"__ignoreMap":123},[128,856,857,859,862,865,868,871,873,876,878],{"class":130,"line":131},[128,858,233],{"class":232},[128,860,861],{"class":185}," {",[128,863,864],{"class":236}," Stagehand ",[128,866,867],{"class":185},"}",[128,869,870],{"class":232}," from",[128,872,305],{"class":243},[128,874,875],{"class":138},"@browserbasehq/stagehand",[128,877,311],{"class":243},[128,879,253],{"class":185},[128,881,882,884,886,889,891,893,895,898,900],{"class":130,"line":198},[128,883,233],{"class":232},[128,885,861],{"class":185},[128,887,888],{"class":236}," z ",[128,890,867],{"class":185},[128,892,870],{"class":232},[128,894,305],{"class":243},[128,896,897],{"class":138},"zod",[128,899,311],{"class":243},[128,901,253],{"class":185},[128,903,904],{"class":130,"line":262},[128,905,259],{"emptyLinePlaceholder":258},[128,907,908,910,913,915,919,922,924,926,929,931,933,936,938,940,942],{"class":130,"line":322},[128,909,266],{"class":265},[128,911,912],{"class":269}," stagehand",[128,914,274],{"class":273},[128,916,918],{"class":917},"szhwX"," new",[128,920,921],{"class":134}," Stagehand",[128,923,291],{"class":236},[128,925,295],{"class":294},[128,927,928],{"class":298}," env",[128,930,302],{"class":273},[128,932,305],{"class":243},[128,934,935],{"class":138},"LOCAL",[128,937,311],{"class":243},[128,939,314],{"class":294},[128,941,317],{"class":236},[128,943,253],{"class":185},[128,945,946,948,950,952,955,957],{"class":130,"line":346},[128,947,349],{"class":232},[128,949,912],{"class":236},[128,951,285],{"class":284},[128,953,954],{"class":134},"init",[128,956,341],{"class":236},[128,958,253],{"class":185},[128,960,961],{"class":130,"line":372},[128,962,259],{"emptyLinePlaceholder":258},[128,964,965,967,969,971,974,976,980,982,985,988,991,994],{"class":130,"line":399},[128,966,266],{"class":265},[128,968,327],{"class":269},[128,970,274],{"class":273},[128,972,912],{"class":973},"s5Zek",[128,975,285],{"class":284},[128,977,979],{"class":978},"sHY1S","context",[128,981,285],{"class":284},[128,983,984],{"class":134},"pages",[128,986,987],{"class":236},"()[",[128,989,990],{"class":210},"0",[128,992,993],{"class":236},"]",[128,995,253],{"class":185},[128,997,998,1000,1002,1004,1006,1008,1010,1013,1015,1017],{"class":130,"line":688},[128,999,349],{"class":232},[128,1001,327],{"class":236},[128,1003,285],{"class":284},[128,1005,356],{"class":134},[128,1007,291],{"class":236},[128,1009,311],{"class":243},[128,1011,1012],{"class":138},"https://github.com/browserbase/stagehand",[128,1014,311],{"class":243},[128,1016,317],{"class":236},[128,1018,253],{"class":185},[128,1020,1021],{"class":130,"line":703},[128,1022,259],{"emptyLinePlaceholder":258},[128,1024,1025,1027,1029,1031,1034,1036,1038,1041,1043,1045],{"class":130,"line":715},[128,1026,349],{"class":232},[128,1028,912],{"class":236},[128,1030,285],{"class":284},[128,1032,1033],{"class":134},"act",[128,1035,291],{"class":236},[128,1037,311],{"class":243},[128,1039,1040],{"class":138},"click on the link for the latest pull request",[128,1042,311],{"class":243},[128,1044,317],{"class":236},[128,1046,253],{"class":185},[128,1048,1049],{"class":130,"line":721},[128,1050,259],{"emptyLinePlaceholder":258},[128,1052,1053,1055,1058,1060,1062,1064,1066,1069],{"class":130,"line":737},[128,1054,266],{"class":265},[128,1056,1057],{"class":269}," prData",[128,1059,274],{"class":273},[128,1061,277],{"class":232},[128,1063,912],{"class":973},[128,1065,285],{"class":284},[128,1067,1068],{"class":134},"extract",[128,1070,667],{"class":236},[128,1072,1073,1076,1079,1081],{"class":130,"line":742},[128,1074,1075],{"class":243},"  \"",[128,1077,1078],{"class":138},"extract the author and title of the PR",[128,1080,311],{"class":243},[128,1082,685],{"class":294},[128,1084,1086,1089,1091,1094,1096],{"class":130,"line":1085},14,[128,1087,1088],{"class":973},"  z",[128,1090,285],{"class":284},[128,1092,1093],{"class":134},"object",[128,1095,291],{"class":236},[128,1097,1098],{"class":294},"{\n",[128,1100,1102,1105,1107,1110,1112,1115,1117],{"class":130,"line":1101},15,[128,1103,1104],{"class":298},"    author",[128,1106,302],{"class":273},[128,1108,1109],{"class":973}," z",[128,1111,285],{"class":284},[128,1113,1114],{"class":134},"string",[128,1116,341],{"class":236},[128,1118,685],{"class":294},[128,1120,1122,1125,1127,1129,1131,1133],{"class":130,"line":1121},16,[128,1123,1124],{"class":298},"    title",[128,1126,302],{"class":273},[128,1128,1109],{"class":973},[128,1130,285],{"class":284},[128,1132,1114],{"class":134},[128,1134,655],{"class":236},[128,1136,1138,1141],{"class":130,"line":1137},17,[128,1139,1140],{"class":294},"  }",[128,1142,1143],{"class":236},")\n",[128,1145,1147,1149],{"class":130,"line":1146},18,[128,1148,317],{"class":236},[128,1150,253],{"class":185},[128,1152,1154],{"class":130,"line":1153},19,[128,1155,259],{"emptyLinePlaceholder":258},[128,1157,1159,1161,1163,1165,1168],{"class":130,"line":1158},20,[128,1160,375],{"class":236},[128,1162,285],{"class":284},[128,1164,380],{"class":134},[128,1166,1167],{"class":236},"(prData)",[128,1169,253],{"class":185},[15,1171,1172],{},"The hybrid model lets you use Playwright for precise, repeatable steps and AI where selectors or structure are unclear. Stagehand is more predictable than fully agent-driven tools, with room for AI where it actually helps.",[84,1174,1176],{"id":1175},"synergy-combining-lightpanda-with-ai-frameworks","Synergy: Combining Lightpanda with AI Frameworks",[15,1178,1179],{},"Both Browser-Use and Stagehand can connect to Lightpanda via CDP, replacing Chromium as the execution engine. The result is AI-driven automation on a more resource-efficient backend.",[52,1181],{":height":90,":width":1182,"alt":1183,"loading":57,"src":1184,"provider":59},"820","Architecture stack showing AI agent and automation framework driving Lightpanda over CDP","/blog/lightpanda-vs-browser-use-vs-stagehand-2026/architecture-stack.svg",[15,1186,1187],{},[18,1188,1189],{},"Stagehand with Lightpanda:",[118,1191,1193],{"className":223,"code":1192,"language":225,"meta":123,"style":123},"const stagehand = new Stagehand({\n  env: \"LOCAL\",\n  localBrowserLaunchOptions: { cdpUrl: \"ws://127.0.0.1:9222\" },\n});\n",[125,1194,1195,1211,1226,1249],{"__ignoreMap":123},[128,1196,1197,1199,1201,1203,1205,1207,1209],{"class":130,"line":131},[128,1198,266],{"class":265},[128,1200,912],{"class":269},[128,1202,274],{"class":273},[128,1204,918],{"class":917},[128,1206,921],{"class":134},[128,1208,291],{"class":236},[128,1210,1098],{"class":294},[128,1212,1213,1216,1218,1220,1222,1224],{"class":130,"line":198},[128,1214,1215],{"class":298},"  env",[128,1217,302],{"class":273},[128,1219,305],{"class":243},[128,1221,935],{"class":138},[128,1223,311],{"class":243},[128,1225,685],{"class":294},[128,1227,1228,1231,1233,1235,1238,1240,1242,1244,1246],{"class":130,"line":262},[128,1229,1230],{"class":298},"  localBrowserLaunchOptions",[128,1232,302],{"class":273},[128,1234,861],{"class":294},[128,1236,1237],{"class":298}," cdpUrl",[128,1239,302],{"class":273},[128,1241,305],{"class":243},[128,1243,308],{"class":138},[128,1245,311],{"class":243},[128,1247,1248],{"class":294}," },\n",[128,1250,1251,1253,1255],{"class":130,"line":322},[128,1252,867],{"class":294},[128,1254,317],{"class":236},[128,1256,253],{"class":185},[15,1258,1259],{},[18,1260,1261],{},"Browser-Use with Lightpanda:",[118,1263,1267],{"className":1264,"code":1265,"language":1266,"meta":123,"style":123},"language-py shiki shiki-themes catppuccin-latte night-owl","from browser_use import Agent, Browser, ChatBrowserUse\n\nbrowser = Browser(cdp_url=\"http://127.0.0.1:9222\")\nagent = Agent(\n    task=\"Find the number of stars of the lightpanda-io/browser repo\",\n    llm=ChatBrowserUse(),\n    browser=browser,\n)\nawait agent.run()\n","py",[125,1268,1269,1287,1291,1316,1327,1343,1356,1368,1372],{"__ignoreMap":123},[128,1270,1271,1273,1275,1277,1279,1281,1283,1285],{"class":130,"line":131},[128,1272,240],{"class":232},[128,1274,597],{"class":236},[128,1276,233],{"class":232},[128,1278,602],{"class":236},[128,1280,605],{"class":185},[128,1282,608],{"class":236},[128,1284,605],{"class":185},[128,1286,613],{"class":236},[128,1288,1289],{"class":130,"line":198},[128,1290,259],{"emptyLinePlaceholder":258},[128,1292,1293,1296,1298,1300,1302,1305,1307,1309,1312,1314],{"class":130,"line":262},[128,1294,1295],{"class":236},"browser ",[128,1297,649],{"class":273},[128,1299,608],{"class":652},[128,1301,291],{"class":185},[128,1303,1304],{"class":672},"cdp_url",[128,1306,649],{"class":273},[128,1308,311],{"class":243},[128,1310,1311],{"class":138},"http://127.0.0.1:9222",[128,1313,311],{"class":243},[128,1315,1143],{"class":185},[128,1317,1318,1321,1323,1325],{"class":130,"line":322},[128,1319,1320],{"class":236},"agent ",[128,1322,649],{"class":273},[128,1324,602],{"class":652},[128,1326,667],{"class":185},[128,1328,1329,1332,1334,1336,1339,1341],{"class":130,"line":346},[128,1330,1331],{"class":672},"    task",[128,1333,649],{"class":273},[128,1335,311],{"class":243},[128,1337,1338],{"class":138},"Find the number of stars of the lightpanda-io/browser repo",[128,1340,311],{"class":243},[128,1342,685],{"class":638},[128,1344,1345,1348,1350,1352,1354],{"class":130,"line":372},[128,1346,1347],{"class":672},"    llm",[128,1349,649],{"class":273},[128,1351,696],{"class":652},[128,1353,341],{"class":185},[128,1355,685],{"class":638},[128,1357,1358,1361,1363,1366],{"class":130,"line":399},[128,1359,1360],{"class":672},"    browser",[128,1362,649],{"class":273},[128,1364,1365],{"class":711},"browser",[128,1367,685],{"class":638},[128,1369,1370],{"class":130,"line":688},[128,1371,1143],{"class":185},[128,1373,1374,1376,1378,1380,1382],{"class":130,"line":703},[128,1375,349],{"class":232},[128,1377,727],{"class":236},[128,1379,285],{"class":185},[128,1381,732],{"class":652},[128,1383,655],{"class":185},[420,1385,1387],{"id":1386},"when-this-combination-makes-sense","When this combination makes sense:",[765,1389,1390,1393,1396],{},[768,1391,1392],{},"High-concurrency scraping",[768,1394,1395],{},"Resource-constrained environments",[768,1397,1398],{},"Cost-sensitive workloads",[420,1400,1402],{"id":1401},"when-it-may-not","When it may not:",[765,1404,1405,1408,1411],{},[768,1406,1407],{},"If you rely on full Chrome compatibility",[768,1409,1410],{},"If performance is not your bottleneck",[768,1412,1413],{},"If debugging complexity is already high",[84,1415,1417],{"id":1416},"bottom-line","Bottom Line",[15,1419,1420],{},"Lightpanda fits performance-critical workloads, Browser-Use fits exploratory automation, and Stagehand fits production scripts that mix deterministic steps with AI. When performance matters and you want AI on top, run Browser-Use or Stagehand against Lightpanda over CDP.",[1422,1423,1424],"style",{},"html pre.shiki code .sNstc, html code.shiki .sNstc{--shiki-default:#1E66F5;--shiki-default-font-style:italic;--shiki-dark:#82AAFF;--shiki-dark-font-style:italic}html pre.shiki code .sfrMT, html code.shiki .sfrMT{--shiki-default:#40A02B;--shiki-dark:#ECC48D}html pre.shiki code .sPg8w, html code.shiki .sPg8w{--shiki-default:#40A02B;--shiki-dark:#82AAFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .scGhl, html code.shiki .scGhl{--shiki-default:#7C7F93;--shiki-dark:#D6DEEB}html pre.shiki code .sZ_Zo, html code.shiki .sZ_Zo{--shiki-default:#FE640B;--shiki-dark:#F78C6C}html pre.shiki code .srhcd, html code.shiki .srhcd{--shiki-default:#8839EF;--shiki-default-font-style:inherit;--shiki-dark:#C792EA;--shiki-dark-font-style:italic}html pre.shiki code .s2kId, html code.shiki .s2kId{--shiki-default:#4C4F69;--shiki-dark:#D6DEEB}html pre.shiki code .sbuKk, html code.shiki .sbuKk{--shiki-default:#40A02B;--shiki-dark:#D9F5DD}html pre.shiki code .s76yb, html code.shiki .s76yb{--shiki-default:#8839EF;--shiki-dark:#C792EA}html pre.shiki code .scsc5, html code.shiki .scsc5{--shiki-default:#4C4F69;--shiki-default-font-style:inherit;--shiki-dark:#82AAFF;--shiki-dark-font-style:italic}html pre.shiki code .s-_ek, html code.shiki .s-_ek{--shiki-default:#179299;--shiki-dark:#C792EA}html pre.shiki code .sP4PM, html code.shiki .sP4PM{--shiki-default:#4C4F69;--shiki-default-font-style:inherit;--shiki-dark:#7FDBCA;--shiki-dark-font-style:italic}html pre.shiki code .s5FwJ, html code.shiki .s5FwJ{--shiki-default:#179299;--shiki-default-font-style:inherit;--shiki-dark:#C792EA;--shiki-dark-font-style:italic}html pre.shiki code .sgNGR, html code.shiki .sgNGR{--shiki-default:#7C7F93;--shiki-dark:#C792EA}html pre.shiki code .s3XBt, html code.shiki .s3XBt{--shiki-default:#4C4F69;--shiki-default-font-style:inherit;--shiki-dark:#C792EA;--shiki-dark-font-style:italic}html pre.shiki code .sMtgK, html code.shiki .sMtgK{--shiki-default:#7C7F93;--shiki-dark:#D9F5DD}html pre.shiki code .s75IF, html code.shiki .s75IF{--shiki-default:#1E66F5;--shiki-dark:#B2CCD6}html pre.shiki code .sIhCM, html code.shiki .sIhCM{--shiki-default:#E64553;--shiki-default-font-style:italic;--shiki-dark:#D7DBE0;--shiki-dark-font-style:inherit}html pre.shiki code .sqxXB, html code.shiki .sqxXB{--shiki-default:#4C4F69;--shiki-dark:#82AAFF}html pre.shiki code .szhwX, html code.shiki .szhwX{--shiki-default:#8839EF;--shiki-default-font-weight:bold;--shiki-dark:#7FDBCA;--shiki-dark-font-weight:inherit}html pre.shiki code .s5Zek, html code.shiki .s5Zek{--shiki-default:#4C4F69;--shiki-default-font-style:inherit;--shiki-dark:#D6DEEB;--shiki-dark-font-style:italic}html pre.shiki code .sHY1S, html code.shiki .sHY1S{--shiki-default:#4C4F69;--shiki-default-font-style:inherit;--shiki-dark:#FAF39F;--shiki-dark-font-style:italic}",{"title":123,"searchDepth":198,"depth":198,"links":1426},[1427,1430,1431,1432,1436],{"id":86,"depth":198,"text":87,"children":1428},[1429],{"id":422,"depth":262,"text":423},{"id":525,"depth":198,"text":526},{"id":786,"depth":198,"text":787},{"id":1175,"depth":198,"text":1176,"children":1433},[1434,1435],{"id":1386,"depth":262,"text":1387},{"id":1401,"depth":262,"text":1402},{"id":1416,"depth":198,"text":1417},"ai-agents","2026-05-12","Compare Lightpanda's high-performance browser engine, Browser-Use's Python AI agent, and Stagehand's hybrid TypeScript framework. See where each tool fits, how they trade off speed, determinism, and abstraction, and how to combine them for resource-efficient AI-driven browser automation in 2026.","md",[1442,1445,1448],{"question":1443,"answer":1444},"What is Lightpanda and how is it different from Chrome Headless?","Lightpanda is a headless browser engine written in Zig and built around the Chrome DevTools Protocol. It is designed as a lighter, faster alternative to Chrome Headless for automation workloads, with the tradeoff that it is not yet a full Chrome replacement and may have compatibility gaps on complex pages.",{"question":1446,"answer":1447},"Should I use Browser-Use or Stagehand for AI browser automation?","Use Browser-Use when you want the fastest path from a natural-language task to a working automation, especially for exploratory or loosely defined work. Use Stagehand when you need a hybrid approach that mixes deterministic Playwright steps with selective AI actions for production workflows.",{"question":1449,"answer":1450},"Can I combine Lightpanda with Browser-Use or Stagehand?","Yes. Both Browser-Use and Stagehand can connect to Lightpanda over CDP, using it as a more resource-efficient execution backend instead of Chromium. This is most useful for high-concurrency scraping or cost-sensitive workloads, but it also stacks more failure points, which makes debugging harder.",0,null,{"shortTitle":1454,"relatedLinks":1455},"Lightpanda, Browser-Use, Stagehand",[1456,1460],{"text":1457,"href":1458,"description":1459},"CDP vs Playwright vs Puppeteer","/blog/cdp-vs-playwright-vs-puppeteer","How the underlying protocols and frameworks compare for everyday browser automation.",{"text":1461,"href":1462,"description":1463},"Agent Browser vs Puppeteer & Playwright","/blog/agent-browser-vs-puppeteer-and-playwright","Where classic automation frameworks fall short for AI agents and what a purpose-built agent browser changes.","/blog/lightpanda-vs-browser-use-vs-stagehand-2026",{"title":5,"description":1439},{"loc":1464},"blog/1041.lightpanda-vs-browser-use-vs-stagehand-2026",[1469,1437,1470,1471,1472],"browser-automation","lightpanda","browser-use","stagehand","NsvY0oiBIGbPe-zxHRqznh0jrOzTqEXpl57ssPNL5OU",[1475,3091],{"id":1476,"title":1477,"authorId":1478,"body":1479,"category":1437,"created":3066,"description":3067,"extension":1440,"faqs":1452,"featurePriority":1452,"head":1452,"landingPath":1452,"meta":3068,"navigation":258,"ogImage":1452,"path":3080,"robots":1452,"schemaOrg":1452,"seo":3081,"sitemap":3082,"stem":3083,"tags":3084,"__hash__":3090},"blog/blog/1012.dom-downsampling-for-llm-based-web-agents.md","DOM Downsampling for LLM-Based Web Agents","thassilo-schiepanski",{"type":8,"value":1480,"toc":3051},[1481,1486,1509,1513,1520,1524,1540,1544,1550,1554,1572,1598,1601,1605,1608,1618,1624,1655,1659,1679,1691,1696,1711,1725,1728,1732,1752,1756,1764,1776,1780,1783,2149,2155,2162,2326,2333,2424,2431,2503,2512,2518,2527,2531,2537,2547,2559,2777,2795,2817,2823,2866,2870,2882,2891,2896,2901,2904,2908,2914,2919,2957,2961,2967,2971,2981,2985,2988,3048],[52,1482],{":width":1483,"alt":1484,"format":94,"loading":57,"src":1485},"900","Downsampling visualised for digital images and HTML","/blog/dom-downsampling-for-web-agents/1.png",[15,1487,1488,1493,1494,1493,1499,1504,1505,1508],{},[64,1489,1492],{"href":1490,"rel":1491},"https://operator.chatgpt.com",[68],"Operator (OpenAI)",", ",[64,1495,1498],{"href":1496,"rel":1497},"https://www.director.ai",[68],"Director (Browserbase)",[64,1500,1503],{"href":1501,"rel":1502},"https://browser-use.com",[68],"Browser Use"," – we are currently witnessing the rise of ",[18,1506,1507],{},"web AI agents",". The first iteration of serviceable web agents was enabled by frontier LLMs, which act as instantaneous domain model backends. The domain, hereby, corresponds to the landscape of web application UIs.",[84,1510,1512],{"id":1511},"what-is-a-snapshot","What is a Snapshot?",[15,1514,1515,1516,1519],{},"Web agents provide an LLM with a task, and serialised runtime state of a currently browsed web application (e.g., a screenshot). The LLM is ought to suggest relevant actions to perform in the web application. Serialisation of such runtime state is referred to as a ",[18,1517,1518],{},"snapshot",". And the snapshot technique primarily decides the quality of LLM interaction suggestions.",[420,1521,1523],{"id":1522},"gui-snapshots","GUI Snapshots",[15,1525,1526,1527,1530,1531,1535,1536,1539],{},"Screenshots – for consistency reasons referred to as ",[18,1528,1529],{},"GUI snapshots"," – resemble how humans visually perceive web application UIs. LLM APIs subsidise the use of image input through upstream compression. Compresssion, however, irreversibly affects image dimensions, which takes away pixel precision; no way to suggest interactions like ",[1532,1533,1534],"em",{},"“click at 100, 735”",". As a workaround, early web agents used ",[1532,1537,1538],{},"grounded"," GUI snapshots. Grounding describes adding visual cues to the GUI, such as bounding boxes with numerical identifiers. Grounding lets the LLM refer to specific parts of the page by identifier, so the agent can trace back interaction targets.",[52,1541],{":width":1483,"alt":1542,"format":94,"loading":57,"src":1543},"Grounded GUI snapshot as implemented by Browser Use","/blog/dom-downsampling-for-web-agents/2.png",[15,1545,1546],{},[1547,1548,1549],"small",{},"Grounded GUI snapshot as implemented by Browser Use.",[420,1551,1553],{"id":1552},"dom-snapshots","DOM Snapshots",[15,1555,1556,1557,1567,1568,1571],{},"LLMs arguably are much better at understanding code than images. Research supports they excel at describing and classifying HTML, and also navigating an inherent UI",[1558,1559,1560],"sup",{},[64,1561,1566],{"href":1562,"ariaDescribedBy":1563,"dataFootnoteRef":123,"id":1565},"#user-content-fn-1",[1564],"footnote-label","user-content-fnref-1","1",". The DOM (document object model) – a web browser's runtime state model of a web application – translates back to HTML. For this reason, ",[18,1569,1570],{},"DOM snapshots"," offer a compelling alternative to GUI snapshots. DOM snapshots offer a handful of key advantages:",[1573,1574,1575,1578,1581,1584,1587],"ol",{},[768,1576,1577],{},"DOM snapshots connect with LLM code (HTML) interpretation abilities.",[768,1579,1580],{},"DOM snapshots can be compiled from deep clones, hidden from supervision (unlike GUI grounding).",[768,1582,1583],{},"DOM snapshots render text input that on average consume less bandwidth than screnshots.",[768,1585,1586],{},"DOM snapshots allow for exact programmatic targeting of elements (e.g., via CSS selectors).",[768,1588,1589,1590,1593,1594,1597],{},"DOM snapshots are available with the ",[125,1591,1592],{},"DOMContentLoaded"," event (whereas the GUI completes initial rendering with ",[125,1595,1596],{},"load",").",[15,1599,1600],{},"Yet, DOM snapshots have a major problem: potentially exhaustive model context. Whereas GUI snapshot commonly cost four figures of tokens, a raw DOM snapshot can cost into hundreds of thousands of tokens. To connect with LLM code interpretation abilities, however, developers have used element extraction techniques – picking only (likely) important elements from the DOM. Element extraction flattens the DOM tree, which disregards hierarchy as a potential UI feature (how do elements relate to each other?).",[84,1602,1604],{"id":1603},"dom-downsampling-a-novel-approach","DOM Downsampling: A Novel Approach",[15,1606,1607],{},"To enable DOM snapshots for use with web agents, it requires client-side pre-processing – similar to how LLM vision APIs process image input. Downsampling is a fundamental signal processing technique that reduces data that scales out of time or space constraints under the assumption that the majority of relevant features is retained. Picture JPEG compression as an example: put simply, a JPEG image stores only an average colour for patches of pixels. The bigger the patches, the smaller the file. Although some detail is lost, key image features – colours, edges, objects – keep being recognisable – up to a large patch size.",[15,1609,1610,1611,46,1614,1617],{},"We transfer the concept of ",[18,1612,1613],{},"downsampling",[18,1615,1616],{},"DOMs",". Particularly, since such an approach retains HTML characteristics that might be valuable for an LLM backend. We define UI features as concepts that, to a substantial degree, facilitate LLM suggestions on how to act in the UI in order to solve related web-based tasks.",[84,1619,1621],{"id":1620},"d2snap",[1532,1622,1623],{},"D2Snap",[15,1625,1626,1627,1635,1643,1651,1652,1654],{},"We recently proposed ",[64,1628,1631],{"href":1629,"rel":1630},"https://arxiv.org/abs/2508.04412",[68],[18,1632,1633],{},[1532,1634,1623],{},[1558,1636,1637],{},[64,1638,1642],{"href":1639,"ariaDescribedBy":1640,"dataFootnoteRef":123,"id":1641},"#user-content-fn-2",[1564],"user-content-fnref-2","2",[1558,1644,1645],{},[64,1646,1650],{"href":1647,"ariaDescribedBy":1648,"dataFootnoteRef":123,"id":1649},"#user-content-fn-3",[1564],"user-content-fnref-3","3"," – a first-of-its-kind downsampling algorithm for DOMs. Herein, we'll briefly explain how the ",[1532,1653,1623],{}," algorithm works, and how it can be utilised to build efficient and performant web agents.",[420,1656,1658],{"id":1657},"how-it-works","How it works",[15,1660,1661,1662,1664,1665,1493,1668,1671,1672,1675,1676,1597],{},"There are basically three redundant types of DOM nodes, and HTML concepts: elements, text, and attributes. We defined and empirically adjusted three node-specific procedures. ",[1532,1663,1623],{}," downsamples at a variable ratio, configured through procedure-specific parameters  ",[125,1666,1667],{},"k",[125,1669,1670],{},"l",", and ",[125,1673,1674],{},"m"," (",[125,1677,1678],{},"∈ [0, 1]",[1680,1681,1682],"blockquote",{},[15,1683,1684,1685,1690],{},"We used ",[64,1686,1689],{"href":1687,"rel":1688},"https://openai.com/index/hello-gpt-4o/",[68],"GPT-4o"," to create a downsampling ground truth dataset by having it classify HTML elements and scoring semantics regarding relevance for understanding the inherent UI – a UI feature degree.",[1692,1693,1695],"h4",{"id":1694},"procedure-elements","Procedure: Elements",[15,1697,1698,1700,1701,104,1704,1707,1708,1710],{},[1532,1699,1623],{}," downsamples (simplifies) elements by merging container elements like ",[125,1702,1703],{},"section",[125,1705,1706],{},"div"," together. A parameter ",[125,1709,1667],{}," controls the merge ratio depending on the total DOM tree height. For competing concepts, such as element name, the ground truth determines which element's characterisitics to keep – comparing UI feature scores.",[15,1712,1713,1714,1493,1716,1718,1719,1724],{},"Elements in content elements (",[125,1715,15],{},[125,1717,1680],{},", ...) are translated to a more comprehensive ",[64,1720,1723],{"href":1721,"rel":1722},"https://www.markdownguide.org/basic-syntax/",[68],"Markdown"," representation.",[15,1726,1727],{},"Interactive elements, definite interaction target candidates, are kept as is.",[1692,1729,1731],{"id":1730},"procedure-text","Procedure: Text",[15,1733,1734,1736,1737,1740,1748,1749,1751],{},[1532,1735,1623],{}," downsamples text by dropping a fraction. Natural units of text are space-separated words, or punctuation-separated sentences. We reuse the ",[1532,1738,1739],{},"TextRank",[1558,1741,1742],{},[64,1743,1747],{"href":1744,"ariaDescribedBy":1745,"dataFootnoteRef":123,"id":1746},"#user-content-fn-4",[1564],"user-content-fnref-4","4"," algorithm to rank sentences in text nodes. The lowest-ranking fraction of sentences, denoted by parameter ",[125,1750,1670],{},", is dropped.",[1692,1753,1755],{"id":1754},"procedure-attributes","Procedure: Attributes",[15,1757,1758,1760,1761,1763],{},[1532,1759,1623],{}," downsamples attributes by dropping those with a name that, according to ground truth, holds a UI feature degree below a threshold. Parameter ",[125,1762,1674],{}," denotes this threshold.",[1680,1765,1766],{},[15,1767,1768,1769,1775],{},"Check out the ",[64,1770,1772,1774],{"href":1629,"rel":1771},[68],[1532,1773,1623],{}," paper"," to learn about the algorithm in-depth.",[420,1777,1779],{"id":1778},"example-of-a-downsampled-dom","Example of a Downsampled DOM",[15,1781,1782],{},"Consider a partial DOM state, serialised as HTML:",[118,1784,1788],{"className":1785,"code":1786,"language":1787,"meta":123,"style":123},"language-html shiki shiki-themes catppuccin-latte night-owl","\u003Csection class=\"container\" tabindex=\"3\" required=\"true\" type=\"example\">\n  \u003Cdiv class=\"mx-auto\" data-topic=\"products\" required=\"false\">\n    \u003Ch1>Our Pizza\u003C/h1>\n    \u003Cdiv>\n      \u003Cdiv class=\"shadow-lg\">\n        \u003Ch2>Margherita\u003C/h2>\n        \u003Cp>\n          A simple classic: mozzarela, tomatoes and basil.\n          An everyday choice!\n        \u003C/p>\n        \u003Cbutton type=\"button\">Add\u003C/button>\n      \u003C/div>\n      \u003Cdiv class=\"shadow-lg\">\n        \u003Ch2>Capricciosa\u003C/h2>\n        \u003Cp>\n          A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n          A true favourite!\n          \u003C/p>\n        \u003Cbutton type=\"button\">Add\u003C/button>\n      \u003C/div>\n    \u003C/div>\n  \u003C/div>\n\u003C/section>\n","html",[125,1789,1790,1850,1893,1914,1922,1942,1960,1968,1973,1978,1987,2015,2024,2042,2059,2067,2072,2077,2086,2112,2120,2130,2140],{"__ignoreMap":123},[128,1791,1792,1796,1799,1803,1805,1807,1810,1812,1815,1817,1819,1821,1823,1826,1828,1830,1833,1835,1838,1840,1842,1845,1847],{"class":130,"line":131},[128,1793,1795],{"class":1794},"s9rnR","\u003C",[128,1797,1703],{"class":1798},"sY2RG",[128,1800,1802],{"class":1801},"swkLt"," class",[128,1804,649],{"class":1794},[128,1806,311],{"class":243},[128,1808,1809],{"class":138},"container",[128,1811,311],{"class":243},[128,1813,1814],{"class":1801}," tabindex",[128,1816,649],{"class":1794},[128,1818,311],{"class":243},[128,1820,1650],{"class":138},[128,1822,311],{"class":243},[128,1824,1825],{"class":1801}," required",[128,1827,649],{"class":1794},[128,1829,311],{"class":243},[128,1831,1832],{"class":138},"true",[128,1834,311],{"class":243},[128,1836,1837],{"class":1801}," type",[128,1839,649],{"class":1794},[128,1841,311],{"class":243},[128,1843,1844],{"class":138},"example",[128,1846,311],{"class":243},[128,1848,1849],{"class":1794},">\n",[128,1851,1852,1855,1857,1859,1861,1863,1866,1868,1871,1873,1875,1878,1880,1882,1884,1886,1889,1891],{"class":130,"line":198},[128,1853,1854],{"class":1794},"  \u003C",[128,1856,1706],{"class":1798},[128,1858,1802],{"class":1801},[128,1860,649],{"class":1794},[128,1862,311],{"class":243},[128,1864,1865],{"class":138},"mx-auto",[128,1867,311],{"class":243},[128,1869,1870],{"class":1801}," data-topic",[128,1872,649],{"class":1794},[128,1874,311],{"class":243},[128,1876,1877],{"class":138},"products",[128,1879,311],{"class":243},[128,1881,1825],{"class":1801},[128,1883,649],{"class":1794},[128,1885,311],{"class":243},[128,1887,1888],{"class":138},"false",[128,1890,311],{"class":243},[128,1892,1849],{"class":1794},[128,1894,1895,1898,1901,1904,1907,1910,1912],{"class":130,"line":262},[128,1896,1897],{"class":1794},"    \u003C",[128,1899,1900],{"class":1798},"h1",[128,1902,1903],{"class":1794},">",[128,1905,1906],{"class":236},"Our Pizza",[128,1908,1909],{"class":1794},"\u003C/",[128,1911,1900],{"class":1798},[128,1913,1849],{"class":1794},[128,1915,1916,1918,1920],{"class":130,"line":322},[128,1917,1897],{"class":1794},[128,1919,1706],{"class":1798},[128,1921,1849],{"class":1794},[128,1923,1924,1927,1929,1931,1933,1935,1938,1940],{"class":130,"line":346},[128,1925,1926],{"class":1794},"      \u003C",[128,1928,1706],{"class":1798},[128,1930,1802],{"class":1801},[128,1932,649],{"class":1794},[128,1934,311],{"class":243},[128,1936,1937],{"class":138},"shadow-lg",[128,1939,311],{"class":243},[128,1941,1849],{"class":1794},[128,1943,1944,1947,1949,1951,1954,1956,1958],{"class":130,"line":372},[128,1945,1946],{"class":1794},"        \u003C",[128,1948,84],{"class":1798},[128,1950,1903],{"class":1794},[128,1952,1953],{"class":236},"Margherita",[128,1955,1909],{"class":1794},[128,1957,84],{"class":1798},[128,1959,1849],{"class":1794},[128,1961,1962,1964,1966],{"class":130,"line":399},[128,1963,1946],{"class":1794},[128,1965,15],{"class":1798},[128,1967,1849],{"class":1794},[128,1969,1970],{"class":130,"line":688},[128,1971,1972],{"class":236},"          A simple classic: mozzarela, tomatoes and basil.\n",[128,1974,1975],{"class":130,"line":703},[128,1976,1977],{"class":236},"          An everyday choice!\n",[128,1979,1980,1983,1985],{"class":130,"line":715},[128,1981,1982],{"class":1794},"        \u003C/",[128,1984,15],{"class":1798},[128,1986,1849],{"class":1794},[128,1988,1989,1991,1994,1996,1998,2000,2002,2004,2006,2009,2011,2013],{"class":130,"line":721},[128,1990,1946],{"class":1794},[128,1992,1993],{"class":1798},"button",[128,1995,1837],{"class":1801},[128,1997,649],{"class":1794},[128,1999,311],{"class":243},[128,2001,1993],{"class":138},[128,2003,311],{"class":243},[128,2005,1903],{"class":1794},[128,2007,2008],{"class":236},"Add",[128,2010,1909],{"class":1794},[128,2012,1993],{"class":1798},[128,2014,1849],{"class":1794},[128,2016,2017,2020,2022],{"class":130,"line":737},[128,2018,2019],{"class":1794},"      \u003C/",[128,2021,1706],{"class":1798},[128,2023,1849],{"class":1794},[128,2025,2026,2028,2030,2032,2034,2036,2038,2040],{"class":130,"line":742},[128,2027,1926],{"class":1794},[128,2029,1706],{"class":1798},[128,2031,1802],{"class":1801},[128,2033,649],{"class":1794},[128,2035,311],{"class":243},[128,2037,1937],{"class":138},[128,2039,311],{"class":243},[128,2041,1849],{"class":1794},[128,2043,2044,2046,2048,2050,2053,2055,2057],{"class":130,"line":1085},[128,2045,1946],{"class":1794},[128,2047,84],{"class":1798},[128,2049,1903],{"class":1794},[128,2051,2052],{"class":236},"Capricciosa",[128,2054,1909],{"class":1794},[128,2056,84],{"class":1798},[128,2058,1849],{"class":1794},[128,2060,2061,2063,2065],{"class":130,"line":1101},[128,2062,1946],{"class":1794},[128,2064,15],{"class":1798},[128,2066,1849],{"class":1794},[128,2068,2069],{"class":130,"line":1121},[128,2070,2071],{"class":236},"          A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n",[128,2073,2074],{"class":130,"line":1137},[128,2075,2076],{"class":236},"          A true favourite!\n",[128,2078,2079,2082,2084],{"class":130,"line":1146},[128,2080,2081],{"class":1794},"          \u003C/",[128,2083,15],{"class":1798},[128,2085,1849],{"class":1794},[128,2087,2088,2090,2092,2094,2096,2098,2100,2102,2104,2106,2108,2110],{"class":130,"line":1153},[128,2089,1946],{"class":1794},[128,2091,1993],{"class":1798},[128,2093,1837],{"class":1801},[128,2095,649],{"class":1794},[128,2097,311],{"class":243},[128,2099,1993],{"class":138},[128,2101,311],{"class":243},[128,2103,1903],{"class":1794},[128,2105,2008],{"class":236},[128,2107,1909],{"class":1794},[128,2109,1993],{"class":1798},[128,2111,1849],{"class":1794},[128,2113,2114,2116,2118],{"class":130,"line":1158},[128,2115,2019],{"class":1794},[128,2117,1706],{"class":1798},[128,2119,1849],{"class":1794},[128,2121,2123,2126,2128],{"class":130,"line":2122},21,[128,2124,2125],{"class":1794},"    \u003C/",[128,2127,1706],{"class":1798},[128,2129,1849],{"class":1794},[128,2131,2133,2136,2138],{"class":130,"line":2132},22,[128,2134,2135],{"class":1794},"  \u003C/",[128,2137,1706],{"class":1798},[128,2139,1849],{"class":1794},[128,2141,2143,2145,2147],{"class":130,"line":2142},23,[128,2144,1909],{"class":1794},[128,2146,1703],{"class":1798},[128,2148,1849],{"class":1794},[15,2150,2151,2152,2154],{},"Here are some ",[1532,2153,1623],{}," downsampling results, which are based on different parametric configurations. A percentage denotes the reduced size.",[1692,2156,2158,2161],{"id":2157},"k3-l3-m3-55",[125,2159,2160],{},"k=.3, l=.3, m=.3"," (55%)",[118,2163,2165],{"className":1785,"code":2164,"language":1787,"meta":123,"style":123},"\u003Csection tabindex=\"3\" type=\"example\" class=\"container\" required=\"true\">\n  # Our Pizza\n  \u003Cdiv class=\"shadow-lg\">\n    ## Margherita\n    A simple classic: mozzarela, tomatoes, and basil.\n    \u003Cbutton type=\"button\">Add\u003C/button>\n    ## Capricciosa\n    A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n    \u003Cbutton type=\"button\">Add\u003C/button>\n  \u003C/div>\n\u003C/section>\n",[125,2166,2167,2215,2220,2238,2243,2248,2274,2279,2284,2310,2318],{"__ignoreMap":123},[128,2168,2169,2171,2173,2175,2177,2179,2181,2183,2185,2187,2189,2191,2193,2195,2197,2199,2201,2203,2205,2207,2209,2211,2213],{"class":130,"line":131},[128,2170,1795],{"class":1794},[128,2172,1703],{"class":1798},[128,2174,1814],{"class":1801},[128,2176,649],{"class":1794},[128,2178,311],{"class":243},[128,2180,1650],{"class":138},[128,2182,311],{"class":243},[128,2184,1837],{"class":1801},[128,2186,649],{"class":1794},[128,2188,311],{"class":243},[128,2190,1844],{"class":138},[128,2192,311],{"class":243},[128,2194,1802],{"class":1801},[128,2196,649],{"class":1794},[128,2198,311],{"class":243},[128,2200,1809],{"class":138},[128,2202,311],{"class":243},[128,2204,1825],{"class":1801},[128,2206,649],{"class":1794},[128,2208,311],{"class":243},[128,2210,1832],{"class":138},[128,2212,311],{"class":243},[128,2214,1849],{"class":1794},[128,2216,2217],{"class":130,"line":198},[128,2218,2219],{"class":236},"  # Our Pizza\n",[128,2221,2222,2224,2226,2228,2230,2232,2234,2236],{"class":130,"line":262},[128,2223,1854],{"class":1794},[128,2225,1706],{"class":1798},[128,2227,1802],{"class":1801},[128,2229,649],{"class":1794},[128,2231,311],{"class":243},[128,2233,1937],{"class":138},[128,2235,311],{"class":243},[128,2237,1849],{"class":1794},[128,2239,2240],{"class":130,"line":322},[128,2241,2242],{"class":236},"    ## Margherita\n",[128,2244,2245],{"class":130,"line":346},[128,2246,2247],{"class":236},"    A simple classic: mozzarela, tomatoes, and basil.\n",[128,2249,2250,2252,2254,2256,2258,2260,2262,2264,2266,2268,2270,2272],{"class":130,"line":372},[128,2251,1897],{"class":1794},[128,2253,1993],{"class":1798},[128,2255,1837],{"class":1801},[128,2257,649],{"class":1794},[128,2259,311],{"class":243},[128,2261,1993],{"class":138},[128,2263,311],{"class":243},[128,2265,1903],{"class":1794},[128,2267,2008],{"class":236},[128,2269,1909],{"class":1794},[128,2271,1993],{"class":1798},[128,2273,1849],{"class":1794},[128,2275,2276],{"class":130,"line":399},[128,2277,2278],{"class":236},"    ## Capricciosa\n",[128,2280,2281],{"class":130,"line":688},[128,2282,2283],{"class":236},"    A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n",[128,2285,2286,2288,2290,2292,2294,2296,2298,2300,2302,2304,2306,2308],{"class":130,"line":703},[128,2287,1897],{"class":1794},[128,2289,1993],{"class":1798},[128,2291,1837],{"class":1801},[128,2293,649],{"class":1794},[128,2295,311],{"class":243},[128,2297,1993],{"class":138},[128,2299,311],{"class":243},[128,2301,1903],{"class":1794},[128,2303,2008],{"class":236},[128,2305,1909],{"class":1794},[128,2307,1993],{"class":1798},[128,2309,1849],{"class":1794},[128,2311,2312,2314,2316],{"class":130,"line":715},[128,2313,2135],{"class":1794},[128,2315,1706],{"class":1798},[128,2317,1849],{"class":1794},[128,2319,2320,2322,2324],{"class":130,"line":721},[128,2321,1909],{"class":1794},[128,2323,1703],{"class":1798},[128,2325,1849],{"class":1794},[1692,2327,2329,2332],{"id":2328},"k4-l6-m8-27",[125,2330,2331],{},"k=.4, l=.6, m=.8"," (27%)",[118,2334,2336],{"className":1785,"code":2335,"language":1787,"meta":123,"style":123},"\u003Csection>\n  # Our Pizza\n  \u003Cdiv>\n    ## Margherita\n    A simple classic:\n    \u003Cbutton>Add\u003C/button>\n    ## Capricciosa\n    A rich taste:\n    \u003Cbutton>Add\u003C/button>\n  \u003C/div>\n\u003C/section>\n",[125,2337,2338,2346,2350,2358,2362,2367,2383,2387,2392,2408,2416],{"__ignoreMap":123},[128,2339,2340,2342,2344],{"class":130,"line":131},[128,2341,1795],{"class":1794},[128,2343,1703],{"class":1798},[128,2345,1849],{"class":1794},[128,2347,2348],{"class":130,"line":198},[128,2349,2219],{"class":236},[128,2351,2352,2354,2356],{"class":130,"line":262},[128,2353,1854],{"class":1794},[128,2355,1706],{"class":1798},[128,2357,1849],{"class":1794},[128,2359,2360],{"class":130,"line":322},[128,2361,2242],{"class":236},[128,2363,2364],{"class":130,"line":346},[128,2365,2366],{"class":236},"    A simple classic:\n",[128,2368,2369,2371,2373,2375,2377,2379,2381],{"class":130,"line":372},[128,2370,1897],{"class":1794},[128,2372,1993],{"class":1798},[128,2374,1903],{"class":1794},[128,2376,2008],{"class":236},[128,2378,1909],{"class":1794},[128,2380,1993],{"class":1798},[128,2382,1849],{"class":1794},[128,2384,2385],{"class":130,"line":399},[128,2386,2278],{"class":236},[128,2388,2389],{"class":130,"line":688},[128,2390,2391],{"class":236},"    A rich taste:\n",[128,2393,2394,2396,2398,2400,2402,2404,2406],{"class":130,"line":703},[128,2395,1897],{"class":1794},[128,2397,1993],{"class":1798},[128,2399,1903],{"class":1794},[128,2401,2008],{"class":236},[128,2403,1909],{"class":1794},[128,2405,1993],{"class":1798},[128,2407,1849],{"class":1794},[128,2409,2410,2412,2414],{"class":130,"line":715},[128,2411,2135],{"class":1794},[128,2413,1706],{"class":1798},[128,2415,1849],{"class":1794},[128,2417,2418,2420,2422],{"class":130,"line":721},[128,2419,1909],{"class":1794},[128,2421,1703],{"class":1798},[128,2423,1849],{"class":1794},[1692,2425,2427,2430],{"id":2426},"k-l0-m-35",[125,2428,2429],{},"k→∞, l=0, ∀m"," (35%)",[118,2432,2434],{"className":1785,"code":2433,"language":1787,"meta":123,"style":123},"# Our Pizza\n## Margherita\nA simple classic: mozzarela, tomatoes, and basil.\nAn everyday choice!\n\u003Cbutton>Add\u003C/button>\n## Capricciosa\nA rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\nA true favourite!\n\u003Cbutton>Add\u003C/button>\n",[125,2435,2436,2441,2446,2451,2456,2472,2477,2482,2487],{"__ignoreMap":123},[128,2437,2438],{"class":130,"line":131},[128,2439,2440],{"class":236},"# Our Pizza\n",[128,2442,2443],{"class":130,"line":198},[128,2444,2445],{"class":236},"## Margherita\n",[128,2447,2448],{"class":130,"line":262},[128,2449,2450],{"class":236},"A simple classic: mozzarela, tomatoes, and basil.\n",[128,2452,2453],{"class":130,"line":322},[128,2454,2455],{"class":236},"An everyday choice!\n",[128,2457,2458,2460,2462,2464,2466,2468,2470],{"class":130,"line":346},[128,2459,1795],{"class":1794},[128,2461,1993],{"class":1798},[128,2463,1903],{"class":1794},[128,2465,2008],{"class":236},[128,2467,1909],{"class":1794},[128,2469,1993],{"class":1798},[128,2471,1849],{"class":1794},[128,2473,2474],{"class":130,"line":372},[128,2475,2476],{"class":236},"## Capricciosa\n",[128,2478,2479],{"class":130,"line":399},[128,2480,2481],{"class":236},"A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n",[128,2483,2484],{"class":130,"line":688},[128,2485,2486],{"class":236},"A true favourite!\n",[128,2488,2489,2491,2493,2495,2497,2499,2501],{"class":130,"line":703},[128,2490,1795],{"class":1794},[128,2492,1993],{"class":1798},[128,2494,1903],{"class":1794},[128,2496,2008],{"class":236},[128,2498,1909],{"class":1794},[128,2500,1993],{"class":1798},[128,2502,1849],{"class":1794},[15,2504,2505,2506,2508,2509,2511],{},"Asymptotic ",[125,2507,1667],{}," (kind of 'infinite' ",[125,2510,1667],{},") completely flattens the DOM, that is, leads to a full content linearisation similar to reader views as present in most browsers. Notably, it preserves all interactive elements like buttons – which are essential for a web agent.",[420,2513,2515],{"id":2514},"adaptived2snap",[1532,2516,2517],{},"AdaptiveD2Snap",[15,2519,2520,2521,2523,2524,2526],{},"Fixed parameters might not be ideal for arbitrary DOMs – sourced from a landscape of web applications. We created ",[1532,2522,2517],{}," – a wrapper for ",[1532,2525,1623],{}," that infers suitable parameters from a given DOM in order to hit a certain token budget.",[420,2528,2530],{"id":2529},"implementation-integration","Implementation & Integration",[15,2532,2533,2534,2536],{},"Picture an LLM-based weg agent that is premised on DOM snapshots. Implementing ",[1532,2535,1623],{}," is simple: Deep clone the DOM, and feed it to the algorithm. Now, take the snapshot; this is, serialise the resulting DOM. Done.",[1680,2538,2539],{},[15,2540,2541,2542,2546],{},"Read our ",[64,2543,2545],{"href":2544},"/blog/a-gentle-introduction-to-ai-agents-for-the-web","gentle introduction to AI agents for the web"," to get started with high-level web agent concepts.",[15,2548,2549,2550,2552,2553,2558],{},"The open source ",[1532,2551,1623],{}," API, provided as a ",[64,2554,2557],{"href":2555,"rel":2556},"https://github.com/webfuse-com/D2Snap",[68],"package on GitHub"," provides the following signature:",[118,2560,2562],{"className":850,"code":2561,"language":852,"meta":123,"style":123},"type DOM = Document | Element | string;\ntype Options = {\n  assignUniqueIDs?: boolean; // false\n  debug?: boolean;           // true\n};\n\nD2Snap.d2Snap(\n  dom: DOM,\n  k: number, l: number, m: number,\n  options?: Options\n): Promise\u003Cstring>\n\nD2Snap.adaptiveD2Snap(\n  dom: DOM,\n  maxTokens: number = 4096,\n  maxIterations: number = 5,\n  options?: Options\n): Promise\u003Cstring>\n\n",[125,2563,2564,2593,2605,2624,2638,2643,2647,2658,2668,2685,2695,2710,2714,2725,2733,2745,2757,2765],{"__ignoreMap":123},[128,2565,2566,2569,2573,2575,2579,2582,2585,2587,2591],{"class":130,"line":131},[128,2567,2568],{"class":265},"type",[128,2570,2572],{"class":2571},"sXbZB"," DOM ",[128,2574,649],{"class":273},[128,2576,2578],{"class":2577},"s-DR7"," Document",[128,2580,2581],{"class":1794}," |",[128,2583,2584],{"class":2577}," Element",[128,2586,2581],{"class":1794},[128,2588,2590],{"class":2589},"scrte"," string",[128,2592,253],{"class":185},[128,2594,2595,2597,2600,2602],{"class":130,"line":198},[128,2596,2568],{"class":265},[128,2598,2599],{"class":2571}," Options ",[128,2601,649],{"class":273},[128,2603,2604],{"class":185}," {\n",[128,2606,2607,2611,2614,2617,2620],{"class":130,"line":262},[128,2608,2610],{"class":2609},"swl0y","  assignUniqueIDs",[128,2612,2613],{"class":1794},"?:",[128,2615,2616],{"class":2589}," boolean",[128,2618,2619],{"class":185},";",[128,2621,2623],{"class":2622},"sDmS1"," // false\n",[128,2625,2626,2629,2631,2633,2635],{"class":130,"line":322},[128,2627,2628],{"class":2609},"  debug",[128,2630,2613],{"class":1794},[128,2632,2616],{"class":2589},[128,2634,2619],{"class":185},[128,2636,2637],{"class":2622},"           // true\n",[128,2639,2640],{"class":130,"line":346},[128,2641,2642],{"class":185},"};\n",[128,2644,2645],{"class":130,"line":372},[128,2646,259],{"emptyLinePlaceholder":258},[128,2648,2649,2651,2653,2656],{"class":130,"line":399},[128,2650,1623],{"class":236},[128,2652,285],{"class":284},[128,2654,2655],{"class":134},"d2Snap",[128,2657,667],{"class":236},[128,2659,2660,2663,2666],{"class":130,"line":688},[128,2661,2662],{"class":236},"  dom: ",[128,2664,2665],{"class":711},"DOM",[128,2667,685],{"class":185},[128,2669,2670,2673,2675,2678,2680,2683],{"class":130,"line":703},[128,2671,2672],{"class":236},"  k: number",[128,2674,605],{"class":185},[128,2676,2677],{"class":236}," l: number",[128,2679,605],{"class":185},[128,2681,2682],{"class":236}," m: number",[128,2684,685],{"class":185},[128,2686,2687,2690,2692],{"class":130,"line":715},[128,2688,2689],{"class":236},"  options",[128,2691,2613],{"class":273},[128,2693,2694],{"class":236}," Options\n",[128,2696,2697,2700,2704,2706,2708],{"class":130,"line":721},[128,2698,2699],{"class":236},"): ",[128,2701,2703],{"class":2702},"s8Irk","Promise",[128,2705,1795],{"class":273},[128,2707,1114],{"class":236},[128,2709,1849],{"class":273},[128,2711,2712],{"class":130,"line":737},[128,2713,259],{"emptyLinePlaceholder":258},[128,2715,2716,2718,2720,2723],{"class":130,"line":742},[128,2717,1623],{"class":236},[128,2719,285],{"class":284},[128,2721,2722],{"class":134},"adaptiveD2Snap",[128,2724,667],{"class":236},[128,2726,2727,2729,2731],{"class":130,"line":1085},[128,2728,2662],{"class":236},[128,2730,2665],{"class":711},[128,2732,685],{"class":185},[128,2734,2735,2738,2740,2743],{"class":130,"line":1101},[128,2736,2737],{"class":236},"  maxTokens: number ",[128,2739,649],{"class":273},[128,2741,2742],{"class":210}," 4096",[128,2744,685],{"class":185},[128,2746,2747,2750,2752,2755],{"class":130,"line":1121},[128,2748,2749],{"class":236},"  maxIterations: number ",[128,2751,649],{"class":273},[128,2753,2754],{"class":210}," 5",[128,2756,685],{"class":185},[128,2758,2759,2761,2763],{"class":130,"line":1137},[128,2760,2689],{"class":236},[128,2762,2613],{"class":273},[128,2764,2694],{"class":236},[128,2766,2767,2769,2771,2773,2775],{"class":130,"line":1146},[128,2768,2699],{"class":236},[128,2770,2703],{"class":2702},[128,2772,1795],{"class":273},[128,2774,1114],{"class":236},[128,2776,1849],{"class":273},[15,2778,2779,2780,2782,2783,2788,2789,2794],{},"Moreover, ",[1532,2781,1623],{}," it is available on the ",[64,2784,2787],{"href":2785,"rel":2786},"https://dev.webfuse.com/automation-api",[68],"Webfuse Automation API",". ",[64,2790,2793],{"href":2791,"rel":2792},"https://www.webfuse.com",[68],"Webfuse"," essentially is a proxy to seamlessly serve any existing web application with custom augmentations, such as a web agent widget.",[118,2796,2800],{"className":2797,"code":2798,"language":2799,"meta":123,"style":123},"language-js shiki shiki-themes catppuccin-latte night-owl","const domSnapshot = await browser.webfuseSession\n    .automation\n    .take_dom_snapshot({ modifier: 'downsample' })\n","js",[125,2801,2802,2807,2812],{"__ignoreMap":123},[128,2803,2804],{"class":130,"line":131},[128,2805,2806],{},"const domSnapshot = await browser.webfuseSession\n",[128,2808,2809],{"class":130,"line":198},[128,2810,2811],{},"    .automation\n",[128,2813,2814],{"class":130,"line":262},[128,2815,2816],{},"    .take_dom_snapshot({ modifier: 'downsample' })\n",[15,2818,2819,2820,2822],{},"Need precise control over the underlying ",[1532,2821,1623],{}," invocation? Configure it exactly how you want:",[118,2824,2826],{"className":2797,"code":2825,"language":2799,"meta":123,"style":123},"const domSnapshot = await browser.webfuseSession\n    .automation\n    .take_dom_snapshot({\n        modifier: {\n            name: 'D2Snap',\n            params: { hierarchyRatio: 0.6, textRatio: 0.2, attributeRatio: 0.8 }\n        }\n    })\n",[125,2827,2828,2832,2836,2841,2846,2851,2856,2861],{"__ignoreMap":123},[128,2829,2830],{"class":130,"line":131},[128,2831,2806],{},[128,2833,2834],{"class":130,"line":198},[128,2835,2811],{},[128,2837,2838],{"class":130,"line":262},[128,2839,2840],{},"    .take_dom_snapshot({\n",[128,2842,2843],{"class":130,"line":322},[128,2844,2845],{},"        modifier: {\n",[128,2847,2848],{"class":130,"line":346},[128,2849,2850],{},"            name: 'D2Snap',\n",[128,2852,2853],{"class":130,"line":372},[128,2854,2855],{},"            params: { hierarchyRatio: 0.6, textRatio: 0.2, attributeRatio: 0.8 }\n",[128,2857,2858],{"class":130,"line":399},[128,2859,2860],{},"        }\n",[128,2862,2863],{"class":130,"line":688},[128,2864,2865],{},"    })\n",[420,2867,2869],{"id":2868},"performance-evaluation","Performance Evaluation",[15,2871,2872,2873,2875,2876,2878,2879,2881],{},"Now for the moment of truth: How does ",[1532,2874,1623],{}," stack up against the industry standard? We evaluated ",[1532,2877,1623],{}," in comparison to a grounded GUI snapshot baseline close to those used by ",[1532,2880,1503],{}," – coloured bounding boxes around visible interactive elements.",[15,2883,2884,2885,2890],{},"To evaluate snapshots isolated from specific agent logic, we crafted a dataset that spans all UI states that occur while solving a related task. We sampled our dataset from the existing ",[64,2886,2889],{"href":2887,"rel":2888},"https://github.com/OSU-NLP-Group/Online-Mind2Web",[68],"Online-Mind2Web"," dataset.",[52,2892],{":width":2893,"alt":2894,"format":94,"loading":57,"src":2895},"800","Exemplary solution UI state trajectory of a defined web-based task","/blog/dom-downsampling-for-web-agents/3.png",[15,2897,2898],{},[1547,2899,2900],{},"Exemplary solution UI state trajectory for the task: “View the pricing plan for 'Business'. Specifically, we have 100 users. We need a 1PB storage quota and a 50 TB transfer quota.”",[15,2902,2903],{},"These are our key findings...",[1692,2905,2907],{"id":2906},"substantial-success-rates","Substantial Success Rates",[15,2909,2910,2911,2913],{},"The results exceeded our expectations. Not only did ",[1532,2912,1623],{}," meet the baseline's performance – our best configuration outperformed it by a significant margin. Full linearisation matches performance, and estimated model input token size order of the baseline.",[52,2915],{":width":2916,"alt":2917,"format":94,"loading":57,"src":2918},"550","Success rate per web agent snapshot subject evaluated across the dataset","/blog/dom-downsampling-for-web-agents/4.png",[1547,2920,2921,2922,2929,2930,2932,2933,2936,2937,2940,2941,2944,2945,2948,2949,2952,2953,2956],{},"\n  Success rate per web agent snapshot subject evaluated across the dataset.\n  Labels: ",[125,2923,2924,2925],{},"GUI",[2926,2927,2928],"sub",{}," gr.",": Baseline, ",[125,2931,2665],{},": Raw DOM (cut-off at ~8K tokens), ",[125,2934,2935],{},"k( l m)",": Parameter values; e.g., ",[125,2938,2939],{},".9 .3 .6",", or ",[125,2942,2943],{},".4"," if equal). ",[125,2946,2947],{},"∞",": Linearisation,  ",[125,2950,2951],{},"8192 / 32768",": via token-limited (resp.) ",[2954,2955,2517],"i",{},".\n",[1692,2958,2960],{"id":2959},"containable-token-and-byte-size","Containable Token and Byte Size",[15,2962,2963,2964,2966],{},"Even light downsampling delivers dramatic size reductions. Most ",[1532,2965,1623],{}," configurations average just one token order above the baseline – a massive improvement over raw DOM snapshots. Better yet, most DOMs from the dataset could actually be downsampled to the baseline order. And while image data balloons in file size, our text-based approach stays lean and efficient.",[52,2968],{":width":2893,"alt":2969,"format":94,"loading":57,"src":2970},"Comparison of mean input size across and per subject","/blog/dom-downsampling-for-web-agents/5.png",[1547,2972,2973,2974,2977,2978,2980],{},"\n  Left: Comparison of mean input size (tokens vs bytes) across and per subject.",[2975,2976],"br",{},"\n  Right: Estimated input token size across the dataset created by a single ",[2954,2979,1623],{}," evaluation subject.\n",[1692,2982,2984],{"id":2983},"hierarchy-actually-matters","Hierarchy Actually Matters",[15,2986,2987],{},"Which UI feature matters most for LLM web agent backend performance? We alternated parameter configurations to find out. Interestingly, hierarchy reveals itself as the strongest of the three assessed features. Element extraction throws away hierarchy, which suggests that downsampling is a superior technique.",[1703,2989,2992,2997],{"className":2990,"dataFootnotes":123},[2991],"footnotes",[84,2993,2996],{"className":2994,"id":1564},[2995],"sr-only","Footnotes",[1573,2998,2999,3014,3025,3036],{},[768,3000,3002,3006,3007],{"id":3001},"user-content-fn-1",[64,3003,3004],{"href":3004,"rel":3005},"https://arxiv.org/abs/2210.03945",[68]," ",[64,3008,3013],{"href":3009,"ariaLabel":3010,"className":3011,"dataFootnoteBackref":123},"#user-content-fnref-1","Back to reference 1",[3012],"data-footnote-backref","↩",[768,3015,3017,3006,3020],{"id":3016},"user-content-fn-2",[64,3018,1629],{"href":1629,"rel":3019},[68],[64,3021,3013],{"href":3022,"ariaLabel":3023,"className":3024,"dataFootnoteBackref":123},"#user-content-fnref-2","Back to reference 2",[3012],[768,3026,3028,3006,3031],{"id":3027},"user-content-fn-3",[64,3029,2555],{"href":2555,"rel":3030},[68],[64,3032,3013],{"href":3033,"ariaLabel":3034,"className":3035,"dataFootnoteBackref":123},"#user-content-fnref-3","Back to reference 3",[3012],[768,3037,3039,3006,3043],{"id":3038},"user-content-fn-4",[64,3040,3041],{"href":3041,"rel":3042},"https://aclanthology.org/W04-3252",[68],[64,3044,3013],{"href":3045,"ariaLabel":3046,"className":3047,"dataFootnoteBackref":123},"#user-content-fnref-4","Back to reference 4",[3012],[1422,3049,3050],{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s9rnR, html code.shiki .s9rnR{--shiki-default:#179299;--shiki-dark:#7FDBCA}html pre.shiki code .sY2RG, html code.shiki .sY2RG{--shiki-default:#1E66F5;--shiki-dark:#CAECE6}html pre.shiki code .swkLt, html code.shiki .swkLt{--shiki-default:#DF8E1D;--shiki-default-font-style:inherit;--shiki-dark:#C5E478;--shiki-dark-font-style:italic}html pre.shiki code .sbuKk, html code.shiki .sbuKk{--shiki-default:#40A02B;--shiki-dark:#D9F5DD}html pre.shiki code .sfrMT, html code.shiki .sfrMT{--shiki-default:#40A02B;--shiki-dark:#ECC48D}html pre.shiki code .s2kId, html code.shiki .s2kId{--shiki-default:#4C4F69;--shiki-dark:#D6DEEB}html pre.shiki code .s76yb, html code.shiki .s76yb{--shiki-default:#8839EF;--shiki-dark:#C792EA}html pre.shiki code .sXbZB, html code.shiki .sXbZB{--shiki-default:#DF8E1D;--shiki-default-font-style:italic;--shiki-dark:#D6DEEB;--shiki-dark-font-style:inherit}html pre.shiki code .s-_ek, html code.shiki .s-_ek{--shiki-default:#179299;--shiki-dark:#C792EA}html pre.shiki code .s-DR7, html code.shiki .s-DR7{--shiki-default:#DF8E1D;--shiki-default-font-style:italic;--shiki-dark:#FFCB8B;--shiki-dark-font-style:inherit}html pre.shiki code .scrte, html code.shiki .scrte{--shiki-default:#8839EF;--shiki-dark:#C5E478}html pre.shiki code .scGhl, html code.shiki .scGhl{--shiki-default:#7C7F93;--shiki-dark:#D6DEEB}html pre.shiki code .swl0y, html code.shiki .swl0y{--shiki-default:#4C4F69;--shiki-default-font-style:italic;--shiki-dark:#D6DEEB;--shiki-dark-font-style:inherit}html pre.shiki code .sDmS1, html code.shiki .sDmS1{--shiki-default:#7C7F93;--shiki-default-font-style:italic;--shiki-dark:#637777;--shiki-dark-font-style:italic}html pre.shiki code .s5FwJ, html code.shiki .s5FwJ{--shiki-default:#179299;--shiki-default-font-style:inherit;--shiki-dark:#C792EA;--shiki-dark-font-style:italic}html pre.shiki code .sNstc, html code.shiki .sNstc{--shiki-default:#1E66F5;--shiki-default-font-style:italic;--shiki-dark:#82AAFF;--shiki-dark-font-style:italic}html pre.shiki code .sqxXB, html code.shiki .sqxXB{--shiki-default:#4C4F69;--shiki-dark:#82AAFF}html pre.shiki code .s8Irk, html code.shiki .s8Irk{--shiki-default:#DF8E1D;--shiki-default-font-style:italic;--shiki-dark:#C5E478;--shiki-dark-font-style:inherit}html pre.shiki code .sZ_Zo, html code.shiki .sZ_Zo{--shiki-default:#FE640B;--shiki-dark:#F78C6C}",{"title":123,"searchDepth":198,"depth":198,"links":3052},[3053,3057,3058,3065],{"id":1511,"depth":198,"text":1512,"children":3054},[3055,3056],{"id":1522,"depth":262,"text":1523},{"id":1552,"depth":262,"text":1553},{"id":1603,"depth":198,"text":1604},{"id":1620,"depth":198,"text":1623,"children":3059},[3060,3061,3062,3063,3064],{"id":1657,"depth":262,"text":1658},{"id":1778,"depth":262,"text":1779},{"id":2514,"depth":262,"text":2517},{"id":2529,"depth":262,"text":2530},{"id":2868,"depth":262,"text":2869},{"id":1564,"depth":198,"text":2996},"2025-08-18","We propose D2Snap – a first-of-its-kind downsampling algorithm for DOMs. D2Snap can be used as a pre-processing technique for DOM snapshots to optimise web agency context quality and token costs.",{"homepage":258,"relatedLinks":3069},[3070,3074,3077],{"text":3071,"href":3072,"description":3073},"What is a Website Snapshot?","/blog/snapshots-provide-llms-with-website-state","Learn what a website snapshot is and how to utilise it for web agents",{"text":3075,"href":2544,"description":3076},"What is a Web Agent?","Learn the basics of web agents",{"text":2787,"href":3078,"external":258,"description":3079},"https://dev.webfuse.com/automation-api#take_dom_snapshot","Check out the Webfuse Automation API","/blog/dom-downsampling-for-llm-based-web-agents",{"title":1477,"description":3067},{"loc":3080},"blog/1012.dom-downsampling-for-llm-based-web-agents",[1437,3085,3086,3087,3088,3089],"browser-agents","llms","llm-context","web-agents","web-automation","bGJtg_9k7O95O2CJswaRFj4ONGhX4hGr_8aL5dhDZms",{"id":3092,"title":3093,"authorId":1478,"body":3094,"category":1437,"created":3819,"description":3820,"extension":1440,"faqs":1452,"featurePriority":198,"head":1452,"landingPath":1452,"meta":3821,"navigation":258,"ogImage":1452,"path":2544,"robots":1452,"schemaOrg":1452,"seo":3830,"sitemap":3831,"stem":3832,"tags":3833,"__hash__":3834},"blog/blog/1011.a-gentle-introduction-to-ai-agents-for-the-web.md","A Gentle Introduction to AI Agents for the Web",{"type":8,"value":3095,"toc":3800},[3096,3110,3113,3120,3126,3130,3133,3148,3152,3162,3166,3170,3183,3187,3191,3194,3199,3203,3212,3216,3227,3232,3236,3254,3258,3264,3364,3367,3600,3616,3620,3623,3628,3632,3635,3639,3657,3682,3689,3693,3731,3734,3745,3749,3752,3780,3784,3792,3797],[15,3097,3098,3099,1493,3103,1671,3106,3109],{},"In no time, AI became a natural part of modern web interfaces. AI agents for the web enjoy a recent hype, sparked by the means of ",[64,3100,1492],{"href":3101,"rel":3102},"https://openai.com/index/introducing-operator/",[68],[64,3104,1498],{"href":1496,"rel":3105},[68],[64,3107,1503],{"href":1501,"rel":3108},[68],". By now, it is within reach to automate arbitrary web-based tasks, such as booking the cheapest flight from Berlin to Amsterdam.",[84,3111,3075],{"id":3112},"what-is-a-web-agent",[15,3114,3115,3116,3119],{},"For starters, let us break down the term ",[18,3117,3118],{},"web AI agent",": An agent is an entity that autonomously acts on behalf of another entity. An artificially intelligent agent is an application that acts on behalf of a human. In contrast to non-AI computer agents, it solves complex tasks with at least human-grade effectiveness and efficiency. For a human-centric web, web agents have deliberately been designed to browse the web in a human fashion – through UIs rather than APIs.",[52,3121],{":width":3122,"alt":3123,"format":3124,"loading":57,"src":3125},"610","High-level agent description comparing human and computer agents","svg","/blog/a-gentle-introduction-to-ai-agents-for-the-web/1.svg",[420,3127,3129],{"id":3128},"the-role-of-frontier-llms","The Role of Frontier LLMs",[15,3131,3132],{},"Web agents have been a vague desire for a long time. AI agents used to rely on complete models of a problem domain in order to allow (heuristic) search through problem states. Such models would comprise the problem world (e.g., a chessboard), actors (pawns, rooks, etc.), possible actions per actor (rook moves straight), and constraints (i.a., max one piece per field). A heterogeneous space of web application UIs describes the problem domain of a web agent: how to understand a web page, and how to interact with it to solve the declared task?",[15,3134,3135,3136,3143,3144,3147],{},"Frontier LLMs disrupted the AI agent world: explicit problem domain models beyond feasibility can now be replaced by an LLM. The LLM thereby acts as an instantaneous domain model backend that can be consulted with twofold context: serialised problem state, such as a chess position code (",[1532,3137,3138,3139,3142],{},"“",[128,3140,3141],{},"..."," e4 e5 2. Nc3 f5”","), and the respective task (",[1532,3145,3146],{},"“What is the best move for white?”","). For web agents, problem state corresponds to the currently browsed web application's runtime state, for instance, a screenshot.",[420,3149,3151],{"id":3150},"generalist-web-agents","Generalist Web Agents",[15,3153,3154,3155,1671,3158,3161],{},"Generalist web agents are supposed to solve arbitrary tasks through a web browser. Web-based tasks can be as diverse as ",[1532,3156,3157],{},"“Find a picture of a cat.”",[1532,3159,3160],{},"“Book the cheapest flight from Berlin to Amsterdam tomorrow afternoon (business class, window seat).”"," In reality, generalist agents still fail uncommon or too precise tasks. While they have been critically acclaimed, they mainly act as early proofs-of-concept. Tasks that are indeed solvable with a generalist agent promise great results with an according specialist agent.",[52,3163],{":width":1483,"alt":3164,"format":94,"loading":57,"src":3165},"Screenshot of a generalist web agent UI (Director)","/blog/a-gentle-introduction-to-ai-agents-for-the-web/2.png",[420,3167,3169],{"id":3168},"specialist-web-agents","Specialist Web Agents",[15,3171,3172,3173,3176,3177,3182],{},"Other than generalist agents, specialist web agents are constrained to a certain task and application domain. Specialist agents bear the major share of commercial value. Most prominently, modal chat agents that provide users with on-page help. Picture a little floating widget that can be chatted to via text or voice input. In most cases, in fact, the term ",[1532,3174,3175],{},"web (AI) agent"," refers to chat agents. Chat agents – text or voice – can be implemented on top of virtually any existing website. Frontier LLMs provide a lot of commonsense out-of-the-box. A ",[64,3178,3181],{"href":3179,"rel":3180},"https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/system-prompts",[68],"system prompt"," can, moreover, be leveraged to drive specialist agent quality for the respective problem domain.",[52,3184],{":width":1483,"alt":3185,"format":94,"loading":57,"src":3186},"Screenshots of two modal specialist web agent UIs augmenting an underlying website's UI","/blog/a-gentle-introduction-to-ai-agents-for-the-web/3.png",[84,3188,3190],{"id":3189},"how-does-a-web-agent-work","How Does a Web Agent Work?",[15,3192,3193],{},"LLM-based web agents are premised on a more or less uniform architecture. The agent application embodies a mediator between a web browser (environment), and the LLM backend (model).",[52,3195],{":width":3196,"alt":3197,"format":3124,"loading":57,"src":3198},"480","High-level web agent architecture component view","/blog/a-gentle-introduction-to-ai-agents-for-the-web/4.svg",[420,3200,3202],{"id":3201},"the-agent-lifecycle","The Agent Lifecycle",[15,3204,3205,3206,3211],{},"To reduce a user's cognitive load, solving a web-based task is usually chunked into a sequence of UI states. Consider looking for rental apartments on ",[64,3207,3210],{"href":3208,"rel":3209},"https://www.redfin.com",[68],"redfin.com",": In the first step, you specify a location. Only subsequently are you provided with a grid of available apartments for that location.",[52,3213],{":width":1483,"alt":3214,"format":94,"loading":57,"src":3215},"Example of separated UI states in a rental home search application","/blog/a-gentle-introduction-to-ai-agents-for-the-web/5.png",[15,3217,3218,3219,3226],{},"Web agent logic is iterative; not least for a sequential web interaction model, but also for a conversational agent interaction model. Browsing the web, human and computer agents represent users alike. That said, Norman's well-known ",[64,3220,3223],{"href":3221,"rel":3222},"https://mitpress.mit.edu/9780262640374/the-design-of-everyday-things/",[68],[1532,3224,3225],{},"Seven Stages of Action",", which hierarchically model the human cognition cycle, transfer to the web agent lifecycle. For each UI state in a web browser (environment) and web-based task (action intention); decide where to click, type, etc. (action planning), and perform those clicks, etc. (action execution). Afterwards, perceive, interpret, and evaluate the results of those actions in the web browser (state). As long as there is a mismatch between the evaluated state and the declared goal state, repeat that cycle. Potentially prompt the user with more required information.",[52,3228],{":width":3229,"alt":3230,"format":3124,"loading":57,"src":3231},"580","Donald 'Norman's Seven Stages of Action' model of the human cognition cycle that transfers to non-human agents","/blog/a-gentle-introduction-to-ai-agents-for-the-web/6.svg",[420,3233,3235],{"id":3234},"web-context-for-llms","Web Context for LLMs",[15,3237,3238,3239,3241,3242,3245,3246,3249,3250,3253],{},"The gap from an agent towards the environment, according to ",[1532,3240,3225],{},", is known as the ",[1532,3243,3244],{},"gulf of execution",". In real-world scenarios, how to act in the environment in respect to a planned sequence of actions might be difficult (e.g., how to actually open the trunk of a new car?). Arguably, web agents face a novel ",[1532,3247,3248],{},"gulf of intention"," towards the action planning stage: how to serialise a currently browsed web page's runtime state for LLMs? ",[1532,3251,3252],{},"Snapshot"," is a more comprehensive term to describe the serialisation of a web page's current runtime state. Screenshots, for instance, represent a type of snapshot that closely resembles how humans perceive a web page at a given point in time. But are they as accessible to LLMs?",[420,3255,3257],{"id":3256},"agentic-ui-interaction","Agentic UI Interaction",[15,3259,3260,3261,3263],{},"With a qualified set of well-defined actuation methods, web agents are able to close the ",[1532,3262,3244],{}," quite well. HTML element types strongly afford a certain action (e.g., click a button, type to a field). Below is how an actuation schema to present the LLM backend with could look like:",[118,3265,3267],{"className":850,"code":3266,"language":852,"meta":123,"style":123},"interface ActuationSchema = {\n    thought: string;\n    action: \"click\"\n        | \"scroll\"\n        | \"type\";\n    cssSelector: string;\n    data?: string;\n}[];\n",[125,3268,3269,3282,3293,3309,3321,3333,3344,3355],{"__ignoreMap":123},[128,3270,3271,3274,3277,3280],{"class":130,"line":131},[128,3272,3273],{"class":265},"interface",[128,3275,3276],{"class":2571}," ActuationSchema",[128,3278,3279],{"class":236}," = ",[128,3281,1098],{"class":185},[128,3283,3284,3287,3289,3291],{"class":130,"line":198},[128,3285,3286],{"class":236},"    thought",[128,3288,302],{"class":1794},[128,3290,2590],{"class":2589},[128,3292,253],{"class":185},[128,3294,3295,3298,3300,3302,3306],{"class":130,"line":262},[128,3296,3297],{"class":236},"    action",[128,3299,302],{"class":1794},[128,3301,305],{"class":243},[128,3303,3305],{"class":3304},"sgAC-","click",[128,3307,3308],{"class":243},"\"\n",[128,3310,3311,3314,3316,3319],{"class":130,"line":322},[128,3312,3313],{"class":1794},"        |",[128,3315,305],{"class":243},[128,3317,3318],{"class":3304},"scroll",[128,3320,3308],{"class":243},[128,3322,3323,3325,3327,3329,3331],{"class":130,"line":346},[128,3324,3313],{"class":1794},[128,3326,305],{"class":243},[128,3328,2568],{"class":3304},[128,3330,311],{"class":243},[128,3332,253],{"class":185},[128,3334,3335,3338,3340,3342],{"class":130,"line":372},[128,3336,3337],{"class":236},"    cssSelector",[128,3339,302],{"class":1794},[128,3341,2590],{"class":2589},[128,3343,253],{"class":185},[128,3345,3346,3349,3351,3353],{"class":130,"line":399},[128,3347,3348],{"class":236},"    data",[128,3350,2613],{"class":1794},[128,3352,2590],{"class":2589},[128,3354,253],{"class":185},[128,3356,3357,3359,3362],{"class":130,"line":688},[128,3358,867],{"class":185},[128,3360,3361],{"class":236},"[]",[128,3363,253],{"class":185},[15,3365,3366],{},"And a suggested actions response could, in turn, look as follows:",[118,3368,3372],{"className":3369,"code":3370,"language":3371,"meta":123,"style":123},"language-json shiki shiki-themes catppuccin-latte night-owl","[\n    {\n        \"thought\": \"Scroll newsletter cta into view\",\n        \"action\": \"scroll\",\n        \"cssSelector\": \"section#newsletter\"\n    },\n    {\n        \"thought\": \"Type email address to newsletter cta\",\n        \"action\": \"type\",\n        \"cssSelector\": \"section#newsletter > input\",\n        \"data\": \"user@example.org\"\n    },\n    {\n        \"thought\": \"Submit newsletter sign up\",\n        \"action\": \"click\",\n        \"cssSelector\": \"section#newsletter > button\"\n    }\n]\n","json",[125,3373,3374,3379,3384,3408,3427,3445,3450,3454,3473,3491,3510,3528,3532,3536,3555,3573,3590,3595],{"__ignoreMap":123},[128,3375,3376],{"class":130,"line":131},[128,3377,3378],{"class":185},"[\n",[128,3380,3381],{"class":130,"line":198},[128,3382,3383],{"class":185},"    {\n",[128,3385,3386,3390,3394,3396,3398,3400,3404,3406],{"class":130,"line":262},[128,3387,3389],{"class":3388},"srFR9","        \"",[128,3391,3393],{"class":3392},"s30W1","thought",[128,3395,311],{"class":3388},[128,3397,302],{"class":185},[128,3399,305],{"class":243},[128,3401,3403],{"class":3402},"sCC8C","Scroll newsletter cta into view",[128,3405,311],{"class":243},[128,3407,685],{"class":185},[128,3409,3410,3412,3415,3417,3419,3421,3423,3425],{"class":130,"line":322},[128,3411,3389],{"class":3388},[128,3413,3414],{"class":3392},"action",[128,3416,311],{"class":3388},[128,3418,302],{"class":185},[128,3420,305],{"class":243},[128,3422,3318],{"class":3402},[128,3424,311],{"class":243},[128,3426,685],{"class":185},[128,3428,3429,3431,3434,3436,3438,3440,3443],{"class":130,"line":346},[128,3430,3389],{"class":3388},[128,3432,3433],{"class":3392},"cssSelector",[128,3435,311],{"class":3388},[128,3437,302],{"class":185},[128,3439,305],{"class":243},[128,3441,3442],{"class":3402},"section#newsletter",[128,3444,3308],{"class":243},[128,3446,3447],{"class":130,"line":372},[128,3448,3449],{"class":185},"    },\n",[128,3451,3452],{"class":130,"line":399},[128,3453,3383],{"class":185},[128,3455,3456,3458,3460,3462,3464,3466,3469,3471],{"class":130,"line":688},[128,3457,3389],{"class":3388},[128,3459,3393],{"class":3392},[128,3461,311],{"class":3388},[128,3463,302],{"class":185},[128,3465,305],{"class":243},[128,3467,3468],{"class":3402},"Type email address to newsletter cta",[128,3470,311],{"class":243},[128,3472,685],{"class":185},[128,3474,3475,3477,3479,3481,3483,3485,3487,3489],{"class":130,"line":703},[128,3476,3389],{"class":3388},[128,3478,3414],{"class":3392},[128,3480,311],{"class":3388},[128,3482,302],{"class":185},[128,3484,305],{"class":243},[128,3486,2568],{"class":3402},[128,3488,311],{"class":243},[128,3490,685],{"class":185},[128,3492,3493,3495,3497,3499,3501,3503,3506,3508],{"class":130,"line":715},[128,3494,3389],{"class":3388},[128,3496,3433],{"class":3392},[128,3498,311],{"class":3388},[128,3500,302],{"class":185},[128,3502,305],{"class":243},[128,3504,3505],{"class":3402},"section#newsletter > input",[128,3507,311],{"class":243},[128,3509,685],{"class":185},[128,3511,3512,3514,3517,3519,3521,3523,3526],{"class":130,"line":721},[128,3513,3389],{"class":3388},[128,3515,3516],{"class":3392},"data",[128,3518,311],{"class":3388},[128,3520,302],{"class":185},[128,3522,305],{"class":243},[128,3524,3525],{"class":3402},"user@example.org",[128,3527,3308],{"class":243},[128,3529,3530],{"class":130,"line":737},[128,3531,3449],{"class":185},[128,3533,3534],{"class":130,"line":742},[128,3535,3383],{"class":185},[128,3537,3538,3540,3542,3544,3546,3548,3551,3553],{"class":130,"line":1085},[128,3539,3389],{"class":3388},[128,3541,3393],{"class":3392},[128,3543,311],{"class":3388},[128,3545,302],{"class":185},[128,3547,305],{"class":243},[128,3549,3550],{"class":3402},"Submit newsletter sign up",[128,3552,311],{"class":243},[128,3554,685],{"class":185},[128,3556,3557,3559,3561,3563,3565,3567,3569,3571],{"class":130,"line":1101},[128,3558,3389],{"class":3388},[128,3560,3414],{"class":3392},[128,3562,311],{"class":3388},[128,3564,302],{"class":185},[128,3566,305],{"class":243},[128,3568,3305],{"class":3402},[128,3570,311],{"class":243},[128,3572,685],{"class":185},[128,3574,3575,3577,3579,3581,3583,3585,3588],{"class":130,"line":1121},[128,3576,3389],{"class":3388},[128,3578,3433],{"class":3392},[128,3580,311],{"class":3388},[128,3582,302],{"class":185},[128,3584,305],{"class":243},[128,3586,3587],{"class":3402},"section#newsletter > button",[128,3589,3308],{"class":243},[128,3591,3592],{"class":130,"line":1137},[128,3593,3594],{"class":185},"    }\n",[128,3596,3597],{"class":130,"line":1146},[128,3598,3599],{"class":185},"]\n",[1680,3601,3602],{},[15,3603,3604,3609,3610,3615],{},[64,3605,3608],{"href":3606,"rel":3607},"https://platform.openai.com/docs/guides/function-calling",[68],"Function Calling"," and the ",[64,3611,3614],{"href":3612,"rel":3613},"https://modelcontextprotocol.io",[68],"Model Context Protocol"," represent two ends to outsource an explicit actuation model – server- and client-side, respectively.",[420,3617,3619],{"id":3618},"agentic-ui-augmentation","Agentic UI Augmentation",[15,3621,3622],{},"An agent represents yet another feature to integrate with an application and its UI. Discoverability and availability, however, are among the most fundamental requirements of a web agent. Evidently, when a user experiences UI/UX friction, at least the agent should be interactive. That said, a scrolling modal web agent UI has been the go-to approach, that is, a little floating widget on top of the underlying application's UI. It comes with a major advantage: the agent application can be decoupled from the underlying, self-contained application.",[52,3624],{":width":3625,"alt":3626,"format":3124,"loading":57,"src":3627},"360","Depiction of a web agent application augmenting an underlying application in an isolated layer","/blog/a-gentle-introduction-to-ai-agents-for-the-web/7.svg",[84,3629,3631],{"id":3630},"how-to-build-a-web-agent","How to Build a Web Agent?",[15,3633,3634],{},"Believe it or not: enhancing an existing web application with a purposeful agent is a lower-hanging fruit. The evolving agent ecosystem provides you with a spectrum of solutions: instantly use a pre-compiled agent, tweak a templated agent, or develop an agent from scratch. Either way, LLMs and web browsers exist for reuse, boiling down agent development to LLM context engineering, and UI augmentation.",[420,3636,3638],{"id":3637},"develop-a-web-agent","Develop a Web Agent",[15,3640,3641,3642,3645,3646,1671,3651,3656],{},"Opting for a ",[18,3643,3644],{},"pre-compiled agent"," does not necessarily involve any actual development step. Instead, pre-compiled agents allow for high-level configuration through an agent-as-a-service provider's interface. Popular agent-as-a-service providers are, i.a., ",[64,3647,3650],{"href":3648,"rel":3649},"https://elevenlabs.io/conversational-ai",[68],"ElevenLabs",[64,3652,3655],{"href":3653,"rel":3654},"https://www.intercom.com/drlp/ai-agent",[68],"Intercom",". Serviced agents hide LLM communication and potentially interaction with a web browser behind the configuration interface.",[15,3658,3659,3660,3663,3664,3669,3670,3675,3676,3681],{},"Using a ",[18,3661,3662],{},"templated agent"," resembles the agent-as-a-service approach on a lower level. Openly sourced from a ",[64,3665,3668],{"href":3666,"rel":3667},"https://github.com/webfuse-com/agent-extension-blueprint",[68],"code repository",", templated agents allow for any kind of development tweaks. Favourably, agent templates shortcut integration with ",[64,3671,3674],{"href":3672,"rel":3673},"https://openai.com/api/",[68],"LLM APIs"," and web ",[64,3677,3680],{"href":3678,"rel":3679},"https://developer.mozilla.org/en-US/docs/Web/API",[68],"browser APIs",". Using a templated agent usually represents the preferable, best-of-both-worlds approach; common- and best-practice code snippets are available from the beginning, but everything can be customised as desired.",[15,3683,3684,3685,3688],{},"Of course, developing an ",[18,3686,3687],{},"agent from scratch"," is always an option. It is preferable whenever agent requirements deviate to a large extent from what exists in the service or template landscape.",[420,3690,3692],{"id":3691},"deploy-a-web-agent","Deploy a Web Agent",[15,3694,3695,3696,104,3701,3706,3707,3712,3713,3718,3719,3724,3725,3730],{},"When web agent code lives side-by-side with the augmented application's code, agent deployment is covered by a generic pipeline. Something like: ",[64,3697,3700],{"href":3698,"rel":3699},"https://eslint.org",[68],"linting",[64,3702,3705],{"href":3703,"rel":3704},"https://prettier.io",[68],"formatting"," agent code, ",[64,3708,3711],{"href":3709,"rel":3710},"https://esbuild.github.io",[68],"transpiling and bundling"," agent modules, ",[64,3714,3717],{"href":3715,"rel":3716},"https://www.cypress.io",[68],"testing"," agent, ",[64,3720,3723],{"href":3721,"rel":3722},"https://pages.cloudflare.com",[68],"hosting"," agent bundle, and ",[64,3726,3729],{"href":3727,"rel":3728},"https://docs.github.com/en/actions/get-started/continuous-integration",[68],"tiggering"," post deployment events. In that case, an agent represents a modular feature component in the application, no different than, for instance, a sign-up component.",[15,3732,3733],{},"Web agent source code right inside the application codebase comes at a cost:",[765,3735,3736,3739,3742],{},[768,3737,3738],{},"Agent developers can manipulate the source code of the underlying application.",[768,3740,3741],{},"Agent functionality could introduce side effects on the underlying application.",[768,3743,3744],{},"Agent changes require deployment of the entire application.",[420,3746,3748],{"id":3747},"best-practices-of-agentic-ux","Best Practices of Agentic UX",[15,3750,3751],{},"When designing user experiences for agent-enhanced applications, there are a few things to consider:",[765,3753,3754,3755,3754,3764,3754,3772],{},"\n    ",[768,3756,3757,3758,3757,3761,3763],{},"\n        ",[18,3759,3760],{},"Stream input and output to reduce latency",[2975,3762],{},"\n        LLMs (re-)introduce noticeable communication round-trip time. To reduce wait time for the human user, stream chunks of data whenever they are available.\n    ",[768,3765,3757,3766,3757,3769,3771],{},[18,3767,3768],{},"Provide fine-grained feedback to bridge high-latency",[2975,3770],{},"\n        Human attention is sensitive to several seconds of [system response time](https://www.nngroup.com/articles/response-times-3-important-limits/). Periodically provide agent _thoughts_ as feedback to perceptibly break down round-trip time.\n    ",[768,3773,3757,3774,3757,3777,3779],{},[18,3775,3776],{},"Always prompt the human user for consent to perform critical actions",[2975,3778],{},"\n        Some actions in a web application lead to irreversible or significant changes of state. Never have the agent perform such actions on behalf of the user without explicitly asking for the permission.\n    ",[420,3781,3783],{"id":3782},"non-invasive-web-agents-with-webfuse","Non-Invasive Web Agents with Webfuse",[15,3785,3786,3791],{},[64,3787,3789],{"href":2791,"rel":3788},[68],[18,3790,2793],{}," is a configurable web proxy that lets you augment any web application. As pictured, web agents represent highly self-contained applications. Moreover, web agents and underlying applications communicate at runtime in the client. This does, in fact, render opportunities to bridge the above-mentioned drawbacks with Webfuse: Develop web agents with a sandbox extension methodology, and deploy them through the low-latency proxy layer. On demand, seamlessly serve users with your agent-enhanced website. Benefit from information hiding, safe code, and fewer deployments.",[428,3793],{":demoAction":3794,"heading":3795,"subtitle":3796},"{\"text\":\"Read more\",\"showIcon\":false,\"href\":\"https://www.webfuse.com/blog/category/ai-agents\"}","Deploy Web Agents with Webfuse","Develop or deploy web agents in minutes; serve agent-enhanced websites through an isolated application layer.",[1422,3798,3799],{},"html pre.shiki code .s76yb, html code.shiki .s76yb{--shiki-default:#8839EF;--shiki-dark:#C792EA}html pre.shiki code .sXbZB, html code.shiki .sXbZB{--shiki-default:#DF8E1D;--shiki-default-font-style:italic;--shiki-dark:#D6DEEB;--shiki-dark-font-style:inherit}html pre.shiki code .s2kId, html code.shiki .s2kId{--shiki-default:#4C4F69;--shiki-dark:#D6DEEB}html pre.shiki code .scGhl, html code.shiki .scGhl{--shiki-default:#7C7F93;--shiki-dark:#D6DEEB}html pre.shiki code .s9rnR, html code.shiki .s9rnR{--shiki-default:#179299;--shiki-dark:#7FDBCA}html pre.shiki code .scrte, html code.shiki .scrte{--shiki-default:#8839EF;--shiki-dark:#C5E478}html pre.shiki code .sbuKk, html code.shiki .sbuKk{--shiki-default:#40A02B;--shiki-dark:#D9F5DD}html pre.shiki code .sgAC-, html code.shiki .sgAC-{--shiki-default:#40A02B;--shiki-default-font-style:italic;--shiki-dark:#ECC48D;--shiki-dark-font-style:inherit}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .srFR9, html code.shiki .srFR9{--shiki-default:#7C7F93;--shiki-dark:#7FDBCA}html pre.shiki code .s30W1, html code.shiki .s30W1{--shiki-default:#1E66F5;--shiki-dark:#7FDBCA}html pre.shiki code .sCC8C, html code.shiki .sCC8C{--shiki-default:#40A02B;--shiki-dark:#C789D6}",{"title":123,"searchDepth":198,"depth":198,"links":3801},[3802,3807,3813],{"id":3112,"depth":198,"text":3075,"children":3803},[3804,3805,3806],{"id":3128,"depth":262,"text":3129},{"id":3150,"depth":262,"text":3151},{"id":3168,"depth":262,"text":3169},{"id":3189,"depth":198,"text":3190,"children":3808},[3809,3810,3811,3812],{"id":3201,"depth":262,"text":3202},{"id":3234,"depth":262,"text":3235},{"id":3256,"depth":262,"text":3257},{"id":3618,"depth":262,"text":3619},{"id":3630,"depth":198,"text":3631,"children":3814},[3815,3816,3817,3818],{"id":3637,"depth":262,"text":3638},{"id":3691,"depth":262,"text":3692},{"id":3747,"depth":262,"text":3748},{"id":3782,"depth":262,"text":3783},"2025-06-15","LLMs only recently enabled serviceable web agents: autonomous systems that browse web on behalf of a human. Get started with fundamental methodology, key design challenges, and technological opportunities.",{"homepage":258,"relatedLinks":3822},[3823,3824,3828],{"text":3071,"href":3072,"description":3073},{"text":3825,"href":3826,"description":3827},"Develop an AI Agent for Any Website with Webfuse","/blog/develop-an-ai-agent-for-any-website-with-webfuse","Learn how to develop and deploy a web agent for any website with Webfuse",{"text":2787,"href":3829,"external":258,"description":3079},"https://dev.webfuse.com/automation-api/",{"title":3093,"description":3820},{"loc":2544},"blog/1011.a-gentle-introduction-to-ai-agents-for-the-web",[1437,3085,3086,3088,3089],"Ky-gggxmZkldeN3wb7OvPpBxNaP72MwefaxFypvbUzY",1778586438898]