[{"data":1,"prerenderedAt":2788},["ShallowReactive",2],{"/blog/how-to-connect-an-ai-agent-to-the-live-web":3,"related-/blog/how-to-connect-an-ai-agent-to-the-live-web":349},{"id":4,"title":5,"authorId":6,"body":7,"category":307,"created":308,"description":309,"extension":310,"faqs":311,"featurePriority":324,"head":325,"landingPath":325,"meta":326,"navigation":338,"ogImage":325,"path":339,"robots":325,"schemaOrg":325,"seo":340,"sitemap":341,"stem":342,"tags":343,"__hash__":348},"blog/blog/1048.how-to-connect-an-ai-agent-to-the-live-web.md","How to Connect an AI Agent to the Live Web: 5 Architectures Compared (2026)","salome-koshadze",{"type":8,"value":9,"toc":297},"minimark",[10,14,17,46,49,52,61,66,72,75,78,81,103,106,109,112,116,120,123,126,129,149,152,155,159,163,166,169,173,176,196,199,202,206,209,212,215,235,238,241,245,248,251,254,274,277,280,284,287,291,294],[11,12,13],"p",{},"To connect an AI agent to the live web, you need an execution layer that lets it observe page state and trigger real actions. That layer might be a browser automation framework, a remote browser, a proxy-based system, or a structured protocol exposed by the site itself.",[11,15,16],{},"The right choice depends on where the agent runs, how quickly it needs to respond, and whether it acts inside the user's active session or in a separate environment.",[18,19,21,28,34,40],"tldr-box",{"title":20},"TL;DR",[11,22,23,27],{},[24,25,26],"strong",{},"AI web agents need an execution layer, not just a model."," The main options are live-session actuation, headless browsers, browser-use frameworks, cloud browsers, and WebMCP.",[11,29,30,33],{},[24,31,32],{},"Live-session actuation fits real-time, user-visible tasks best."," The agent acts inside the user's browser, so the feedback loop is fast and the user can watch what it is doing.",[11,35,36,39],{},[24,37,38],{},"Headless browsers, browser-use frameworks, and cloud browsers fit background automation best."," They are better suited to scraping, testing, and other isolated jobs where infrastructure and scale matter more than immediate feedback.",[11,41,42,45],{},[24,43,44],{},"WebMCP is the cleanest option when a site exposes structured tools."," It lets the agent call defined capabilities directly instead of working through the UI.",[11,47,48],{},"These five approaches solve the same basic problem in different ways. They differ in where execution happens, how the model reads page state, and how much latency, control, and infrastructure each setup involves.",[11,50,51],{},"This article compares the five common architectures so it is easier to match the connection method to the job, whether that means a voice-driven assistant, a background scraper, or an agent working alongside a user in a live session.",[53,54],"nuxt-picture",{":height":55,":width":56,"alt":57,"loading":58,"src":59,"provider":60},"450","800","Overview diagram of the five architectures for connecting an AI agent to the live web - live-session actuation, headless browsers, browser-use frameworks, remote and cloud browsers, and WebMCP","lazy","/blog/how-to-connect-an-ai-agent-to-the-live-web/1.svg","none",[62,63,65],"h2",{"id":64},"_1-webfuse-live-session-actuation","1. Webfuse (Live-Session Actuation)",[53,67],{":height":68,":width":69,"alt":70,"loading":58,"src":71},"1508","2880","Webfuse","/blog/how-to-connect-an-ai-agent-to-the-live-web/webfuse.png",[11,73,74],{},"Live-session actuation runs the agent inside the user's active browser session. Systems like Webfuse do this with an augmentation proxy between the user and the origin server. The proxy rewrites traffic and injects a virtualization layer into the page, and the agent communicates with that layer over an RPC bridge.",[11,76,77],{},"Because execution stays in the user's browser, the agent triggers the same JavaScript events and framework state changes as a human user. The user can watch the agent move through the site in real time, while cookies, local storage, and other session data remain in the local browser. This setup avoids browser extensions and separate remote browser infrastructure.",[11,79,80],{},"The setup has a few practical advantages:",[82,83,84,91,97],"ul",{},[85,86,87,90],"li",{},[24,88,89],{},"In-session visibility:"," The agent reads a compressed markup view and the accessibility tree from the live page state.",[85,92,93,96],{},[24,94,95],{},"Framework-aware timing:"," The virtualization layer can hook into frameworks like React or Angular to tell when the page is ready for the next action.",[85,98,99,102],{},[24,100,101],{},"Human handoff:"," A person can step in and take control if the agent reaches an edge case.",[11,104,105],{},"The proxy handles routing, while the virtualization layer handles browser-side control. The agent sends commands through the proxy, which forwards them into the live page. To avoid acting too early, the system tracks states such as initial markup load, framework hydration, and main-thread idle time.",[11,107,108],{},"This execution model also handles page structures that are awkward in external automation setups. Because the control layer runs from inside the session, it can work across shadow DOM boundaries and cross-origin iframes while presenting the agent with one usable view of the page. Rendering stays on the user's device, so there is no pixel-streaming round trip and visual feedback is immediate.",[11,110,111],{},"The same setup also gives teams more control over governance. Every action is visible in the user's session, policies can restrict which elements the agent may interact with, and sensitive fields can be masked before page state is sent to the model.",[62,113,115],{"id":114},"_2-headless-browser-automation-playwright-puppeteer","2. Headless Browser Automation (Playwright / Puppeteer)",[53,117],{":height":68,":width":69,"alt":118,"loading":58,"src":119},"Playwright","/blog/how-to-connect-an-ai-agent-to-the-live-web/playwright.png",[11,121,122],{},"Headless browser automation gives an agent programmatic control over a browser running without a visible UI. Tools like Playwright and Puppeteer expose APIs for browsers such as Chromium, Firefox, and WebKit, usually through debugging protocols like the Chrome DevTools Protocol. The agent produces commands, and those commands run in a browser process on a server or local machine.",[11,124,125],{},"To understand the page, the agent can request HTML snapshots or screenshots. To act on it, the automation layer sends low-level browser events such as clicks, typing, and navigation. In practice, this means running the browser alongside the agent logic and using selectors or other DOM queries to locate the right elements before dispatching actions.",[11,127,128],{},"This setup has a few practical strengths:",[82,130,131,137,143],{},[85,132,133,136],{},[24,134,135],{},"Direct DOM access:"," Automation scripts can read and modify the page directly, including running JavaScript in the page context.",[85,138,139,142],{},[24,140,141],{},"Network inspection:"," Frameworks can intercept, mock, or block requests, which is useful when the agent needs visibility into API calls and background traffic.",[85,144,145,148],{},[24,146,147],{},"Session isolation:"," Separate browser contexts help keep different agent runs isolated from one another.",[11,150,151],{},"The tradeoff is that the agent often has to work through large, messy page representations. Modern web apps may use generated class names, shadow DOM, or heavily dynamic rendering, which makes reliable element targeting harder. If the model is reading raw HTML to decide what to do next, token use climbs quickly.",[11,153,154],{},"This model also runs outside the user's active session. The agent works in its own browser environment, so private workflows usually require sending cookies or tokens to the machine running the browser. That machine also needs standard browser sandboxing and infrastructure isolation, because it is executing untrusted web content at scale. As concurrency grows, the cost and operational overhead grow with it.",[62,156,158],{"id":157},"_3-browser-use-and-agent-browser-frameworks","3. Browser-Use and Agent-Browser Frameworks",[53,160],{":height":68,":width":69,"alt":161,"loading":58,"src":162},"Browser Use","/blog/how-to-connect-an-ai-agent-to-the-live-web/browser-use.png",[11,164,165],{},"Frameworks like Browser Use and Stagehand sit on top of browser automation tools and give the model a simpler interface to work with. Instead of asking the model to produce raw Playwright or Puppeteer steps, they translate higher-level instructions into browser actions. That reduces the amount of low-level DOM and timing logic the model has to manage itself.",[11,167,168],{},"A common pattern is to compress the page before sending it to the model. These frameworks may extract the accessibility tree or strip out non-interactive markup so the model sees a cleaner text representation. Interactive elements are then mapped to identifiers, and the framework translates the model's chosen identifier back to the real DOM node before executing the action.",[53,170],{":height":55,":width":56,"alt":171,"loading":58,"src":172,"provider":60},"Diagram of a browser-use framework compressing the DOM into numbered interactive elements and mapping an agent's chosen identifier back to the real DOM node","/blog/how-to-connect-an-ai-agent-to-the-live-web/2.svg",[11,174,175],{},"Common features in these frameworks include:",[82,177,178,184,190],{},[85,179,180,183],{},[24,181,182],{},"Markup compression:"," They filter the page down to the text and controls most relevant to the task.",[85,185,186,189],{},[24,187,188],{},"Visual annotations:"," Some frameworks draw numbered boxes over screenshots so multimodal models can target elements visually.",[85,191,192,195],{},[24,193,194],{},"Readiness checks:"," They can wait for loading, animation, or element readiness before carrying out the next step.",[11,197,198],{},"The benefit is a simpler reasoning loop for the model. Frameworks like Stagehand structure that loop around patterns such as observe, act, and extract. Browser Use similarly gives the model a constrained set of actions and targets, then handles the lower-level execution underneath.",[11,200,201],{},"The tradeoff is that these tools still depend on headless browser infrastructure, and the extra parsing or screenshot annotation adds overhead. They also rely on heuristics to decide what counts as interactive. Highly custom UI components that do not expose standard HTML or ARIA patterns may be missed, which can make the agent less reliable.",[62,203,205],{"id":204},"_4-remote-and-cloud-browsers","4. Remote and Cloud Browsers",[11,207,208],{},"Remote browser platforms run the browser session on cloud infrastructure instead of on the local machine or inside the user's active browser. The agent connects to that remote browser over the network, typically through a WebSocket session, and sends automation commands from a separate runtime.",[11,210,211],{},"This setup is mainly about outsourcing browser operations. Running large numbers of browser instances is expensive and operationally heavy, so cloud browser providers handle provisioning, scaling, and lifecycle management. The agent just connects to a remote instance and drives it through the usual automation tooling.",[11,213,214],{},"These platforms often add features that are useful in large-scale automation:",[82,216,217,223,229],{},[85,218,219,222],{},[24,220,221],{},"Fingerprint control:"," They can adjust browser characteristics such as user agent, screen resolution, and hardware signals.",[85,224,225,228],{},[24,226,227],{},"Persistent profiles:"," They can keep cookies, local storage, and cache across runs.",[85,230,231,234],{},[24,232,233],{},"Built-in anti-bot support:"," Some platforms bundle CAPTCHA solving or other evasion tooling into the environment.",[11,236,237],{},"They also usually manage network routing for you. Sessions can be distributed across proxy networks and different IP addresses, which helps when high request volume would otherwise get blocked. The downside is latency: every command has to cross the network to the remote browser, and the resulting page state has to come back. For interactive or voice-driven tasks, that extra round trip is a real constraint.",[11,239,240],{},"The other major tradeoff is trust and access. Credentials and session data live on third-party infrastructure, which may be unacceptable for sensitive workflows. Remote browsers are also harder to use against internal tools unless you add private network access. In regulated environments, teams may also need to care about where the provider runs its infrastructure and where that session data is stored.",[62,242,244],{"id":243},"_5-webmcp-model-context-protocol-for-web","5. WebMCP (Model Context Protocol for Web)",[11,246,247],{},"WebMCP applies the Model Context Protocol to web interactions by letting a site expose structured capabilities directly to an agent. Instead of working through the page like a user would, the agent connects to an MCP server and receives a defined set of tools, resources, and prompts for that site.",[11,249,250],{},"That changes the interaction model completely. Rather than parsing HTML, locating buttons, and simulating clicks, the agent can call a structured tool with the right parameters. If a site wants to support account creation, for example, it can expose a registration tool that accepts fields like name and email and handles the action directly.",[11,252,253],{},"This approach has a few clear advantages:",[82,255,256,262,268],{},[85,257,258,261],{},[24,259,260],{},"Deterministic execution:"," The agent calls defined functions instead of relying on fragile UI automation.",[85,263,264,267],{},[24,265,266],{},"Lower context load:"," The model works with structured schemas rather than large DOM snapshots.",[85,269,270,273],{},[24,271,272],{},"Explicit permissions:"," The site owner controls exactly which actions and data the agent can access.",[11,275,276],{},"In practice, the MCP interface can expose read-only resources, reusable prompts, and executable tools. The agent connects over HTTP or WebSockets, inspects what the server makes available, and decides which tool to call based on the task.",[11,278,279],{},"The tradeoff is that WebMCP only works when the site owner builds and maintains that interface. If a site does not expose MCP capabilities, the agent cannot use this route. It also removes the visible, human-like interaction you get from browser automation, so teams may need additional client-side updates if users are meant to see the result reflected in the live UI.",[62,281,283],{"id":282},"summary","Summary",[11,285,286],{},"The right way to connect an AI agent to the web depends on where the agent runs, how quickly it needs to respond, and whether the interaction needs to stay visible inside a live user session.",[53,288],{":height":55,":width":56,"alt":289,"loading":58,"src":290,"provider":60},"Summary diagram comparing the five AI agent connection architectures by where execution runs, latency, security perimeter, and best-fit use case","/blog/how-to-connect-an-ai-agent-to-the-live-web/4.svg",[11,292,293],{},"Live-session actuation is the best fit when the agent needs to work inside the user's browser with immediate visual feedback. Headless and cloud browser setups make more sense for isolated automation, large-scale extraction, and test-like workloads. Browser-use frameworks sit in the middle by making headless automation easier for models to operate. WebMCP is the cleanest option when the site exposes structured tools directly.",[11,295,296],{},"In practice, the decision comes down to latency, control, infrastructure, and trust boundaries. Those factors determine how the model sees the page, where session data lives, and how reliable the interaction will be.",{"title":298,"searchDepth":299,"depth":299,"links":300},"",2,[301,302,303,304,305,306],{"id":64,"depth":299,"text":65},{"id":114,"depth":299,"text":115},{"id":157,"depth":299,"text":158},{"id":204,"depth":299,"text":205},{"id":243,"depth":299,"text":244},{"id":282,"depth":299,"text":283},"ai-agents","2026-07-06","Connecting an AI agent to the live web means choosing an actuation layer. Compare headless browsers, browser-use frameworks, cloud browsers, WebMCP, and live-session actuation across latency, security, and scale.","md",[312,315,318,321],{"question":313,"answer":314},"What does it mean to connect an AI agent to the live web?","It means giving a language model an execution environment where it can perceive a web page's state and dispatch actions like clicks and keystrokes. The model handles reasoning; the actuation layer handles interacting with the live browser. The architecture you choose defines where execution runs, how the model sees the interface, and how fast it acts.",{"question":316,"answer":317},"What are the main ways to connect an AI agent to the web?","There are five main architectures: live-session actuation that runs inside the user's own browser through an augmentation proxy, headless browser automation (Playwright/Puppeteer), browser-use and agent-browser frameworks (Browser Use, Stagehand), remote and cloud browsers, and WebMCP where sites expose tools directly.",{"question":319,"answer":320},"Which method has the lowest latency?","Live-session actuation. Because the agent acts directly in the user's own browser rather than a remote instance, there is no pixel-streaming round-trip. Remote and cloud browsers add network latency on every command, which slows down interactive and voice-driven tasks.",{"question":322,"answer":323},"Which method is best for background data extraction?","Headless browser automation and cloud browsers. Their isolated, ephemeral sessions and horizontal scaling suit high-volume scraping and testing where no human watches the screen and latency is not critical.",0,null,{"shortTitle":327,"image":328,"relatedLinks":329},"Connect an AI Agent to the Live Web","/blog/how-to-connect-an-ai-agent-to-the-live-web.png",[330,334],{"text":331,"href":332,"description":333},"Headless Browsers vs Live Sessions for Customer-Facing AI Agents","/blog/headless-browsers-vs-live-sessions-for-customer-facing-ai-agents","A deeper look at remote headless execution versus acting inside the user's own browser session.",{"text":335,"href":336,"description":337},"WebMCP vs MCP: What's the Difference and When to Use Each","/blog/webmcp-vs-mcp-whats-the-difference-and-when-to-use-each","How the Model Context Protocol applies to the web and where it fits among automation approaches.",true,"/blog/how-to-connect-an-ai-agent-to-the-live-web",{"title":5,"description":309},{"loc":339},"blog/1048.how-to-connect-an-ai-agent-to-the-live-web",[307,344,345,346,347],"web-agents","browser-automation","webmcp","actuation-layer","u7yMNbqegNN3XPU1MqY7ULPJwdfmog6Po3SmmsSTmoU",[350,2026],{"id":351,"title":352,"authorId":353,"body":354,"category":307,"created":1989,"description":1990,"extension":310,"faqs":1991,"featurePriority":325,"head":325,"landingPath":325,"meta":2004,"navigation":338,"ogImage":325,"path":2016,"robots":325,"schemaOrg":325,"seo":2017,"sitemap":2018,"stem":2019,"tags":2020,"__hash__":2025},"blog/blog/1012.dom-downsampling-for-llm-based-web-agents.md","DOM Downsampling for LLM-Based Web Agents","thassilo-schiepanski",{"type":8,"value":355,"toc":1974},[356,362,386,390,397,402,418,422,428,432,450,477,480,484,487,498,504,535,539,559,571,576,592,606,609,613,633,637,645,657,661,664,1057,1063,1070,1234,1241,1332,1339,1411,1420,1426,1435,1439,1445,1455,1467,1701,1718,1740,1746,1789,1793,1805,1814,1818,1823,1826,1830,1836,1841,1879,1883,1889,1893,1903,1907,1910,1970],[53,357],{":width":358,"alt":359,"format":360,"loading":58,"src":361},"900","Downsampling visualised for digital images and HTML","webp","/blog/dom-downsampling-for-web-agents/1.png",[11,363,364,371,372,371,377,381,382,385],{},[365,366,370],"a",{"href":367,"rel":368},"https://operator.chatgpt.com",[369],"nofollow","Operator (OpenAI)",", ",[365,373,376],{"href":374,"rel":375},"https://www.director.ai",[369],"Director (Browserbase)",[365,378,161],{"href":379,"rel":380},"https://browser-use.com",[369]," – we are currently witnessing the rise of ",[24,383,384],{},"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.",[62,387,389],{"id":388},"what-is-a-snapshot","What is a Snapshot?",[11,391,392,393,396],{},"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 ",[24,394,395],{},"snapshot",". And the snapshot technique primarily decides the quality of LLM interaction suggestions.",[398,399,401],"h3",{"id":400},"gui-snapshots","GUI Snapshots",[11,403,404,405,408,409,413,414,417],{},"Screenshots – for consistency reasons referred to as ",[24,406,407],{},"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 ",[410,411,412],"em",{},"“click at 100, 735”",". As a workaround, early web agents used ",[410,415,416],{},"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.",[53,419],{":width":358,"alt":420,"format":360,"loading":58,"src":421},"Grounded GUI snapshot as implemented by Browser Use","/blog/dom-downsampling-for-web-agents/2.png",[11,423,424],{},[425,426,427],"small",{},"Grounded GUI snapshot as implemented by Browser Use.",[398,429,431],{"id":430},"dom-snapshots","DOM Snapshots",[11,433,434,435,445,446,449],{},"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",[436,437,438],"sup",{},[365,439,444],{"href":440,"ariaDescribedBy":441,"dataFootnoteRef":298,"id":443},"#user-content-fn-1",[442],"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, ",[24,447,448],{},"DOM snapshots"," offer a compelling alternative to GUI snapshots. DOM snapshots offer a handful of key advantages:",[451,452,453,456,459,462,465],"ol",{},[85,454,455],{},"DOM snapshots connect with LLM code (HTML) interpretation abilities.",[85,457,458],{},"DOM snapshots can be compiled from deep clones, hidden from supervision (unlike GUI grounding).",[85,460,461],{},"DOM snapshots render text input that on average consume less bandwidth than screnshots.",[85,463,464],{},"DOM snapshots allow for exact programmatic targeting of elements (e.g., via CSS selectors).",[85,466,467,468,472,473,476],{},"DOM snapshots are available with the ",[469,470,471],"code",{},"DOMContentLoaded"," event (whereas the GUI completes initial rendering with ",[469,474,475],{},"load",").",[11,478,479],{},"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?).",[62,481,483],{"id":482},"dom-downsampling-a-novel-approach","DOM Downsampling: A Novel Approach",[11,485,486],{},"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,488,489,490,493,494,497],{},"We transfer the concept of ",[24,491,492],{},"downsampling"," to ",[24,495,496],{},"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.",[62,499,501],{"id":500},"d2snap",[410,502,503],{},"D2Snap",[11,505,506,507,515,523,531,532,534],{},"We recently proposed ",[365,508,511],{"href":509,"rel":510},"https://arxiv.org/abs/2508.04412",[369],[24,512,513],{},[410,514,503],{},[436,516,517],{},[365,518,522],{"href":519,"ariaDescribedBy":520,"dataFootnoteRef":298,"id":521},"#user-content-fn-2",[442],"user-content-fnref-2","2",[436,524,525],{},[365,526,530],{"href":527,"ariaDescribedBy":528,"dataFootnoteRef":298,"id":529},"#user-content-fn-3",[442],"user-content-fnref-3","3"," – a first-of-its-kind downsampling algorithm for DOMs. Herein, we'll briefly explain how the ",[410,533,503],{}," algorithm works, and how it can be utilised to build efficient and performant web agents.",[398,536,538],{"id":537},"how-it-works","How it works",[11,540,541,542,544,545,371,548,551,552,555,556,476],{},"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. ",[410,543,503],{}," downsamples at a variable ratio, configured through procedure-specific parameters  ",[469,546,547],{},"k",[469,549,550],{},"l",", and ",[469,553,554],{},"m"," (",[469,557,558],{},"∈ [0, 1]",[560,561,562],"blockquote",{},[11,563,564,565,570],{},"We used ",[365,566,569],{"href":567,"rel":568},"https://openai.com/index/hello-gpt-4o/",[369],"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.",[572,573,575],"h4",{"id":574},"procedure-elements","Procedure: Elements",[11,577,578,580,581,584,585,588,589,591],{},[410,579,503],{}," downsamples (simplifies) elements by merging container elements like ",[469,582,583],{},"section"," and ",[469,586,587],{},"div"," together. A parameter ",[469,590,547],{}," 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,593,594,595,371,597,599,600,605],{},"Elements in content elements (",[469,596,11],{},[469,598,560],{},", ...) are translated to a more comprehensive ",[365,601,604],{"href":602,"rel":603},"https://www.markdownguide.org/basic-syntax/",[369],"Markdown"," representation.",[11,607,608],{},"Interactive elements, definite interaction target candidates, are kept as is.",[572,610,612],{"id":611},"procedure-text","Procedure: Text",[11,614,615,617,618,621,629,630,632],{},[410,616,503],{}," downsamples text by dropping a fraction. Natural units of text are space-separated words, or punctuation-separated sentences. We reuse the ",[410,619,620],{},"TextRank",[436,622,623],{},[365,624,628],{"href":625,"ariaDescribedBy":626,"dataFootnoteRef":298,"id":627},"#user-content-fn-4",[442],"user-content-fnref-4","4"," algorithm to rank sentences in text nodes. The lowest-ranking fraction of sentences, denoted by parameter ",[469,631,550],{},", is dropped.",[572,634,636],{"id":635},"procedure-attributes","Procedure: Attributes",[11,638,639,641,642,644],{},[410,640,503],{}," downsamples attributes by dropping those with a name that, according to ground truth, holds a UI feature degree below a threshold. Parameter ",[469,643,554],{}," denotes this threshold.",[560,646,647],{},[11,648,649,650,656],{},"Check out the ",[365,651,653,655],{"href":509,"rel":652},[369],[410,654,503],{}," paper"," to learn about the algorithm in-depth.",[398,658,660],{"id":659},"example-of-a-downsampled-dom","Example of a Downsampled DOM",[11,662,663],{},"Consider a partial DOM state, serialised as HTML:",[665,666,670],"pre",{"className":667,"code":668,"language":669,"meta":298,"style":298},"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",[469,671,672,739,782,805,814,835,854,863,869,875,885,914,924,943,961,970,976,982,992,1019,1028,1038,1048],{"__ignoreMap":298},[673,674,677,681,684,688,691,695,699,701,704,706,708,710,712,715,717,719,722,724,727,729,731,734,736],"span",{"class":675,"line":676},"line",1,[673,678,680],{"class":679},"s9rnR","\u003C",[673,682,583],{"class":683},"sY2RG",[673,685,687],{"class":686},"swkLt"," class",[673,689,690],{"class":679},"=",[673,692,694],{"class":693},"sbuKk","\"",[673,696,698],{"class":697},"sfrMT","container",[673,700,694],{"class":693},[673,702,703],{"class":686}," tabindex",[673,705,690],{"class":679},[673,707,694],{"class":693},[673,709,530],{"class":697},[673,711,694],{"class":693},[673,713,714],{"class":686}," required",[673,716,690],{"class":679},[673,718,694],{"class":693},[673,720,721],{"class":697},"true",[673,723,694],{"class":693},[673,725,726],{"class":686}," type",[673,728,690],{"class":679},[673,730,694],{"class":693},[673,732,733],{"class":697},"example",[673,735,694],{"class":693},[673,737,738],{"class":679},">\n",[673,740,741,744,746,748,750,752,755,757,760,762,764,767,769,771,773,775,778,780],{"class":675,"line":299},[673,742,743],{"class":679},"  \u003C",[673,745,587],{"class":683},[673,747,687],{"class":686},[673,749,690],{"class":679},[673,751,694],{"class":693},[673,753,754],{"class":697},"mx-auto",[673,756,694],{"class":693},[673,758,759],{"class":686}," data-topic",[673,761,690],{"class":679},[673,763,694],{"class":693},[673,765,766],{"class":697},"products",[673,768,694],{"class":693},[673,770,714],{"class":686},[673,772,690],{"class":679},[673,774,694],{"class":693},[673,776,777],{"class":697},"false",[673,779,694],{"class":693},[673,781,738],{"class":679},[673,783,785,788,791,794,798,801,803],{"class":675,"line":784},3,[673,786,787],{"class":679},"    \u003C",[673,789,790],{"class":683},"h1",[673,792,793],{"class":679},">",[673,795,797],{"class":796},"s2kId","Our Pizza",[673,799,800],{"class":679},"\u003C/",[673,802,790],{"class":683},[673,804,738],{"class":679},[673,806,808,810,812],{"class":675,"line":807},4,[673,809,787],{"class":679},[673,811,587],{"class":683},[673,813,738],{"class":679},[673,815,817,820,822,824,826,828,831,833],{"class":675,"line":816},5,[673,818,819],{"class":679},"      \u003C",[673,821,587],{"class":683},[673,823,687],{"class":686},[673,825,690],{"class":679},[673,827,694],{"class":693},[673,829,830],{"class":697},"shadow-lg",[673,832,694],{"class":693},[673,834,738],{"class":679},[673,836,838,841,843,845,848,850,852],{"class":675,"line":837},6,[673,839,840],{"class":679},"        \u003C",[673,842,62],{"class":683},[673,844,793],{"class":679},[673,846,847],{"class":796},"Margherita",[673,849,800],{"class":679},[673,851,62],{"class":683},[673,853,738],{"class":679},[673,855,857,859,861],{"class":675,"line":856},7,[673,858,840],{"class":679},[673,860,11],{"class":683},[673,862,738],{"class":679},[673,864,866],{"class":675,"line":865},8,[673,867,868],{"class":796},"          A simple classic: mozzarela, tomatoes and basil.\n",[673,870,872],{"class":675,"line":871},9,[673,873,874],{"class":796},"          An everyday choice!\n",[673,876,878,881,883],{"class":675,"line":877},10,[673,879,880],{"class":679},"        \u003C/",[673,882,11],{"class":683},[673,884,738],{"class":679},[673,886,888,890,893,895,897,899,901,903,905,908,910,912],{"class":675,"line":887},11,[673,889,840],{"class":679},[673,891,892],{"class":683},"button",[673,894,726],{"class":686},[673,896,690],{"class":679},[673,898,694],{"class":693},[673,900,892],{"class":697},[673,902,694],{"class":693},[673,904,793],{"class":679},[673,906,907],{"class":796},"Add",[673,909,800],{"class":679},[673,911,892],{"class":683},[673,913,738],{"class":679},[673,915,917,920,922],{"class":675,"line":916},12,[673,918,919],{"class":679},"      \u003C/",[673,921,587],{"class":683},[673,923,738],{"class":679},[673,925,927,929,931,933,935,937,939,941],{"class":675,"line":926},13,[673,928,819],{"class":679},[673,930,587],{"class":683},[673,932,687],{"class":686},[673,934,690],{"class":679},[673,936,694],{"class":693},[673,938,830],{"class":697},[673,940,694],{"class":693},[673,942,738],{"class":679},[673,944,946,948,950,952,955,957,959],{"class":675,"line":945},14,[673,947,840],{"class":679},[673,949,62],{"class":683},[673,951,793],{"class":679},[673,953,954],{"class":796},"Capricciosa",[673,956,800],{"class":679},[673,958,62],{"class":683},[673,960,738],{"class":679},[673,962,964,966,968],{"class":675,"line":963},15,[673,965,840],{"class":679},[673,967,11],{"class":683},[673,969,738],{"class":679},[673,971,973],{"class":675,"line":972},16,[673,974,975],{"class":796},"          A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n",[673,977,979],{"class":675,"line":978},17,[673,980,981],{"class":796},"          A true favourite!\n",[673,983,985,988,990],{"class":675,"line":984},18,[673,986,987],{"class":679},"          \u003C/",[673,989,11],{"class":683},[673,991,738],{"class":679},[673,993,995,997,999,1001,1003,1005,1007,1009,1011,1013,1015,1017],{"class":675,"line":994},19,[673,996,840],{"class":679},[673,998,892],{"class":683},[673,1000,726],{"class":686},[673,1002,690],{"class":679},[673,1004,694],{"class":693},[673,1006,892],{"class":697},[673,1008,694],{"class":693},[673,1010,793],{"class":679},[673,1012,907],{"class":796},[673,1014,800],{"class":679},[673,1016,892],{"class":683},[673,1018,738],{"class":679},[673,1020,1022,1024,1026],{"class":675,"line":1021},20,[673,1023,919],{"class":679},[673,1025,587],{"class":683},[673,1027,738],{"class":679},[673,1029,1031,1034,1036],{"class":675,"line":1030},21,[673,1032,1033],{"class":679},"    \u003C/",[673,1035,587],{"class":683},[673,1037,738],{"class":679},[673,1039,1041,1044,1046],{"class":675,"line":1040},22,[673,1042,1043],{"class":679},"  \u003C/",[673,1045,587],{"class":683},[673,1047,738],{"class":679},[673,1049,1051,1053,1055],{"class":675,"line":1050},23,[673,1052,800],{"class":679},[673,1054,583],{"class":683},[673,1056,738],{"class":679},[11,1058,1059,1060,1062],{},"Here are some ",[410,1061,503],{}," downsampling results, which are based on different parametric configurations. A percentage denotes the reduced size.",[572,1064,1066,1069],{"id":1065},"k3-l3-m3-55",[469,1067,1068],{},"k=.3, l=.3, m=.3"," (55%)",[665,1071,1073],{"className":667,"code":1072,"language":669,"meta":298,"style":298},"\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",[469,1074,1075,1123,1128,1146,1151,1156,1182,1187,1192,1218,1226],{"__ignoreMap":298},[673,1076,1077,1079,1081,1083,1085,1087,1089,1091,1093,1095,1097,1099,1101,1103,1105,1107,1109,1111,1113,1115,1117,1119,1121],{"class":675,"line":676},[673,1078,680],{"class":679},[673,1080,583],{"class":683},[673,1082,703],{"class":686},[673,1084,690],{"class":679},[673,1086,694],{"class":693},[673,1088,530],{"class":697},[673,1090,694],{"class":693},[673,1092,726],{"class":686},[673,1094,690],{"class":679},[673,1096,694],{"class":693},[673,1098,733],{"class":697},[673,1100,694],{"class":693},[673,1102,687],{"class":686},[673,1104,690],{"class":679},[673,1106,694],{"class":693},[673,1108,698],{"class":697},[673,1110,694],{"class":693},[673,1112,714],{"class":686},[673,1114,690],{"class":679},[673,1116,694],{"class":693},[673,1118,721],{"class":697},[673,1120,694],{"class":693},[673,1122,738],{"class":679},[673,1124,1125],{"class":675,"line":299},[673,1126,1127],{"class":796},"  # Our Pizza\n",[673,1129,1130,1132,1134,1136,1138,1140,1142,1144],{"class":675,"line":784},[673,1131,743],{"class":679},[673,1133,587],{"class":683},[673,1135,687],{"class":686},[673,1137,690],{"class":679},[673,1139,694],{"class":693},[673,1141,830],{"class":697},[673,1143,694],{"class":693},[673,1145,738],{"class":679},[673,1147,1148],{"class":675,"line":807},[673,1149,1150],{"class":796},"    ## Margherita\n",[673,1152,1153],{"class":675,"line":816},[673,1154,1155],{"class":796},"    A simple classic: mozzarela, tomatoes, and basil.\n",[673,1157,1158,1160,1162,1164,1166,1168,1170,1172,1174,1176,1178,1180],{"class":675,"line":837},[673,1159,787],{"class":679},[673,1161,892],{"class":683},[673,1163,726],{"class":686},[673,1165,690],{"class":679},[673,1167,694],{"class":693},[673,1169,892],{"class":697},[673,1171,694],{"class":693},[673,1173,793],{"class":679},[673,1175,907],{"class":796},[673,1177,800],{"class":679},[673,1179,892],{"class":683},[673,1181,738],{"class":679},[673,1183,1184],{"class":675,"line":856},[673,1185,1186],{"class":796},"    ## Capricciosa\n",[673,1188,1189],{"class":675,"line":865},[673,1190,1191],{"class":796},"    A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n",[673,1193,1194,1196,1198,1200,1202,1204,1206,1208,1210,1212,1214,1216],{"class":675,"line":871},[673,1195,787],{"class":679},[673,1197,892],{"class":683},[673,1199,726],{"class":686},[673,1201,690],{"class":679},[673,1203,694],{"class":693},[673,1205,892],{"class":697},[673,1207,694],{"class":693},[673,1209,793],{"class":679},[673,1211,907],{"class":796},[673,1213,800],{"class":679},[673,1215,892],{"class":683},[673,1217,738],{"class":679},[673,1219,1220,1222,1224],{"class":675,"line":877},[673,1221,1043],{"class":679},[673,1223,587],{"class":683},[673,1225,738],{"class":679},[673,1227,1228,1230,1232],{"class":675,"line":887},[673,1229,800],{"class":679},[673,1231,583],{"class":683},[673,1233,738],{"class":679},[572,1235,1237,1240],{"id":1236},"k4-l6-m8-27",[469,1238,1239],{},"k=.4, l=.6, m=.8"," (27%)",[665,1242,1244],{"className":667,"code":1243,"language":669,"meta":298,"style":298},"\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",[469,1245,1246,1254,1258,1266,1270,1275,1291,1295,1300,1316,1324],{"__ignoreMap":298},[673,1247,1248,1250,1252],{"class":675,"line":676},[673,1249,680],{"class":679},[673,1251,583],{"class":683},[673,1253,738],{"class":679},[673,1255,1256],{"class":675,"line":299},[673,1257,1127],{"class":796},[673,1259,1260,1262,1264],{"class":675,"line":784},[673,1261,743],{"class":679},[673,1263,587],{"class":683},[673,1265,738],{"class":679},[673,1267,1268],{"class":675,"line":807},[673,1269,1150],{"class":796},[673,1271,1272],{"class":675,"line":816},[673,1273,1274],{"class":796},"    A simple classic:\n",[673,1276,1277,1279,1281,1283,1285,1287,1289],{"class":675,"line":837},[673,1278,787],{"class":679},[673,1280,892],{"class":683},[673,1282,793],{"class":679},[673,1284,907],{"class":796},[673,1286,800],{"class":679},[673,1288,892],{"class":683},[673,1290,738],{"class":679},[673,1292,1293],{"class":675,"line":856},[673,1294,1186],{"class":796},[673,1296,1297],{"class":675,"line":865},[673,1298,1299],{"class":796},"    A rich taste:\n",[673,1301,1302,1304,1306,1308,1310,1312,1314],{"class":675,"line":871},[673,1303,787],{"class":679},[673,1305,892],{"class":683},[673,1307,793],{"class":679},[673,1309,907],{"class":796},[673,1311,800],{"class":679},[673,1313,892],{"class":683},[673,1315,738],{"class":679},[673,1317,1318,1320,1322],{"class":675,"line":877},[673,1319,1043],{"class":679},[673,1321,587],{"class":683},[673,1323,738],{"class":679},[673,1325,1326,1328,1330],{"class":675,"line":887},[673,1327,800],{"class":679},[673,1329,583],{"class":683},[673,1331,738],{"class":679},[572,1333,1335,1338],{"id":1334},"k-l0-m-35",[469,1336,1337],{},"k→∞, l=0, ∀m"," (35%)",[665,1340,1342],{"className":667,"code":1341,"language":669,"meta":298,"style":298},"# 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",[469,1343,1344,1349,1354,1359,1364,1380,1385,1390,1395],{"__ignoreMap":298},[673,1345,1346],{"class":675,"line":676},[673,1347,1348],{"class":796},"# Our Pizza\n",[673,1350,1351],{"class":675,"line":299},[673,1352,1353],{"class":796},"## Margherita\n",[673,1355,1356],{"class":675,"line":784},[673,1357,1358],{"class":796},"A simple classic: mozzarela, tomatoes, and basil.\n",[673,1360,1361],{"class":675,"line":807},[673,1362,1363],{"class":796},"An everyday choice!\n",[673,1365,1366,1368,1370,1372,1374,1376,1378],{"class":675,"line":816},[673,1367,680],{"class":679},[673,1369,892],{"class":683},[673,1371,793],{"class":679},[673,1373,907],{"class":796},[673,1375,800],{"class":679},[673,1377,892],{"class":683},[673,1379,738],{"class":679},[673,1381,1382],{"class":675,"line":837},[673,1383,1384],{"class":796},"## Capricciosa\n",[673,1386,1387],{"class":675,"line":856},[673,1388,1389],{"class":796},"A rich taste: mozzarella, ham, mushrooms, artichokes, and olives.\n",[673,1391,1392],{"class":675,"line":865},[673,1393,1394],{"class":796},"A true favourite!\n",[673,1396,1397,1399,1401,1403,1405,1407,1409],{"class":675,"line":871},[673,1398,680],{"class":679},[673,1400,892],{"class":683},[673,1402,793],{"class":679},[673,1404,907],{"class":796},[673,1406,800],{"class":679},[673,1408,892],{"class":683},[673,1410,738],{"class":679},[11,1412,1413,1414,1416,1417,1419],{},"Asymptotic ",[469,1415,547],{}," (kind of 'infinite' ",[469,1418,547],{},") 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.",[398,1421,1423],{"id":1422},"adaptived2snap",[410,1424,1425],{},"AdaptiveD2Snap",[11,1427,1428,1429,1431,1432,1434],{},"Fixed parameters might not be ideal for arbitrary DOMs – sourced from a landscape of web applications. We created ",[410,1430,1425],{}," – a wrapper for ",[410,1433,503],{}," that infers suitable parameters from a given DOM in order to hit a certain token budget.",[398,1436,1438],{"id":1437},"implementation-integration","Implementation & Integration",[11,1440,1441,1442,1444],{},"Picture an LLM-based weg agent that is premised on DOM snapshots. Implementing ",[410,1443,503],{}," is simple: Deep clone the DOM, and feed it to the algorithm. Now, take the snapshot; this is, serialise the resulting DOM. Done.",[560,1446,1447],{},[11,1448,1449,1450,1454],{},"Read our ",[365,1451,1453],{"href":1452},"/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,1456,1457,1458,1460,1461,1466],{},"The open source ",[410,1459,503],{}," API, provided as a ",[365,1462,1465],{"href":1463,"rel":1464},"https://github.com/webfuse-com/D2Snap",[369],"package on GitHub"," provides the following signature:",[665,1468,1472],{"className":1469,"code":1470,"language":1471,"meta":298,"style":298},"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",[469,1473,1474,1507,1519,1538,1552,1557,1562,1577,1589,1607,1617,1633,1637,1648,1656,1669,1681,1689],{"__ignoreMap":298},[673,1475,1476,1480,1484,1487,1491,1494,1497,1499,1503],{"class":675,"line":676},[673,1477,1479],{"class":1478},"s76yb","type",[673,1481,1483],{"class":1482},"sXbZB"," DOM ",[673,1485,690],{"class":1486},"s-_ek",[673,1488,1490],{"class":1489},"s-DR7"," Document",[673,1492,1493],{"class":679}," |",[673,1495,1496],{"class":1489}," Element",[673,1498,1493],{"class":679},[673,1500,1502],{"class":1501},"scrte"," string",[673,1504,1506],{"class":1505},"scGhl",";\n",[673,1508,1509,1511,1514,1516],{"class":675,"line":299},[673,1510,1479],{"class":1478},[673,1512,1513],{"class":1482}," Options ",[673,1515,690],{"class":1486},[673,1517,1518],{"class":1505}," {\n",[673,1520,1521,1525,1528,1531,1534],{"class":675,"line":784},[673,1522,1524],{"class":1523},"swl0y","  assignUniqueIDs",[673,1526,1527],{"class":679},"?:",[673,1529,1530],{"class":1501}," boolean",[673,1532,1533],{"class":1505},";",[673,1535,1537],{"class":1536},"sDmS1"," // false\n",[673,1539,1540,1543,1545,1547,1549],{"class":675,"line":807},[673,1541,1542],{"class":1523},"  debug",[673,1544,1527],{"class":679},[673,1546,1530],{"class":1501},[673,1548,1533],{"class":1505},[673,1550,1551],{"class":1536},"           // true\n",[673,1553,1554],{"class":675,"line":816},[673,1555,1556],{"class":1505},"};\n",[673,1558,1559],{"class":675,"line":837},[673,1560,1561],{"emptyLinePlaceholder":338},"\n",[673,1563,1564,1566,1570,1574],{"class":675,"line":856},[673,1565,503],{"class":796},[673,1567,1569],{"class":1568},"s5FwJ",".",[673,1571,1573],{"class":1572},"sNstc","d2Snap",[673,1575,1576],{"class":796},"(\n",[673,1578,1579,1582,1586],{"class":675,"line":865},[673,1580,1581],{"class":796},"  dom: ",[673,1583,1585],{"class":1584},"sqxXB","DOM",[673,1587,1588],{"class":1505},",\n",[673,1590,1591,1594,1597,1600,1602,1605],{"class":675,"line":871},[673,1592,1593],{"class":796},"  k: number",[673,1595,1596],{"class":1505},",",[673,1598,1599],{"class":796}," l: number",[673,1601,1596],{"class":1505},[673,1603,1604],{"class":796}," m: number",[673,1606,1588],{"class":1505},[673,1608,1609,1612,1614],{"class":675,"line":877},[673,1610,1611],{"class":796},"  options",[673,1613,1527],{"class":1486},[673,1615,1616],{"class":796}," Options\n",[673,1618,1619,1622,1626,1628,1631],{"class":675,"line":887},[673,1620,1621],{"class":796},"): ",[673,1623,1625],{"class":1624},"s8Irk","Promise",[673,1627,680],{"class":1486},[673,1629,1630],{"class":796},"string",[673,1632,738],{"class":1486},[673,1634,1635],{"class":675,"line":916},[673,1636,1561],{"emptyLinePlaceholder":338},[673,1638,1639,1641,1643,1646],{"class":675,"line":926},[673,1640,503],{"class":796},[673,1642,1569],{"class":1568},[673,1644,1645],{"class":1572},"adaptiveD2Snap",[673,1647,1576],{"class":796},[673,1649,1650,1652,1654],{"class":675,"line":945},[673,1651,1581],{"class":796},[673,1653,1585],{"class":1584},[673,1655,1588],{"class":1505},[673,1657,1658,1661,1663,1667],{"class":675,"line":963},[673,1659,1660],{"class":796},"  maxTokens: number ",[673,1662,690],{"class":1486},[673,1664,1666],{"class":1665},"sZ_Zo"," 4096",[673,1668,1588],{"class":1505},[673,1670,1671,1674,1676,1679],{"class":675,"line":972},[673,1672,1673],{"class":796},"  maxIterations: number ",[673,1675,690],{"class":1486},[673,1677,1678],{"class":1665}," 5",[673,1680,1588],{"class":1505},[673,1682,1683,1685,1687],{"class":675,"line":978},[673,1684,1611],{"class":796},[673,1686,1527],{"class":1486},[673,1688,1616],{"class":796},[673,1690,1691,1693,1695,1697,1699],{"class":675,"line":984},[673,1692,1621],{"class":796},[673,1694,1625],{"class":1624},[673,1696,680],{"class":1486},[673,1698,1630],{"class":796},[673,1700,738],{"class":1486},[11,1702,1703,1704,1706,1707,1712,1713,1717],{},"Moreover, ",[410,1705,503],{}," it is available on the ",[365,1708,1711],{"href":1709,"rel":1710},"https://dev.webfuse.com/automation-api",[369],"Webfuse Automation API",". ",[365,1714,70],{"href":1715,"rel":1716},"https://www.webfuse.com",[369]," essentially is a proxy to seamlessly serve any existing web application with custom augmentations, such as a web agent widget.",[665,1719,1723],{"className":1720,"code":1721,"language":1722,"meta":298,"style":298},"language-js shiki shiki-themes catppuccin-latte night-owl","const domSnapshot = await browser.webfuseSession\n    .automation\n    .take_dom_snapshot({ modifier: 'downsample' })\n","js",[469,1724,1725,1730,1735],{"__ignoreMap":298},[673,1726,1727],{"class":675,"line":676},[673,1728,1729],{},"const domSnapshot = await browser.webfuseSession\n",[673,1731,1732],{"class":675,"line":299},[673,1733,1734],{},"    .automation\n",[673,1736,1737],{"class":675,"line":784},[673,1738,1739],{},"    .take_dom_snapshot({ modifier: 'downsample' })\n",[11,1741,1742,1743,1745],{},"Need precise control over the underlying ",[410,1744,503],{}," invocation? Configure it exactly how you want:",[665,1747,1749],{"className":1720,"code":1748,"language":1722,"meta":298,"style":298},"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",[469,1750,1751,1755,1759,1764,1769,1774,1779,1784],{"__ignoreMap":298},[673,1752,1753],{"class":675,"line":676},[673,1754,1729],{},[673,1756,1757],{"class":675,"line":299},[673,1758,1734],{},[673,1760,1761],{"class":675,"line":784},[673,1762,1763],{},"    .take_dom_snapshot({\n",[673,1765,1766],{"class":675,"line":807},[673,1767,1768],{},"        modifier: {\n",[673,1770,1771],{"class":675,"line":816},[673,1772,1773],{},"            name: 'D2Snap',\n",[673,1775,1776],{"class":675,"line":837},[673,1777,1778],{},"            params: { hierarchyRatio: 0.6, textRatio: 0.2, attributeRatio: 0.8 }\n",[673,1780,1781],{"class":675,"line":856},[673,1782,1783],{},"        }\n",[673,1785,1786],{"class":675,"line":865},[673,1787,1788],{},"    })\n",[398,1790,1792],{"id":1791},"performance-evaluation","Performance Evaluation",[11,1794,1795,1796,1798,1799,1801,1802,1804],{},"Now for the moment of truth: How does ",[410,1797,503],{}," stack up against the industry standard? We evaluated ",[410,1800,503],{}," in comparison to a grounded GUI snapshot baseline close to those used by ",[410,1803,161],{}," – coloured bounding boxes around visible interactive elements.",[11,1806,1807,1808,1813],{},"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 ",[365,1809,1812],{"href":1810,"rel":1811},"https://github.com/OSU-NLP-Group/Online-Mind2Web",[369],"Online-Mind2Web"," dataset.",[53,1815],{":width":56,"alt":1816,"format":360,"loading":58,"src":1817},"Exemplary solution UI state trajectory of a defined web-based task","/blog/dom-downsampling-for-web-agents/3.png",[11,1819,1820],{},[425,1821,1822],{},"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,1824,1825],{},"These are our key findings...",[572,1827,1829],{"id":1828},"substantial-success-rates","Substantial Success Rates",[11,1831,1832,1833,1835],{},"The results exceeded our expectations. Not only did ",[410,1834,503],{}," 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.",[53,1837],{":width":1838,"alt":1839,"format":360,"loading":58,"src":1840},"550","Success rate per web agent snapshot subject evaluated across the dataset","/blog/dom-downsampling-for-web-agents/4.png",[425,1842,1843,1844,1851,1852,1854,1855,1858,1859,1862,1863,1866,1867,1870,1871,1874,1875,1878],{},"\n  Success rate per web agent snapshot subject evaluated across the dataset.\n  Labels: ",[469,1845,1846,1847],{},"GUI",[1848,1849,1850],"sub",{}," gr.",": Baseline, ",[469,1853,1585],{},": Raw DOM (cut-off at ~8K tokens), ",[469,1856,1857],{},"k( l m)",": Parameter values; e.g., ",[469,1860,1861],{},".9 .3 .6",", or ",[469,1864,1865],{},".4"," if equal). ",[469,1868,1869],{},"∞",": Linearisation,  ",[469,1872,1873],{},"8192 / 32768",": via token-limited (resp.) ",[1876,1877,1425],"i",{},".\n",[572,1880,1882],{"id":1881},"containable-token-and-byte-size","Containable Token and Byte Size",[11,1884,1885,1886,1888],{},"Even light downsampling delivers dramatic size reductions. Most ",[410,1887,503],{}," 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.",[53,1890],{":width":56,"alt":1891,"format":360,"loading":58,"src":1892},"Comparison of mean input size across and per subject","/blog/dom-downsampling-for-web-agents/5.png",[425,1894,1895,1896,1899,1900,1902],{},"\n  Left: Comparison of mean input size (tokens vs bytes) across and per subject.",[1897,1898],"br",{},"\n  Right: Estimated input token size across the dataset created by a single ",[1876,1901,503],{}," evaluation subject.\n",[572,1904,1906],{"id":1905},"hierarchy-actually-matters","Hierarchy Actually Matters",[11,1908,1909],{},"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.",[583,1911,1914,1919],{"className":1912,"dataFootnotes":298},[1913],"footnotes",[62,1915,1918],{"className":1916,"id":442},[1917],"sr-only","Footnotes",[451,1920,1921,1936,1947,1958],{},[85,1922,1924,1928,1929],{"id":1923},"user-content-fn-1",[365,1925,1926],{"href":1926,"rel":1927},"https://arxiv.org/abs/2210.03945",[369]," ",[365,1930,1935],{"href":1931,"ariaLabel":1932,"className":1933,"dataFootnoteBackref":298},"#user-content-fnref-1","Back to reference 1",[1934],"data-footnote-backref","↩",[85,1937,1939,1928,1942],{"id":1938},"user-content-fn-2",[365,1940,509],{"href":509,"rel":1941},[369],[365,1943,1935],{"href":1944,"ariaLabel":1945,"className":1946,"dataFootnoteBackref":298},"#user-content-fnref-2","Back to reference 2",[1934],[85,1948,1950,1928,1953],{"id":1949},"user-content-fn-3",[365,1951,1463],{"href":1463,"rel":1952},[369],[365,1954,1935],{"href":1955,"ariaLabel":1956,"className":1957,"dataFootnoteBackref":298},"#user-content-fnref-3","Back to reference 3",[1934],[85,1959,1961,1928,1965],{"id":1960},"user-content-fn-4",[365,1962,1963],{"href":1963,"rel":1964},"https://aclanthology.org/W04-3252",[369],[365,1966,1935],{"href":1967,"ariaLabel":1968,"className":1969,"dataFootnoteBackref":298},"#user-content-fnref-4","Back to reference 4",[1934],[1971,1972,1973],"style",{},"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":298,"searchDepth":299,"depth":299,"links":1975},[1976,1980,1981,1988],{"id":388,"depth":299,"text":389,"children":1977},[1978,1979],{"id":400,"depth":784,"text":401},{"id":430,"depth":784,"text":431},{"id":482,"depth":299,"text":483},{"id":500,"depth":299,"text":503,"children":1982},[1983,1984,1985,1986,1987],{"id":537,"depth":784,"text":538},{"id":659,"depth":784,"text":660},{"id":1422,"depth":784,"text":1425},{"id":1437,"depth":784,"text":1438},{"id":1791,"depth":784,"text":1792},{"id":442,"depth":299,"text":1918},"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.",[1992,1995,1998,2001],{"question":1993,"answer":1994},"What is D2Snap?","D2Snap is a first-of-its-kind downsampling algorithm for DOMs, used as a pre-processing technique for DOM snapshots to optimise context quality and token costs for web agents. It reduces DOM data at a variable ratio while retaining HTML characteristics valuable to an LLM backend. It is available as an open source package on GitHub and via the Webfuse Automation API.",{"question":1996,"answer":1997},"Why are DOM snapshots better than screenshots for web agents?","DOM snapshots connect with the LLM's code interpretation abilities, since LLMs are better at understanding HTML than images. They can be compiled from deep clones hidden from supervision, allow exact programmatic targeting of elements via CSS selectors, and are available with the DOMContentLoaded event. Their main drawback is that a raw DOM snapshot can cost into the hundreds of thousands of tokens.",{"question":1999,"answer":2000},"How does D2Snap reduce DOM size?","D2Snap applies three node-specific procedures to elements, text, and attributes, each controlled by a parameter between 0 and 1. It merges container elements like section and div, drops the lowest-ranking sentences using the TextRank algorithm, and removes attributes whose UI feature degree falls below a threshold. Interactive elements such as buttons are always kept as interaction target candidates.",{"question":2002,"answer":2003},"Which DOM feature matters most for web agent performance?","Hierarchy is the strongest of the three assessed features for LLM web agent backend performance. Because element extraction techniques throw away hierarchy by flattening the DOM tree, the findings suggest downsampling is a superior technique. In evaluation, the best D2Snap configuration outperformed a grounded GUI snapshot baseline by a significant margin.",{"homepage":338,"relatedLinks":2005},[2006,2010,2013],{"text":2007,"href":2008,"description":2009},"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":2011,"href":1452,"description":2012},"What is a Web Agent?","Learn the basics of web agents",{"text":1711,"href":2014,"external":338,"description":2015},"https://dev.webfuse.com/automation-api#take_dom_snapshot","Check out the Webfuse Automation API","/blog/dom-downsampling-for-llm-based-web-agents",{"title":352,"description":1990},{"loc":2016},"blog/1012.dom-downsampling-for-llm-based-web-agents",[307,2021,2022,2023,344,2024],"browser-agents","llms","llm-context","web-automation","3AW7t_LHaZoj6crLrnjTJiPgPcfEFf1yJH9b-zX2Rkw",{"id":2027,"title":2028,"authorId":353,"body":2029,"category":307,"created":2759,"description":2760,"extension":310,"faqs":2761,"featurePriority":325,"head":325,"landingPath":325,"meta":2774,"navigation":338,"ogImage":325,"path":1452,"robots":325,"schemaOrg":325,"seo":2783,"sitemap":2784,"stem":2785,"tags":2786,"__hash__":2787},"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":2030,"toc":2740},[2031,2045,2048,2055,2061,2065,2068,2083,2087,2097,2101,2105,2118,2122,2126,2129,2134,2138,2147,2151,2162,2167,2171,2189,2193,2199,2303,2306,2539,2555,2559,2562,2567,2571,2574,2578,2596,2621,2628,2632,2670,2673,2684,2688,2691,2719,2723,2731,2737],[11,2032,2033,2034,371,2038,551,2041,2044],{},"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 ",[365,2035,370],{"href":2036,"rel":2037},"https://openai.com/index/introducing-operator/",[369],[365,2039,376],{"href":374,"rel":2040},[369],[365,2042,161],{"href":379,"rel":2043},[369],". By now, it is within reach to automate arbitrary web-based tasks, such as booking the cheapest flight from Berlin to Amsterdam.",[62,2046,2011],{"id":2047},"what-is-a-web-agent",[11,2049,2050,2051,2054],{},"For starters, let us break down the term ",[24,2052,2053],{},"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.",[53,2056],{":width":2057,"alt":2058,"format":2059,"loading":58,"src":2060},"610","High-level agent description comparing human and computer agents","svg","/blog/a-gentle-introduction-to-ai-agents-for-the-web/1.svg",[398,2062,2064],{"id":2063},"the-role-of-frontier-llms","The Role of Frontier LLMs",[11,2066,2067],{},"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,2069,2070,2071,2078,2079,2082],{},"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 (",[410,2072,2073,2074,2077],{},"“",[673,2075,2076],{},"..."," e4 e5 2. Nc3 f5”","), and the respective task (",[410,2080,2081],{},"“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.",[398,2084,2086],{"id":2085},"generalist-web-agents","Generalist Web Agents",[11,2088,2089,2090,551,2093,2096],{},"Generalist web agents are supposed to solve arbitrary tasks through a web browser. Web-based tasks can be as diverse as ",[410,2091,2092],{},"“Find a picture of a cat.”",[410,2094,2095],{},"“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.",[53,2098],{":width":358,"alt":2099,"format":360,"loading":58,"src":2100},"Screenshot of a generalist web agent UI (Director)","/blog/a-gentle-introduction-to-ai-agents-for-the-web/2.png",[398,2102,2104],{"id":2103},"specialist-web-agents","Specialist Web Agents",[11,2106,2107,2108,2111,2112,2117],{},"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 ",[410,2109,2110],{},"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 ",[365,2113,2116],{"href":2114,"rel":2115},"https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/system-prompts",[369],"system prompt"," can, moreover, be leveraged to drive specialist agent quality for the respective problem domain.",[53,2119],{":width":358,"alt":2120,"format":360,"loading":58,"src":2121},"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",[62,2123,2125],{"id":2124},"how-does-a-web-agent-work","How Does a Web Agent Work?",[11,2127,2128],{},"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).",[53,2130],{":width":2131,"alt":2132,"format":2059,"loading":58,"src":2133},"480","High-level web agent architecture component view","/blog/a-gentle-introduction-to-ai-agents-for-the-web/4.svg",[398,2135,2137],{"id":2136},"the-agent-lifecycle","The Agent Lifecycle",[11,2139,2140,2141,2146],{},"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 ",[365,2142,2145],{"href":2143,"rel":2144},"https://www.redfin.com",[369],"redfin.com",": In the first step, you specify a location. Only subsequently are you provided with a grid of available apartments for that location.",[53,2148],{":width":358,"alt":2149,"format":360,"loading":58,"src":2150},"Example of separated UI states in a rental home search application","/blog/a-gentle-introduction-to-ai-agents-for-the-web/5.png",[11,2152,2153,2154,2161],{},"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 ",[365,2155,2158],{"href":2156,"rel":2157},"https://mitpress.mit.edu/9780262640374/the-design-of-everyday-things/",[369],[410,2159,2160],{},"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.",[53,2163],{":width":2164,"alt":2165,"format":2059,"loading":58,"src":2166},"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",[398,2168,2170],{"id":2169},"web-context-for-llms","Web Context for LLMs",[11,2172,2173,2174,2176,2177,2180,2181,2184,2185,2188],{},"The gap from an agent towards the environment, according to ",[410,2175,2160],{},", is known as the ",[410,2178,2179],{},"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 ",[410,2182,2183],{},"gulf of intention"," towards the action planning stage: how to serialise a currently browsed web page's runtime state for LLMs? ",[410,2186,2187],{},"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?",[398,2190,2192],{"id":2191},"agentic-ui-interaction","Agentic UI Interaction",[11,2194,2195,2196,2198],{},"With a qualified set of well-defined actuation methods, web agents are able to close the ",[410,2197,2179],{}," 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:",[665,2200,2202],{"className":1469,"code":2201,"language":1471,"meta":298,"style":298},"interface ActuationSchema = {\n    thought: string;\n    action: \"click\"\n        | \"scroll\"\n        | \"type\";\n    cssSelector: string;\n    data?: string;\n}[];\n",[469,2203,2204,2218,2230,2247,2259,2271,2282,2293],{"__ignoreMap":298},[673,2205,2206,2209,2212,2215],{"class":675,"line":676},[673,2207,2208],{"class":1478},"interface",[673,2210,2211],{"class":1482}," ActuationSchema",[673,2213,2214],{"class":796}," = ",[673,2216,2217],{"class":1505},"{\n",[673,2219,2220,2223,2226,2228],{"class":675,"line":299},[673,2221,2222],{"class":796},"    thought",[673,2224,2225],{"class":679},":",[673,2227,1502],{"class":1501},[673,2229,1506],{"class":1505},[673,2231,2232,2235,2237,2240,2244],{"class":675,"line":784},[673,2233,2234],{"class":796},"    action",[673,2236,2225],{"class":679},[673,2238,2239],{"class":693}," \"",[673,2241,2243],{"class":2242},"sgAC-","click",[673,2245,2246],{"class":693},"\"\n",[673,2248,2249,2252,2254,2257],{"class":675,"line":807},[673,2250,2251],{"class":679},"        |",[673,2253,2239],{"class":693},[673,2255,2256],{"class":2242},"scroll",[673,2258,2246],{"class":693},[673,2260,2261,2263,2265,2267,2269],{"class":675,"line":816},[673,2262,2251],{"class":679},[673,2264,2239],{"class":693},[673,2266,1479],{"class":2242},[673,2268,694],{"class":693},[673,2270,1506],{"class":1505},[673,2272,2273,2276,2278,2280],{"class":675,"line":837},[673,2274,2275],{"class":796},"    cssSelector",[673,2277,2225],{"class":679},[673,2279,1502],{"class":1501},[673,2281,1506],{"class":1505},[673,2283,2284,2287,2289,2291],{"class":675,"line":856},[673,2285,2286],{"class":796},"    data",[673,2288,1527],{"class":679},[673,2290,1502],{"class":1501},[673,2292,1506],{"class":1505},[673,2294,2295,2298,2301],{"class":675,"line":865},[673,2296,2297],{"class":1505},"}",[673,2299,2300],{"class":796},"[]",[673,2302,1506],{"class":1505},[11,2304,2305],{},"And a suggested actions response could, in turn, look as follows:",[665,2307,2311],{"className":2308,"code":2309,"language":2310,"meta":298,"style":298},"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",[469,2312,2313,2318,2323,2347,2366,2384,2389,2393,2412,2430,2449,2467,2471,2475,2494,2512,2529,2534],{"__ignoreMap":298},[673,2314,2315],{"class":675,"line":676},[673,2316,2317],{"class":1505},"[\n",[673,2319,2320],{"class":675,"line":299},[673,2321,2322],{"class":1505},"    {\n",[673,2324,2325,2329,2333,2335,2337,2339,2343,2345],{"class":675,"line":784},[673,2326,2328],{"class":2327},"srFR9","        \"",[673,2330,2332],{"class":2331},"s30W1","thought",[673,2334,694],{"class":2327},[673,2336,2225],{"class":1505},[673,2338,2239],{"class":693},[673,2340,2342],{"class":2341},"sCC8C","Scroll newsletter cta into view",[673,2344,694],{"class":693},[673,2346,1588],{"class":1505},[673,2348,2349,2351,2354,2356,2358,2360,2362,2364],{"class":675,"line":807},[673,2350,2328],{"class":2327},[673,2352,2353],{"class":2331},"action",[673,2355,694],{"class":2327},[673,2357,2225],{"class":1505},[673,2359,2239],{"class":693},[673,2361,2256],{"class":2341},[673,2363,694],{"class":693},[673,2365,1588],{"class":1505},[673,2367,2368,2370,2373,2375,2377,2379,2382],{"class":675,"line":816},[673,2369,2328],{"class":2327},[673,2371,2372],{"class":2331},"cssSelector",[673,2374,694],{"class":2327},[673,2376,2225],{"class":1505},[673,2378,2239],{"class":693},[673,2380,2381],{"class":2341},"section#newsletter",[673,2383,2246],{"class":693},[673,2385,2386],{"class":675,"line":837},[673,2387,2388],{"class":1505},"    },\n",[673,2390,2391],{"class":675,"line":856},[673,2392,2322],{"class":1505},[673,2394,2395,2397,2399,2401,2403,2405,2408,2410],{"class":675,"line":865},[673,2396,2328],{"class":2327},[673,2398,2332],{"class":2331},[673,2400,694],{"class":2327},[673,2402,2225],{"class":1505},[673,2404,2239],{"class":693},[673,2406,2407],{"class":2341},"Type email address to newsletter cta",[673,2409,694],{"class":693},[673,2411,1588],{"class":1505},[673,2413,2414,2416,2418,2420,2422,2424,2426,2428],{"class":675,"line":871},[673,2415,2328],{"class":2327},[673,2417,2353],{"class":2331},[673,2419,694],{"class":2327},[673,2421,2225],{"class":1505},[673,2423,2239],{"class":693},[673,2425,1479],{"class":2341},[673,2427,694],{"class":693},[673,2429,1588],{"class":1505},[673,2431,2432,2434,2436,2438,2440,2442,2445,2447],{"class":675,"line":877},[673,2433,2328],{"class":2327},[673,2435,2372],{"class":2331},[673,2437,694],{"class":2327},[673,2439,2225],{"class":1505},[673,2441,2239],{"class":693},[673,2443,2444],{"class":2341},"section#newsletter > input",[673,2446,694],{"class":693},[673,2448,1588],{"class":1505},[673,2450,2451,2453,2456,2458,2460,2462,2465],{"class":675,"line":887},[673,2452,2328],{"class":2327},[673,2454,2455],{"class":2331},"data",[673,2457,694],{"class":2327},[673,2459,2225],{"class":1505},[673,2461,2239],{"class":693},[673,2463,2464],{"class":2341},"user@example.org",[673,2466,2246],{"class":693},[673,2468,2469],{"class":675,"line":916},[673,2470,2388],{"class":1505},[673,2472,2473],{"class":675,"line":926},[673,2474,2322],{"class":1505},[673,2476,2477,2479,2481,2483,2485,2487,2490,2492],{"class":675,"line":945},[673,2478,2328],{"class":2327},[673,2480,2332],{"class":2331},[673,2482,694],{"class":2327},[673,2484,2225],{"class":1505},[673,2486,2239],{"class":693},[673,2488,2489],{"class":2341},"Submit newsletter sign up",[673,2491,694],{"class":693},[673,2493,1588],{"class":1505},[673,2495,2496,2498,2500,2502,2504,2506,2508,2510],{"class":675,"line":963},[673,2497,2328],{"class":2327},[673,2499,2353],{"class":2331},[673,2501,694],{"class":2327},[673,2503,2225],{"class":1505},[673,2505,2239],{"class":693},[673,2507,2243],{"class":2341},[673,2509,694],{"class":693},[673,2511,1588],{"class":1505},[673,2513,2514,2516,2518,2520,2522,2524,2527],{"class":675,"line":972},[673,2515,2328],{"class":2327},[673,2517,2372],{"class":2331},[673,2519,694],{"class":2327},[673,2521,2225],{"class":1505},[673,2523,2239],{"class":693},[673,2525,2526],{"class":2341},"section#newsletter > button",[673,2528,2246],{"class":693},[673,2530,2531],{"class":675,"line":978},[673,2532,2533],{"class":1505},"    }\n",[673,2535,2536],{"class":675,"line":984},[673,2537,2538],{"class":1505},"]\n",[560,2540,2541],{},[11,2542,2543,2548,2549,2554],{},[365,2544,2547],{"href":2545,"rel":2546},"https://platform.openai.com/docs/guides/function-calling",[369],"Function Calling"," and the ",[365,2550,2553],{"href":2551,"rel":2552},"https://modelcontextprotocol.io",[369],"Model Context Protocol"," represent two ends to outsource an explicit actuation model – server- and client-side, respectively.",[398,2556,2558],{"id":2557},"agentic-ui-augmentation","Agentic UI Augmentation",[11,2560,2561],{},"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.",[53,2563],{":width":2564,"alt":2565,"format":2059,"loading":58,"src":2566},"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",[62,2568,2570],{"id":2569},"how-to-build-a-web-agent","How to Build a Web Agent?",[11,2572,2573],{},"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.",[398,2575,2577],{"id":2576},"develop-a-web-agent","Develop a Web Agent",[11,2579,2580,2581,2584,2585,551,2590,2595],{},"Opting for a ",[24,2582,2583],{},"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., ",[365,2586,2589],{"href":2587,"rel":2588},"https://elevenlabs.io/conversational-ai",[369],"ElevenLabs",[365,2591,2594],{"href":2592,"rel":2593},"https://www.intercom.com/drlp/ai-agent",[369],"Intercom",". Serviced agents hide LLM communication and potentially interaction with a web browser behind the configuration interface.",[11,2597,2598,2599,2602,2603,2608,2609,2614,2615,2620],{},"Using a ",[24,2600,2601],{},"templated agent"," resembles the agent-as-a-service approach on a lower level. Openly sourced from a ",[365,2604,2607],{"href":2605,"rel":2606},"https://github.com/webfuse-com/agent-extension-blueprint",[369],"code repository",", templated agents allow for any kind of development tweaks. Favourably, agent templates shortcut integration with ",[365,2610,2613],{"href":2611,"rel":2612},"https://openai.com/api/",[369],"LLM APIs"," and web ",[365,2616,2619],{"href":2617,"rel":2618},"https://developer.mozilla.org/en-US/docs/Web/API",[369],"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,2622,2623,2624,2627],{},"Of course, developing an ",[24,2625,2626],{},"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.",[398,2629,2631],{"id":2630},"deploy-a-web-agent","Deploy a Web Agent",[11,2633,2634,2635,584,2640,2645,2646,2651,2652,2657,2658,2663,2664,2669],{},"When web agent code lives side-by-side with the augmented application's code, agent deployment is covered by a generic pipeline. Something like: ",[365,2636,2639],{"href":2637,"rel":2638},"https://eslint.org",[369],"linting",[365,2641,2644],{"href":2642,"rel":2643},"https://prettier.io",[369],"formatting"," agent code, ",[365,2647,2650],{"href":2648,"rel":2649},"https://esbuild.github.io",[369],"transpiling and bundling"," agent modules, ",[365,2653,2656],{"href":2654,"rel":2655},"https://www.cypress.io",[369],"testing"," agent, ",[365,2659,2662],{"href":2660,"rel":2661},"https://pages.cloudflare.com",[369],"hosting"," agent bundle, and ",[365,2665,2668],{"href":2666,"rel":2667},"https://docs.github.com/en/actions/get-started/continuous-integration",[369],"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,2671,2672],{},"Web agent source code right inside the application codebase comes at a cost:",[82,2674,2675,2678,2681],{},[85,2676,2677],{},"Agent developers can manipulate the source code of the underlying application.",[85,2679,2680],{},"Agent functionality could introduce side effects on the underlying application.",[85,2682,2683],{},"Agent changes require deployment of the entire application.",[398,2685,2687],{"id":2686},"best-practices-of-agentic-ux","Best Practices of Agentic UX",[11,2689,2690],{},"When designing user experiences for agent-enhanced applications, there are a few things to consider:",[82,2692,2693,2694,2693,2703,2693,2711],{},"\n    ",[85,2695,2696,2697,2696,2700,2702],{},"\n        ",[24,2698,2699],{},"Stream input and output to reduce latency",[1897,2701],{},"\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    ",[85,2704,2696,2705,2696,2708,2710],{},[24,2706,2707],{},"Provide fine-grained feedback to bridge high-latency",[1897,2709],{},"\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    ",[85,2712,2696,2713,2696,2716,2718],{},[24,2714,2715],{},"Always prompt the human user for consent to perform critical actions",[1897,2717],{},"\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    ",[398,2720,2722],{"id":2721},"non-invasive-web-agents-with-webfuse","Non-Invasive Web Agents with Webfuse",[11,2724,2725,2730],{},[365,2726,2728],{"href":1715,"rel":2727},[369],[24,2729,70],{}," 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.",[2732,2733],"article-signup-cta",{":demoAction":2734,"heading":2735,"subtitle":2736},"{\"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.",[1971,2738,2739],{},"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":298,"searchDepth":299,"depth":299,"links":2741},[2742,2747,2753],{"id":2047,"depth":299,"text":2011,"children":2743},[2744,2745,2746],{"id":2063,"depth":784,"text":2064},{"id":2085,"depth":784,"text":2086},{"id":2103,"depth":784,"text":2104},{"id":2124,"depth":299,"text":2125,"children":2748},[2749,2750,2751,2752],{"id":2136,"depth":784,"text":2137},{"id":2169,"depth":784,"text":2170},{"id":2191,"depth":784,"text":2192},{"id":2557,"depth":784,"text":2558},{"id":2569,"depth":299,"text":2570,"children":2754},[2755,2756,2757,2758],{"id":2576,"depth":784,"text":2577},{"id":2630,"depth":784,"text":2631},{"id":2686,"depth":784,"text":2687},{"id":2721,"depth":784,"text":2722},"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.",[2762,2765,2768,2771],{"question":2763,"answer":2764},"What is a web AI agent?","A web AI agent is an application that autonomously acts on behalf of a human by operating a website through its user interface rather than its API. It uses a large language model to interpret the page and decide what to click, type, or scroll to complete a task. This human-like interaction lets it work on websites built for people rather than machines.",{"question":2766,"answer":2767},"What is the difference between a generalist and a specialist web agent?","A generalist web agent is built to solve arbitrary tasks across any website, while a specialist agent is constrained to one task and application domain. Generalist agents remain early proofs of concept and often fail on uncommon or highly precise tasks. Specialist agents, such as on-page chat and voice assistants, carry most of the current commercial value.",{"question":2769,"answer":2770},"How does a web agent work?","A web agent sits between a web browser and an LLM backend and runs an iterative loop. It serialises the page's current runtime state into a snapshot, sends that snapshot to the LLM along with the task, receives a planned action such as a click or keystroke, and executes it. It then evaluates the new page state and repeats the cycle until the result matches the declared goal.",{"question":2772,"answer":2773},"How do you build a web agent?","There are three main paths: use a pre-compiled agent configured through an agent-as-a-service provider, adapt an open-source templated agent, or develop one from scratch. Templated agents are usually the best balance, because they shortcut integration with LLM and browser APIs while still allowing full customisation.",{"homepage":338,"relatedLinks":2775},[2776,2777,2781],{"text":2007,"href":2008,"description":2009},{"text":2778,"href":2779,"description":2780},"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":1711,"href":2782,"external":338,"description":2015},"https://dev.webfuse.com/automation-api/",{"title":2028,"description":2760},{"loc":1452},"blog/1011.a-gentle-introduction-to-ai-agents-for-the-web",[307,2021,2022,344,2024],"IB7gPedi1oLYTLac9mfXKYLmZAOXLkFuxGa9Y4zDIhs",1783434593710]