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