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