[{"data":1,"prerenderedAt":3588},["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":364},{"id":4,"title":5,"authorId":6,"body":7,"category":317,"created":318,"description":319,"extension":320,"faqs":321,"featurePriority":334,"head":335,"hideCta":336,"landingPath":335,"meta":337,"navigation":353,"ogImage":335,"path":354,"robots":335,"schemaOrg":335,"seo":355,"sitemap":356,"stem":357,"tags":358,"__hash__":363},"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":307},"minimark",[10,14,17,46,49,52,61,66,72,75,78,81,103,106,109,112,118,122,126,129,132,135,155,158,161,165,169,172,175,179,182,202,205,208,212,215,218,221,241,244,247,251,254,257,260,280,283,286,290,294,297,301,304],[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-live-session-actuation-webfuse","1. Live-Session Actuation (Webfuse)",[53,67],{":height":68,":width":69,"alt":70,"loading":58,"src":71},"1508","2880","The Webfuse homepage, headlined \"Enable AI Agents to click on any Web App\", with the word click shown as a selected page element. The subtitle describes connecting an agent to the live web through the Model Context Protocol, giving the model eyes to see the DOM and hands to act on the user's behalf through one API with no install required","/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, which is our own product, 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],{},"Readiness handling:"," The layer buffers perception calls while the page is undergoing a significant UI shift, and an action can keep retrying its target for up to five seconds before giving up.",[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 layer holds perception calls back while the page is still shifting, rather than leaving the caller to guess at timing.",[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.",[113,114],"article-signup-cta",{"eyebrow":115,"heading":116,"highlight":117},"That is the augmentation proxy and the virtualization layer, working together.","Point your own agent at a live session.","live",[62,119,121],{"id":120},"_2-headless-browser-automation-playwright-puppeteer","2. Headless Browser Automation (Playwright / Puppeteer)",[53,123],{":height":68,":width":69,"alt":124,"loading":58,"src":125},"The Playwright homepage, headlined \"Playwright enables reliable web automation for testing, scripting, and AI agents\", describing one API that drives Chromium, Firefox and WebKit from TypeScript, Python, .NET and Java. Below the hero, three products are listed - Playwright Test for test running, Playwright CLI for token-efficient automation by coding agents, and Playwright MCP, a Model Context Protocol server giving agents browser control through accessibility snapshots","/blog/how-to-connect-an-ai-agent-to-the-live-web/playwright.png",[11,127,128],{},"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,130,131],{},"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,133,134],{},"This setup has a few practical strengths:",[82,136,137,143,149],{},[85,138,139,142],{},[24,140,141],{},"Direct DOM access:"," Automation scripts can read and modify the page directly, including running JavaScript in the page context.",[85,144,145,148],{},[24,146,147],{},"Network inspection:"," Frameworks can intercept, mock, or block requests, which is useful when the agent needs visibility into API calls and background traffic.",[85,150,151,154],{},[24,152,153],{},"Session isolation:"," Separate browser contexts help keep different agent runs isolated from one another.",[11,156,157],{},"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,159,160],{},"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,162,164],{"id":163},"_3-browser-use-and-agent-browser-frameworks","3. Browser-Use and Agent-Browser Frameworks",[53,166],{":height":68,":width":69,"alt":167,"loading":58,"src":168},"The Browser Use homepage, headlined \"The way AI uses the web\", with the tagline \"Agents at scale. Undetectable browsers. The API for any website.\" A banner advertises browser infrastructure at three times cheaper with sub-second cold starts, and the page carries a toggle between a human and a machine view of itself","/blog/how-to-connect-an-ai-agent-to-the-live-web/browser-use.png",[11,170,171],{},"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,173,174],{},"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,176],{":height":55,":width":56,"alt":177,"loading":58,"src":178,"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,180,181],{},"Common features in these frameworks include:",[82,183,184,190,196],{},[85,185,186,189],{},[24,187,188],{},"Markup compression:"," They filter the page down to the text and controls most relevant to the task.",[85,191,192,195],{},[24,193,194],{},"Visual annotations:"," Some frameworks draw numbered boxes over screenshots so multimodal models can target elements visually.",[85,197,198,201],{},[24,199,200],{},"Readiness checks:"," They can wait for loading, animation, or element readiness before carrying out the next step.",[11,203,204],{},"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,206,207],{},"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,209,211],{"id":210},"_4-remote-and-cloud-browsers","4. Remote and Cloud Browsers",[11,213,214],{},"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,216,217],{},"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,219,220],{},"These platforms often add features that are useful in large-scale automation:",[82,222,223,229,235],{},[85,224,225,228],{},[24,226,227],{},"Fingerprint control:"," They can adjust browser characteristics such as user agent, screen resolution, and hardware signals.",[85,230,231,234],{},[24,232,233],{},"Persistent profiles:"," They can keep cookies, local storage, and cache across runs.",[85,236,237,240],{},[24,238,239],{},"Built-in anti-bot support:"," Some platforms bundle CAPTCHA solving or other evasion tooling into the environment.",[11,242,243],{},"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,245,246],{},"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,248,250],{"id":249},"_5-webmcp-model-context-protocol-for-web","5. WebMCP (Model Context Protocol for Web)",[11,252,253],{},"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,255,256],{},"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,258,259],{},"This approach has a few clear advantages:",[82,261,262,268,274],{},[85,263,264,267],{},[24,265,266],{},"Deterministic execution:"," The agent calls defined functions instead of relying on fragile UI automation.",[85,269,270,273],{},[24,271,272],{},"Lower context load:"," The model works with structured schemas rather than large DOM snapshots.",[85,275,276,279],{},[24,277,278],{},"Explicit permissions:"," The site owner controls exactly which actions and data the agent can access.",[11,281,282],{},"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,284,285],{},"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.",[113,287],{"eyebrow":288,"heading":289,"highlight":117},"Four of these five reach the web through a browser you spin up.","Webfuse acts in the live session.",[62,291,293],{"id":292},"summary","Summary",[11,295,296],{},"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,298],{":height":55,":width":56,"alt":299,"loading":58,"src":300,"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,302,303],{},"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,305,306],{},"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":308,"searchDepth":309,"depth":309,"links":310},"",2,[311,312,313,314,315,316],{"id":64,"depth":309,"text":65},{"id":120,"depth":309,"text":121},{"id":163,"depth":309,"text":164},{"id":210,"depth":309,"text":211},{"id":249,"depth":309,"text":250},{"id":292,"depth":309,"text":293},"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",[322,325,328,331],{"question":323,"answer":324},"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":326,"answer":327},"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":329,"answer":330},"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":332,"answer":333},"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,false,{"shortTitle":338,"image":339,"relatedLinks":340},"Connect an AI Agent to the Live Web","/blog/how-to-connect-an-ai-agent-to-the-live-web.png",[341,345,349],{"text":342,"href":343,"description":344},"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":346,"href":347,"description":348},"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.",{"text":350,"href":351,"description":352},"What Is WebMCP? How It Works and How It Differs From MCP","/blog/what-is-webmcp-the-practical-guide-to-the-web-model-context-protocol","The full guide to the browser API that lets sites expose structured tools to AI agents.",true,"/blog/how-to-connect-an-ai-agent-to-the-live-web",{"title":5,"description":319},{"loc":354},"blog/1048.how-to-connect-an-ai-agent-to-the-live-web",[317,359,360,361,362],"web-agents","browser-automation","webmcp","actuation-layer","RLMHyIpXX63CJ8KuWHQR3oAU7edL5e2uR4DfS4s1XSI",[365,3094],{"id":366,"title":367,"authorId":368,"body":369,"category":317,"created":3075,"description":3076,"extension":320,"faqs":335,"featurePriority":335,"head":335,"hideCta":353,"landingPath":335,"meta":3077,"navigation":353,"ogImage":335,"path":3085,"robots":335,"schemaOrg":335,"seo":3086,"sitemap":3087,"stem":3088,"tags":3089,"__hash__":3093},"blog/blog/1013.serialising-web-ui-state-for-llms-the-complete-guide.md","Serialising Web UI State for LLMs: The Complete Guide","thassilo-schiepanski",{"type":8,"value":370,"toc":3058},[371,378,403,407,410,414,417,420,429,433,438,445,464,468,471,474,478,485,489,494,497,514,518,536,540,552,566,570,584,588,591,595,613,616,620,630,635,710,713,716,721,792,797,916,921,1030,1034,1045,1050,1352,1357,1511,1520,1524,1535,1540,1544,1548,1551,1554,1557,1665,1669,1672,1676,1679,1682,1687,1911,1916,2168,2173,2249,2254,2261,2270,2274,2277,2280,2283,2288,2297,2301,2641,2661,2714,2718,2721,2753,2908,2912,2915,2918,2922,2933,2936,2947,2953,3054],[11,372,373,374,377],{},"LLMs have become a core component of AI web browsing agents. Previously, automating a web journey required formal models of both web browsing and web-based user interfaces (UIs). An LLM can serve as a plug-in reasoning backend: given serialised web UI state, it is expected to suggest input actions that progress a specified web browsing task. Serialised UI state is, more ergonomically, referred to as a ",[24,375,376],{},"snapshot",".",[11,379,380,381,388,389,394,395,388,399,402],{},"Snapshots and action suggestions are the two key artefacts along the agent loop. Action suggestions are elicited from the web agent LLM backend. Suggestions can be acted out via automated web browser environments, such as ",[382,383,387],"a",{"href":384,"rel":385},"https://playwright.dev",[386],"nofollow","Playwright"," or ",[382,390,393],{"href":391,"rel":392},"https://www.webfuse.com",[386],"Webfuse",", for example, ",[396,397,398],"em",{},"clicking",[396,400,401],{},"typing",". The snapshot, on the other hand, is an artefact created by the agent harness, that is, the individual application component between the LLM and the web browser.",[53,404],{"src":405,":alt":406},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/1.svg","{\"Figurative depiction of two key artefacts along the agent loop\":\"the snapshot towards the LLM and the input action towards the browser\",\"provider\":\"none\",\"loading\":\"lazy\",\"width\":460}",[11,408,409],{},"Creating snapshots for LLMs is a central challenge of developing efficient web agents. It is a trade-off between representation utility – how well models can interpret the such encoded UI – and LLM token costs. Snapshots are the major cost factor of an agentic web journey, accumulated over multiple rounds of the loop.",[62,411,413],{"id":412},"gui-snapshots","GUI Snapshots",[11,415,416],{},"Screenshots, i.e., GUI snapshots, resemble what humans see when viewing a web page at a given point in time. Early LLM-based web agents were primarily premised on GUI snapshots because of this evident equivalence. By design, the GUI surfaces only the UI context designated to be visible to the user.",[11,418,419],{},"The document object model (DOM) is a web browser's model of a web application UI's runtime state. With few exceptions, the DOM is the single source of truth regarding the UI. Most snapshot representations are thus, technically speaking, derivatives of a raw DOM snapshot. For the cases not reflected in the DOM, GUI snapshots are a first-class base representation.",[11,421,422,423,428],{},"Rendering a GUI snapshot from the DOM is, moreover, non-trivial; no client-side library manages to create GUI snapshots in reasonable quality or time – ",[382,424,427],{"href":425,"rel":426},"https://html2canvas.hertzen.com",[386],"HTML2Canvas"," demonstrates the limits.",[53,430],{"src":431,"alt":432,"loading":58},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/2.png","The same web-based user interface serialised via browser-native screenshot API and the client-side library HTML2Canvas showing significant geometric differences",[434,435,437],"h3",{"id":436},"vision-based-targeting","Vision-Based Targeting",[11,439,440,441,444],{},"The snapshot representation dictates how elements can be targeted in the live UI. Unambiguous targeting based on a visual representation must be either geometric (absolute), e.g., via point coordinates, or semantic (relative), e.g., via cues, such as ",[396,442,443],{},"\"Button with Text 'Shop'\"",". On its own, semantic targeting introduces a circular problem: which element has this text?",[11,446,447,448,451,452,455,456,459,460,377],{},"Consider the web browsing task: ",[396,449,450],{},"\"Navigate to the Apple online shop\"",". In combination with an action, in this case ",[396,453,454],{},"click",", the agent could target the ",[396,457,458],{},"Shop"," button via a point coordinate, e.g., ",[461,462,463],"code",{},"(725, 750)",[53,465],{"src":466,"alt":467,"loading":58},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/3.png","A GUI snapshot (screenshot) visualising point coordinate targeting",[11,469,470],{},"When the UI shifts between snapshot and action time, geometric targeting suggestions might have become obsolete.",[11,472,473],{},"Depending on the web browser environment, screenshots might be constrained to the GUI viewport. Scrolling is a secondary task that is imperative with viewport-contrained GUI snapshots.",[434,475,477],{"id":476},"the-problem-with-gui-snapshots","The Problem with GUI Snapshots",[11,479,480,481,484],{},"Image data is downsampled to make it economically viable as input to LLMs. It reduces LLM input tokens to a few thousand for real-world-representative full-page screenshots. A common downsampling approach is averaging ",[396,482,483],{},"n×n","-tiles of pixels, as known from image downscaling. Side effects are: pixel-precise targeting does not map back to the live UI, and small geometric features are not preserved (e.g., small labels). Downsampling effects can be accounted for under certain circumstances, e.g., by providing a snapshot format that downsamples to its identity. However, GUI aspect ratio and detail might be beyond the agent's control.",[53,486],{"src":487,"alt":488,"loading":58},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/4.png","A GUI snapshot (screenshot) compared to its figuratively downsampled counterpart",[490,491,493],"h4",{"id":492},"grounded-gui-snapshots","Grounded GUI Snapshots",[11,495,496],{},"Geometric targeting remains unreliable with certain models and responsive UIs. To rely on semantic targeting instead, the agent must link relevant elements in the live UI to semantics in the screenshot. Relevance usually equates with actionability, but ultimately depends on the snapshot's purpose.",[11,498,499,502,503,513],{},[396,500,501],{},"Set-of-Mark"," prompting is the go-to technique to create grounded GUI snapshots",[504,505,506],"sup",{},[382,507,512],{"href":508,"ariaDescribedBy":509,"dataFootnoteRef":308,"id":511},"#user-content-fn-1",[510],"footnote-label","user-content-fnref-1","1",". In this context, relevant elements are parsed from the live DOM and indexed with a unique numeric identifier. Each indexed element in the live UI is then enhanced with a coloured bounding box associated with the respective identifier.",[53,515],{"src":516,"alt":517,"loading":58},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/5.png","A GUI snapshot (screenshot) visualising grounded cue targeting",[11,519,520,527,528,377],{},[382,521,524],{"href":522,"rel":523},"https://browser-use.com",[386],[396,525,526],{},"Browser Use"," agents implement Set-of-Mark-grounded GUI snapshots",[504,529,530],{},[382,531,535],{"href":532,"ariaDescribedBy":533,"dataFootnoteRef":308,"id":534},"#user-content-fn-2",[510],"user-content-fnref-2","2",[62,537,539],{"id":538},"dom-snapshots","DOM Snapshots",[11,541,542,543,551],{},"The DOM is parsed from HTML. In its latest state it can be serialised back to HTML – including all runtime mutations. Research has supported LLMs' capabilities to interpret HTML, and even to navigate such encoded UIs",[504,544,545],{},[382,546,550],{"href":547,"ariaDescribedBy":548,"dataFootnoteRef":308,"id":549},"#user-content-fn-3",[510],"user-content-fnref-3","3",". For that reason, DOM snapshots are a compelling alternative to GUI snapshots. LLMs excel at code generation and review, so these capabilities are no surprise.",[11,553,554,555,558,559,562,563,565],{},"Cross-origin ",[461,556,557],{},"iframe"," elements and ",[461,560,561],{},"canvas"," elements are exceptions to the DOM-is-source-of-truth assumption: ",[461,564,561],{},"-drawn GUI is not reflected in the DOM, nor are external, self-contained DOM subtrees if no explicit policy allows it. Structurally, both are leaves in the serialisable DOM tree.",[434,567,569],{"id":568},"dom-based-targeting","DOM-Based Targeting",[11,571,572,573,576,577,580,581,377],{},"Programmatically, DOM elements can be targeted by different relative means. CSS selectors abstract targeting with a standalone language. Whilst CSS selectors can resolve to more than one element in the DOM – compare semantics of the HTML ",[461,574,575],{},"class"," and ",[461,578,579],{},"id"," attributes – every element has at least one unique CSS selector, constructed from nth-child node paths, e.g., ",[461,582,583],{},"main .section:nth-child(2) > .row:nth-of-type(5) > form button",[53,585],{"src":586,"alt":587,"loading":58},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/6.png","A DOM snapshot (HTML) visualising CSS selector targeting",[11,589,590],{},"A raw DOM snapshot is complete, beyond the GUI that renders in the spatially limited browser viewport. For a human-like visual browsing experience, scrolling can be abstracted by an indirect scroll-target-into-view mechanism.",[434,592,594],{"id":593},"the-problem-with-dom-snapshots","The Problem with DOM Snapshots",[11,596,597,598,603,604,612],{},"DOM snapshots of real-world web pages may come at a size of several megabytes, which converts to millions of LLM input tokens – we estimate a raw snapshot of ",[382,599,602],{"href":600,"rel":601},"https://edition.cnn.com",[386],"cnn.com"," at around 1.5M tokens. At this size, DOM snapshots over-utilise the context window of many LLMs, or even exceed it (such as of ",[382,605,608,611],{"href":606,"rel":607},"https://openai.com/index/gpt-4o-system-card/",[386],[396,609,610],{},"GPT-4o"," (OpenAI)","). Ultimately, raw DOM snapshots out-cost GUI snapshots.",[11,614,615],{},"Using DOM snapshots with LLM-based web agents requires size-reducing transformations, similar to image downsampling implemented behind LLM APIs.",[490,617,619],{"id":618},"extracted-dom-snapshots","Extracted DOM Snapshots",[11,621,622,623,626,627,629],{},"The naïve approach to use information from the DOM as a snapshot is element extraction: relevant elements are copied from the live DOM to an initially empty virtual DOM. For small top-",[396,624,625],{},"k"," extractions – the ",[396,628,625],{}," highest-scoring elements – a snapshot of the virtual DOM comes at a fraction of the original DOM's size.",[11,631,632],{},[24,633,634],{},"Top-3 DOM Snapshot:",[636,637,641],"pre",{"className":638,"code":639,"language":640,"meta":308,"style":308},"language-html shiki shiki-themes github-dark github-dark","\u003Cbutton type=\"submit\">Submit\u003C/button>\n\u003Cbutton>More\u003C/button>\n\u003Ca href=\"/more\">Find out more\u003C/a>\n","html",[461,642,643,675,688],{"__ignoreMap":308},[644,645,648,652,656,660,663,667,670,672],"span",{"class":646,"line":647},"line",1,[644,649,651],{"class":650},"suv1-","\u003C",[644,653,655],{"class":654},"sxg3X","button",[644,657,659],{"class":658},"sFR8T"," type",[644,661,662],{"class":650},"=",[644,664,666],{"class":665},"s4wv1","\"submit\"",[644,668,669],{"class":650},">Submit\u003C/",[644,671,655],{"class":654},[644,673,674],{"class":650},">\n",[644,676,677,679,681,684,686],{"class":646,"line":309},[644,678,651],{"class":650},[644,680,655],{"class":654},[644,682,683],{"class":650},">More\u003C/",[644,685,655],{"class":654},[644,687,674],{"class":650},[644,689,691,693,695,698,700,703,706,708],{"class":646,"line":690},3,[644,692,651],{"class":650},[644,694,382],{"class":654},[644,696,697],{"class":658}," href",[644,699,662],{"class":650},[644,701,702],{"class":665},"\"/more\"",[644,704,705],{"class":650},">Find out more\u003C/",[644,707,382],{"class":654},[644,709,674],{"class":650},[11,711,712],{},"If done manually, element extraction presupposes correct assumptions about which elements and element properties count as relevant. Alternatively, element relevance scoring can be outsourced to an LLM, at the cost of another inference step.",[11,714,715],{},"Extraction disposes of deep DOM hierarchy, which might be salient to the web agent LLM backend. From the below extracted DOM snapshot alone, the original content relationship is lost:",[11,717,718],{},[24,719,720],{},"Extracted DOM Snapshot:",[636,722,724],{"className":638,"code":723,"language":640,"meta":308,"style":308},"\u003Cstrong>MacBook Air\u003C/strong>\n\u003Cbutton>Add to cart\u003C/button>\n\u003Cp>Out of stock\u003C/p>\n\u003Ch2>MacBook Pro\u003C/h2>\n\u003Cbutton>Add to cart\u003C/button>\n",[461,725,726,739,752,765,779],{"__ignoreMap":308},[644,727,728,730,732,735,737],{"class":646,"line":647},[644,729,651],{"class":650},[644,731,24],{"class":654},[644,733,734],{"class":650},">MacBook Air\u003C/",[644,736,24],{"class":654},[644,738,674],{"class":650},[644,740,741,743,745,748,750],{"class":646,"line":309},[644,742,651],{"class":650},[644,744,655],{"class":654},[644,746,747],{"class":650},">Add to cart\u003C/",[644,749,655],{"class":654},[644,751,674],{"class":650},[644,753,754,756,758,761,763],{"class":646,"line":690},[644,755,651],{"class":650},[644,757,11],{"class":654},[644,759,760],{"class":650},">Out of stock\u003C/",[644,762,11],{"class":654},[644,764,674],{"class":650},[644,766,768,770,772,775,777],{"class":646,"line":767},4,[644,769,651],{"class":650},[644,771,62],{"class":654},[644,773,774],{"class":650},">MacBook Pro\u003C/",[644,776,62],{"class":654},[644,778,674],{"class":650},[644,780,782,784,786,788,790],{"class":646,"line":781},5,[644,783,651],{"class":650},[644,785,655],{"class":654},[644,787,747],{"class":650},[644,789,655],{"class":654},[644,791,674],{"class":650},[11,793,794],{},[24,795,796],{},"Original DOM Snapshot – Candidate A:",[636,798,800],{"className":638,"code":799,"language":640,"meta":308,"style":308},"\u003Csection class=\"product\">\n  \u003Cstrong>MacBook Air\u003C/strong>\n  \u003Cbutton>Add to cart\u003C/button>\n  \u003Cp>Out of stock\u003C/p>  👈\n\u003C/section>\n\u003Csection class=\"product\">\n  \u003Cstrong>MacBook Pro\u003C/strong>\n  \u003Cbutton>Add to cart\u003C/button>\n\u003C/section>\n",[461,801,802,819,832,844,857,866,881,894,907],{"__ignoreMap":308},[644,803,804,806,809,812,814,817],{"class":646,"line":647},[644,805,651],{"class":650},[644,807,808],{"class":654},"section",[644,810,811],{"class":658}," class",[644,813,662],{"class":650},[644,815,816],{"class":665},"\"product\"",[644,818,674],{"class":650},[644,820,821,824,826,828,830],{"class":646,"line":309},[644,822,823],{"class":650},"  \u003C",[644,825,24],{"class":654},[644,827,734],{"class":650},[644,829,24],{"class":654},[644,831,674],{"class":650},[644,833,834,836,838,840,842],{"class":646,"line":690},[644,835,823],{"class":650},[644,837,655],{"class":654},[644,839,747],{"class":650},[644,841,655],{"class":654},[644,843,674],{"class":650},[644,845,846,848,850,852,854],{"class":646,"line":767},[644,847,823],{"class":650},[644,849,11],{"class":654},[644,851,760],{"class":650},[644,853,11],{"class":654},[644,855,856],{"class":650},">  👈\n",[644,858,859,862,864],{"class":646,"line":781},[644,860,861],{"class":650},"\u003C/",[644,863,808],{"class":654},[644,865,674],{"class":650},[644,867,869,871,873,875,877,879],{"class":646,"line":868},6,[644,870,651],{"class":650},[644,872,808],{"class":654},[644,874,811],{"class":658},[644,876,662],{"class":650},[644,878,816],{"class":665},[644,880,674],{"class":650},[644,882,884,886,888,890,892],{"class":646,"line":883},7,[644,885,823],{"class":650},[644,887,24],{"class":654},[644,889,774],{"class":650},[644,891,24],{"class":654},[644,893,674],{"class":650},[644,895,897,899,901,903,905],{"class":646,"line":896},8,[644,898,823],{"class":650},[644,900,655],{"class":654},[644,902,747],{"class":650},[644,904,655],{"class":654},[644,906,674],{"class":650},[644,908,910,912,914],{"class":646,"line":909},9,[644,911,861],{"class":650},[644,913,808],{"class":654},[644,915,674],{"class":650},[11,917,918],{},[24,919,920],{},"Original DOM Snapshot – Candidate B:",[636,922,924],{"className":638,"code":923,"language":640,"meta":308,"style":308},"\u003Csection class=\"product\">\n  \u003Cstrong>MacBook Air\u003C/strong>\n  \u003Cbutton>Add to cart\u003C/button>\n\u003C/section>\n\u003Csection class=\"product\">\n  \u003Cp>Out of stock\u003C/p>  👈\n  \u003Cstrong>MacBook Pro\u003C/strong>\n  \u003Cbutton>Add to cart\u003C/button>\n\u003C/section>\n",[461,925,926,940,952,964,972,986,998,1010,1022],{"__ignoreMap":308},[644,927,928,930,932,934,936,938],{"class":646,"line":647},[644,929,651],{"class":650},[644,931,808],{"class":654},[644,933,811],{"class":658},[644,935,662],{"class":650},[644,937,816],{"class":665},[644,939,674],{"class":650},[644,941,942,944,946,948,950],{"class":646,"line":309},[644,943,823],{"class":650},[644,945,24],{"class":654},[644,947,734],{"class":650},[644,949,24],{"class":654},[644,951,674],{"class":650},[644,953,954,956,958,960,962],{"class":646,"line":690},[644,955,823],{"class":650},[644,957,655],{"class":654},[644,959,747],{"class":650},[644,961,655],{"class":654},[644,963,674],{"class":650},[644,965,966,968,970],{"class":646,"line":767},[644,967,861],{"class":650},[644,969,808],{"class":654},[644,971,674],{"class":650},[644,973,974,976,978,980,982,984],{"class":646,"line":781},[644,975,651],{"class":650},[644,977,808],{"class":654},[644,979,811],{"class":658},[644,981,662],{"class":650},[644,983,816],{"class":665},[644,985,674],{"class":650},[644,987,988,990,992,994,996],{"class":646,"line":868},[644,989,823],{"class":650},[644,991,11],{"class":654},[644,993,760],{"class":650},[644,995,11],{"class":654},[644,997,856],{"class":650},[644,999,1000,1002,1004,1006,1008],{"class":646,"line":883},[644,1001,823],{"class":650},[644,1003,24],{"class":654},[644,1005,774],{"class":650},[644,1007,24],{"class":654},[644,1009,674],{"class":650},[644,1011,1012,1014,1016,1018,1020],{"class":646,"line":896},[644,1013,823],{"class":650},[644,1015,655],{"class":654},[644,1017,747],{"class":650},[644,1019,655],{"class":654},[644,1021,674],{"class":650},[644,1023,1024,1026,1028],{"class":646,"line":909},[644,1025,861],{"class":650},[644,1027,808],{"class":654},[644,1029,674],{"class":650},[490,1031,1033],{"id":1032},"downsampled-dom-snapshots","Downsampled DOM Snapshots",[11,1035,1036,1037,377],{},"Downsampling means reducing data point count whilst preserving the overall data shape and most of the relevant features. Picture an image being downsized: the depicted object remains recognisable to a large degree. The concept of image downsampling can be transferred to the DOM by locally 'averaging' DOM subtrees – trading fidelity for size",[504,1038,1039],{},[382,1040,1044],{"href":1041,"ariaDescribedBy":1042,"dataFootnoteRef":308,"id":1043},"#user-content-fn-4",[510],"user-content-fnref-4","4",[11,1046,1047],{},[24,1048,1049],{},"Original DOM Snapshot:",[636,1051,1053],{"className":638,"code":1052,"language":640,"meta":308,"style":308},"\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: mozzarella, 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",[461,1054,1055,1093,1124,1139,1147,1163,1177,1185,1190,1195,1205,1226,1236,1251,1265,1274,1280,1286,1295,1314,1323,1333,1343],{"__ignoreMap":308},[644,1056,1057,1059,1061,1063,1065,1068,1071,1073,1076,1079,1081,1084,1086,1088,1091],{"class":646,"line":647},[644,1058,651],{"class":650},[644,1060,808],{"class":654},[644,1062,811],{"class":658},[644,1064,662],{"class":650},[644,1066,1067],{"class":665},"\"container\"",[644,1069,1070],{"class":658}," tabindex",[644,1072,662],{"class":650},[644,1074,1075],{"class":665},"\"3\"",[644,1077,1078],{"class":658}," required",[644,1080,662],{"class":650},[644,1082,1083],{"class":665},"\"true\"",[644,1085,659],{"class":658},[644,1087,662],{"class":650},[644,1089,1090],{"class":665},"\"example\"",[644,1092,674],{"class":650},[644,1094,1095,1097,1100,1102,1104,1107,1110,1112,1115,1117,1119,1122],{"class":646,"line":309},[644,1096,823],{"class":650},[644,1098,1099],{"class":654},"div",[644,1101,811],{"class":658},[644,1103,662],{"class":650},[644,1105,1106],{"class":665},"\"mx-auto\"",[644,1108,1109],{"class":658}," data-topic",[644,1111,662],{"class":650},[644,1113,1114],{"class":665},"\"products\"",[644,1116,1078],{"class":658},[644,1118,662],{"class":650},[644,1120,1121],{"class":665},"\"false\"",[644,1123,674],{"class":650},[644,1125,1126,1129,1132,1135,1137],{"class":646,"line":690},[644,1127,1128],{"class":650},"    \u003C",[644,1130,1131],{"class":654},"h1",[644,1133,1134],{"class":650},">Our Pizza\u003C/",[644,1136,1131],{"class":654},[644,1138,674],{"class":650},[644,1140,1141,1143,1145],{"class":646,"line":767},[644,1142,1128],{"class":650},[644,1144,1099],{"class":654},[644,1146,674],{"class":650},[644,1148,1149,1152,1154,1156,1158,1161],{"class":646,"line":781},[644,1150,1151],{"class":650},"      \u003C",[644,1153,1099],{"class":654},[644,1155,811],{"class":658},[644,1157,662],{"class":650},[644,1159,1160],{"class":665},"\"shadow-lg\"",[644,1162,674],{"class":650},[644,1164,1165,1168,1170,1173,1175],{"class":646,"line":868},[644,1166,1167],{"class":650},"        \u003C",[644,1169,62],{"class":654},[644,1171,1172],{"class":650},">Margherita\u003C/",[644,1174,62],{"class":654},[644,1176,674],{"class":650},[644,1178,1179,1181,1183],{"class":646,"line":883},[644,1180,1167],{"class":650},[644,1182,11],{"class":654},[644,1184,674],{"class":650},[644,1186,1187],{"class":646,"line":896},[644,1188,1189],{"class":650},"         A simple classic: mozzarella, tomatoes and basil.\n",[644,1191,1192],{"class":646,"line":909},[644,1193,1194],{"class":650},"         An everyday choice!\n",[644,1196,1198,1201,1203],{"class":646,"line":1197},10,[644,1199,1200],{"class":650},"        \u003C/",[644,1202,11],{"class":654},[644,1204,674],{"class":650},[644,1206,1208,1210,1212,1214,1216,1219,1222,1224],{"class":646,"line":1207},11,[644,1209,1167],{"class":650},[644,1211,655],{"class":654},[644,1213,659],{"class":658},[644,1215,662],{"class":650},[644,1217,1218],{"class":665},"\"button\"",[644,1220,1221],{"class":650},">Add\u003C/",[644,1223,655],{"class":654},[644,1225,674],{"class":650},[644,1227,1229,1232,1234],{"class":646,"line":1228},12,[644,1230,1231],{"class":650},"      \u003C/",[644,1233,1099],{"class":654},[644,1235,674],{"class":650},[644,1237,1239,1241,1243,1245,1247,1249],{"class":646,"line":1238},13,[644,1240,1151],{"class":650},[644,1242,1099],{"class":654},[644,1244,811],{"class":658},[644,1246,662],{"class":650},[644,1248,1160],{"class":665},[644,1250,674],{"class":650},[644,1252,1254,1256,1258,1261,1263],{"class":646,"line":1253},14,[644,1255,1167],{"class":650},[644,1257,62],{"class":654},[644,1259,1260],{"class":650},">Capricciosa\u003C/",[644,1262,62],{"class":654},[644,1264,674],{"class":650},[644,1266,1268,1270,1272],{"class":646,"line":1267},15,[644,1269,1167],{"class":650},[644,1271,11],{"class":654},[644,1273,674],{"class":650},[644,1275,1277],{"class":646,"line":1276},16,[644,1278,1279],{"class":650},"          A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[644,1281,1283],{"class":646,"line":1282},17,[644,1284,1285],{"class":650},"          A true favourite!\n",[644,1287,1289,1291,1293],{"class":646,"line":1288},18,[644,1290,1200],{"class":650},[644,1292,11],{"class":654},[644,1294,674],{"class":650},[644,1296,1298,1300,1302,1304,1306,1308,1310,1312],{"class":646,"line":1297},19,[644,1299,1167],{"class":650},[644,1301,655],{"class":654},[644,1303,659],{"class":658},[644,1305,662],{"class":650},[644,1307,1218],{"class":665},[644,1309,1221],{"class":650},[644,1311,655],{"class":654},[644,1313,674],{"class":650},[644,1315,1317,1319,1321],{"class":646,"line":1316},20,[644,1318,1231],{"class":650},[644,1320,1099],{"class":654},[644,1322,674],{"class":650},[644,1324,1326,1329,1331],{"class":646,"line":1325},21,[644,1327,1328],{"class":650},"    \u003C/",[644,1330,1099],{"class":654},[644,1332,674],{"class":650},[644,1334,1336,1339,1341],{"class":646,"line":1335},22,[644,1337,1338],{"class":650},"  \u003C/",[644,1340,1099],{"class":654},[644,1342,674],{"class":650},[644,1344,1346,1348,1350],{"class":646,"line":1345},23,[644,1347,861],{"class":650},[644,1349,808],{"class":654},[644,1351,674],{"class":650},[11,1353,1354],{},[24,1355,1356],{},"Downsampled DOM Snapshot:",[636,1358,1360],{"className":638,"code":1359,"language":640,"meta":308,"style":308},"\u003Csection class=\"container\" required=\"true\" type=\"example\">\n  \u003Cdiv class=\"mx-auto\" required=\"false\">\n    Our Pizza\n    \u003Cdiv>\n      Margherita\n      A simple classic: mozzarella, tomatoes and basil.\n      An everyday choice!\n      \u003Cbutton type=\"button\">Add\u003C/button>\n      Capricciosa\n      A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n      A true favourite!\n      \u003Cbutton type=\"button\">Add\u003C/button>\n    \u003C/div>\n  \u003C/div>\n\u003C/section>\n",[461,1361,1362,1388,1408,1413,1421,1426,1431,1436,1454,1459,1464,1469,1487,1495,1503],{"__ignoreMap":308},[644,1363,1364,1366,1368,1370,1372,1374,1376,1378,1380,1382,1384,1386],{"class":646,"line":647},[644,1365,651],{"class":650},[644,1367,808],{"class":654},[644,1369,811],{"class":658},[644,1371,662],{"class":650},[644,1373,1067],{"class":665},[644,1375,1078],{"class":658},[644,1377,662],{"class":650},[644,1379,1083],{"class":665},[644,1381,659],{"class":658},[644,1383,662],{"class":650},[644,1385,1090],{"class":665},[644,1387,674],{"class":650},[644,1389,1390,1392,1394,1396,1398,1400,1402,1404,1406],{"class":646,"line":309},[644,1391,823],{"class":650},[644,1393,1099],{"class":654},[644,1395,811],{"class":658},[644,1397,662],{"class":650},[644,1399,1106],{"class":665},[644,1401,1078],{"class":658},[644,1403,662],{"class":650},[644,1405,1121],{"class":665},[644,1407,674],{"class":650},[644,1409,1410],{"class":646,"line":690},[644,1411,1412],{"class":650},"    Our Pizza\n",[644,1414,1415,1417,1419],{"class":646,"line":767},[644,1416,1128],{"class":650},[644,1418,1099],{"class":654},[644,1420,674],{"class":650},[644,1422,1423],{"class":646,"line":781},[644,1424,1425],{"class":650},"      Margherita\n",[644,1427,1428],{"class":646,"line":868},[644,1429,1430],{"class":650},"      A simple classic: mozzarella, tomatoes and basil.\n",[644,1432,1433],{"class":646,"line":883},[644,1434,1435],{"class":650},"      An everyday choice!\n",[644,1437,1438,1440,1442,1444,1446,1448,1450,1452],{"class":646,"line":896},[644,1439,1151],{"class":650},[644,1441,655],{"class":654},[644,1443,659],{"class":658},[644,1445,662],{"class":650},[644,1447,1218],{"class":665},[644,1449,1221],{"class":650},[644,1451,655],{"class":654},[644,1453,674],{"class":650},[644,1455,1456],{"class":646,"line":909},[644,1457,1458],{"class":650},"      Capricciosa\n",[644,1460,1461],{"class":646,"line":1197},[644,1462,1463],{"class":650},"      A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[644,1465,1466],{"class":646,"line":1207},[644,1467,1468],{"class":650},"      A true favourite!\n",[644,1470,1471,1473,1475,1477,1479,1481,1483,1485],{"class":646,"line":1228},[644,1472,1151],{"class":650},[644,1474,655],{"class":654},[644,1476,659],{"class":658},[644,1478,662],{"class":650},[644,1480,1218],{"class":665},[644,1482,1221],{"class":650},[644,1484,655],{"class":654},[644,1486,674],{"class":650},[644,1488,1489,1491,1493],{"class":646,"line":1238},[644,1490,1328],{"class":650},[644,1492,1099],{"class":654},[644,1494,674],{"class":650},[644,1496,1497,1499,1501],{"class":646,"line":1253},[644,1498,1338],{"class":650},[644,1500,1099],{"class":654},[644,1502,674],{"class":650},[644,1504,1505,1507,1509],{"class":646,"line":1267},[644,1506,861],{"class":650},[644,1508,808],{"class":654},[644,1510,674],{"class":650},[11,1512,1513,1514,377],{},"When downsampling is defined over different types of nodes – for instance, elements, attributes, and text – it becomes a powerful technique to control DOM size in a snapshot pipeline. Adaptive implementations can moreover produce snapshots that fall below a hard token limit. Our evaluation revealed that moderate downsampling ratios comfortably fit the mean DOM snapshot of real-world-representative web pages within GPT-4o's context window – leaving headroom for an agent system prompt and a trace of reasoning and action history",[504,1515,1516],{},[382,1517,1044],{"href":1041,"ariaDescribedBy":1518,"dataFootnoteRef":308,"id":1519},[510],"user-content-fnref-4-2",[434,1521,1523],{"id":1522},"the-problem-with-dom-based-targeting","The Problem with DOM-Based Targeting",[11,1525,1526,1527,1530,1531,1534],{},"When DOM snapshots are transformation artefacts, relative CSS selectors like nth-child paths might not map back to the live DOM. There are two straightforward ways to account for breaking CSS selectors: (1) assigning unique IDs to relevant elements in the live UI that persist transformations (e.g., via a unique attribute ",[461,1528,1529],{},"UNIQUE-ID=\"27\"",", which can be selected via ",[461,1532,1533],{},"[UNIQUE-ID=\"27\"]","), and (2) maintaining a source map between elements in the live DOM and the transformed DOM. The latter approach does favourably not affect the snapshot directly.",[11,1536,1537],{},[24,1538,1539],{},"DOM Snapshot with Inlined IDs:",[53,1541],{"src":1542,"alt":1543,"loading":58},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/7.png","A DOM snapshot (HTML) visualising unique ID (attribute) targeting",[434,1545,1547],{"id":1546},"the-dom-based-snapshot-pipeline","The DOM-Based Snapshot Pipeline",[11,1549,1550],{},"LLMs are able to reason over HTML. Yet, HTML carries noise, such as obfuscated scripts or hidden subtrees. DOM snapshots should for that reason be seen as a base representation, rather than a target representation.",[11,1552,1553],{},"The concept of DOM downsampling can be utilised as a universal size control in a snapshot pipeline – ideally exposed as quality, the inverse property of downsampling. Moreover, the DOM can be pre-transformed by deterministic techniques, such as pruning hidden subtrees to surface only the tangible UI – a characteristic that is natural with GUI snapshots.",[11,1555,1556],{},"The pipeline approach traceably goes from the raw DOM to an abstract snapshot representation. For example:",[1558,1559,1560,1583,1589,1647,1653,1659],"ol",{},[85,1561,1562,1565,1566,1571,1572,1575,1576,576,1579,1582],{},[24,1563,1564],{},"Scope Subtree."," Scope in to a task-relevant subtree. An information retrieval task on ",[382,1567,1570],{"href":1568,"rel":1569},"https://www.wikipedia.org",[386],"wikipedia.org"," can scope into the ",[461,1573,1574],{},"main"," element – ",[461,1577,1578],{},"header",[461,1580,1581],{},"footer"," are irrelevant.",[85,1584,1585,1588],{},[24,1586,1587],{},"Clone."," Clone the live DOM.",[85,1590,1591,1594,1595],{},[24,1592,1593],{},"Filter."," Apply arbitrary filters to the cloned DOM (in memory). For example:\n",[82,1596,1597,1635,1641],{},[85,1598,1599,1602,1603],{},[24,1600,1601],{},"Prune Subtrees"," E.g.:\n",[82,1604,1605,1611,1617],{},[85,1606,1607,1610],{},[24,1608,1609],{},"Non-interactive Nodes",", e.g., hidden elements.",[85,1612,1613,1616],{},[24,1614,1615],{},"Irrelevant Nodes",", e.g., comment nodes.",[85,1618,1619,1622,1623,1625,1626,1628,1629,1632,1633,377],{},[24,1620,1621],{},"Redundant Nodes",", e.g., ",[461,1624,382],{}," in the ",[461,1627,1581],{}," that has a same-",[461,1630,1631],{},"href"," equivalent in the ",[461,1634,1578],{},[85,1636,1637,1640],{},[24,1638,1639],{},"Sanitise."," E.g., sensitive information from content-editables.",[85,1642,1643,1646],{},[24,1644,1645],{},"Clean."," E.g., remove stop words from text nodes.",[85,1648,1649,1652],{},[24,1650,1651],{},"Serialise."," Serialise the cloned DOM to HTML.",[85,1654,1655,1658],{},[24,1656,1657],{},"Downsample."," Downsample the HTML to control size.",[85,1660,1661,1664],{},[24,1662,1663],{},"Translate."," Translate the downsampled HTML to any DOM-based representation, e.g., the accessibility tree.",[53,1666],{"src":1667,"alt":1668,"loading":58,"provider":60},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/8.svg","Example of a DOM snapshot pipeline",[11,1670,1671],{},"A filtered DOM drastically increases stability of repeatedly run web journeys: if only a single button routes to a target page, the agent perceives an unambiguous action target element. The rule of thumb is: the less actionable options a snapshot transcribes, the better – given all relevant options are covered.",[490,1673,1675],{"id":1674},"arbitrary-snapshot-representations","Arbitrary Snapshot Representations",[11,1677,1678],{},"Any text-based snapshot representation can be derived from the single-source-of-truth DOM. Which representation is best highly depends on the given web browsing task. A high-level distinction is between (A) navigation and (B) information retrieval tasks. Navigation tasks do not require extensive text, but  actionable elements – if a snapshot omits a relevant button, the LLM is not able to use the encoded UI. Information retrieval tasks, on the other hand, require text, as the text contains topical information, whilst actionable elements do not matter.",[11,1680,1681],{},"Compare the following snapshots representations for the same UI:",[11,1683,1684],{},[24,1685,1686],{},"DOM Snapshot:",[636,1688,1690],{"className":638,"code":1689,"language":640,"meta":308,"style":308},"\u003Csection class=\"container\" required=\"true\" type=\"example\">\n  \u003Cdiv class=\"mx-auto\" required=\"false\">\n    \u003Ch1>Our Pizza\u003C/h1>\n    \u003Cdiv>\n      \u003Ch2>Margherita\u003C/h2>\n      \u003Cp>\n        A simple classic: mozzarella, tomatoes and basil.\n        An everyday choice!\n      \u003C/p>\n      \u003Ca href=\"add?p=margherita\" data-uid=\"1\">Add\u003C/a>\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      \u003Ca href=\"add?p=capricciosa\" data-uid=\"2\">Add\u003C/a>\n    \u003C/div>\n  \u003C/div>\n\u003C/section>\n",[461,1691,1692,1718,1738,1750,1758,1770,1778,1783,1788,1796,1823,1835,1843,1848,1853,1861,1887,1895,1903],{"__ignoreMap":308},[644,1693,1694,1696,1698,1700,1702,1704,1706,1708,1710,1712,1714,1716],{"class":646,"line":647},[644,1695,651],{"class":650},[644,1697,808],{"class":654},[644,1699,811],{"class":658},[644,1701,662],{"class":650},[644,1703,1067],{"class":665},[644,1705,1078],{"class":658},[644,1707,662],{"class":650},[644,1709,1083],{"class":665},[644,1711,659],{"class":658},[644,1713,662],{"class":650},[644,1715,1090],{"class":665},[644,1717,674],{"class":650},[644,1719,1720,1722,1724,1726,1728,1730,1732,1734,1736],{"class":646,"line":309},[644,1721,823],{"class":650},[644,1723,1099],{"class":654},[644,1725,811],{"class":658},[644,1727,662],{"class":650},[644,1729,1106],{"class":665},[644,1731,1078],{"class":658},[644,1733,662],{"class":650},[644,1735,1121],{"class":665},[644,1737,674],{"class":650},[644,1739,1740,1742,1744,1746,1748],{"class":646,"line":690},[644,1741,1128],{"class":650},[644,1743,1131],{"class":654},[644,1745,1134],{"class":650},[644,1747,1131],{"class":654},[644,1749,674],{"class":650},[644,1751,1752,1754,1756],{"class":646,"line":767},[644,1753,1128],{"class":650},[644,1755,1099],{"class":654},[644,1757,674],{"class":650},[644,1759,1760,1762,1764,1766,1768],{"class":646,"line":781},[644,1761,1151],{"class":650},[644,1763,62],{"class":654},[644,1765,1172],{"class":650},[644,1767,62],{"class":654},[644,1769,674],{"class":650},[644,1771,1772,1774,1776],{"class":646,"line":868},[644,1773,1151],{"class":650},[644,1775,11],{"class":654},[644,1777,674],{"class":650},[644,1779,1780],{"class":646,"line":883},[644,1781,1782],{"class":650},"        A simple classic: mozzarella, tomatoes and basil.\n",[644,1784,1785],{"class":646,"line":896},[644,1786,1787],{"class":650},"        An everyday choice!\n",[644,1789,1790,1792,1794],{"class":646,"line":909},[644,1791,1231],{"class":650},[644,1793,11],{"class":654},[644,1795,674],{"class":650},[644,1797,1798,1800,1802,1804,1806,1809,1812,1814,1817,1819,1821],{"class":646,"line":1197},[644,1799,1151],{"class":650},[644,1801,382],{"class":654},[644,1803,697],{"class":658},[644,1805,662],{"class":650},[644,1807,1808],{"class":665},"\"add?p=margherita\"",[644,1810,1811],{"class":658}," data-uid",[644,1813,662],{"class":650},[644,1815,1816],{"class":665},"\"1\"",[644,1818,1221],{"class":650},[644,1820,382],{"class":654},[644,1822,674],{"class":650},[644,1824,1825,1827,1829,1831,1833],{"class":646,"line":1207},[644,1826,1151],{"class":650},[644,1828,62],{"class":654},[644,1830,1260],{"class":650},[644,1832,62],{"class":654},[644,1834,674],{"class":650},[644,1836,1837,1839,1841],{"class":646,"line":1228},[644,1838,1151],{"class":650},[644,1840,11],{"class":654},[644,1842,674],{"class":650},[644,1844,1845],{"class":646,"line":1238},[644,1846,1847],{"class":650},"        A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[644,1849,1850],{"class":646,"line":1253},[644,1851,1852],{"class":650},"        A true favourite!\n",[644,1854,1855,1857,1859],{"class":646,"line":1267},[644,1856,1231],{"class":650},[644,1858,11],{"class":654},[644,1860,674],{"class":650},[644,1862,1863,1865,1867,1869,1871,1874,1876,1878,1881,1883,1885],{"class":646,"line":1276},[644,1864,1151],{"class":650},[644,1866,382],{"class":654},[644,1868,697],{"class":658},[644,1870,662],{"class":650},[644,1872,1873],{"class":665},"\"add?p=capricciosa\"",[644,1875,1811],{"class":658},[644,1877,662],{"class":650},[644,1879,1880],{"class":665},"\"2\"",[644,1882,1221],{"class":650},[644,1884,382],{"class":654},[644,1886,674],{"class":650},[644,1888,1889,1891,1893],{"class":646,"line":1282},[644,1890,1328],{"class":650},[644,1892,1099],{"class":654},[644,1894,674],{"class":650},[644,1896,1897,1899,1901],{"class":646,"line":1288},[644,1898,1338],{"class":650},[644,1900,1099],{"class":654},[644,1902,674],{"class":650},[644,1904,1905,1907,1909],{"class":646,"line":1297},[644,1906,861],{"class":650},[644,1908,808],{"class":654},[644,1910,674],{"class":650},[11,1912,1913],{},[24,1914,1915],{},"Accessibility Tree Snapshot:",[636,1917,1921],{"className":1918,"code":1919,"language":1920,"meta":308,"style":308},"language-yaml shiki shiki-themes github-dark github-dark","- document:\n  children:\n    - section:\n      children:\n        - heading:\n          name: \"Our Pizza\"\n          level: 1\n        - heading:\n          name: \"Margherita\"\n          level: 2\n        - paragraph:\n          children:\n            - text: \"A simple classic: mozzarella, tomatoes and basil. An everyday choice!\"\n        - link:\n          name: \"Add\"\n          url: \"add?p=margherita\"\n          data-uid: 1\n        - heading:\n          name: \"Capricciosa\"\n          level: 2\n        - paragraph:\n          children:\n            - text: \"A rich taste: mozzarella, ham, mushrooms, artichokes and olives. A true favourite!\"\n        - link:\n          name: \"Add\"\n          url: \"add?p=capricciosa\"\n          data-uid: 2\n","yaml",[461,1922,1923,1934,1941,1950,1957,1967,1978,1989,1997,2006,2015,2024,2031,2044,2053,2062,2072,2081,2089,2098,2106,2114,2120,2131,2140,2149,2159],{"__ignoreMap":308},[644,1924,1925,1928,1931],{"class":646,"line":647},[644,1926,1927],{"class":650},"- ",[644,1929,1930],{"class":654},"document",[644,1932,1933],{"class":650},":\n",[644,1935,1936,1939],{"class":646,"line":309},[644,1937,1938],{"class":654},"  children",[644,1940,1933],{"class":650},[644,1942,1943,1946,1948],{"class":646,"line":690},[644,1944,1945],{"class":650},"    - ",[644,1947,808],{"class":654},[644,1949,1933],{"class":650},[644,1951,1952,1955],{"class":646,"line":767},[644,1953,1954],{"class":654},"      children",[644,1956,1933],{"class":650},[644,1958,1959,1962,1965],{"class":646,"line":781},[644,1960,1961],{"class":650},"        - ",[644,1963,1964],{"class":654},"heading",[644,1966,1933],{"class":650},[644,1968,1969,1972,1975],{"class":646,"line":868},[644,1970,1971],{"class":654},"          name",[644,1973,1974],{"class":650},": ",[644,1976,1977],{"class":665},"\"Our Pizza\"\n",[644,1979,1980,1983,1985],{"class":646,"line":883},[644,1981,1982],{"class":654},"          level",[644,1984,1974],{"class":650},[644,1986,1988],{"class":1987},"s8ozJ","1\n",[644,1990,1991,1993,1995],{"class":646,"line":896},[644,1992,1961],{"class":650},[644,1994,1964],{"class":654},[644,1996,1933],{"class":650},[644,1998,1999,2001,2003],{"class":646,"line":909},[644,2000,1971],{"class":654},[644,2002,1974],{"class":650},[644,2004,2005],{"class":665},"\"Margherita\"\n",[644,2007,2008,2010,2012],{"class":646,"line":1197},[644,2009,1982],{"class":654},[644,2011,1974],{"class":650},[644,2013,2014],{"class":1987},"2\n",[644,2016,2017,2019,2022],{"class":646,"line":1207},[644,2018,1961],{"class":650},[644,2020,2021],{"class":654},"paragraph",[644,2023,1933],{"class":650},[644,2025,2026,2029],{"class":646,"line":1228},[644,2027,2028],{"class":654},"          children",[644,2030,1933],{"class":650},[644,2032,2033,2036,2039,2041],{"class":646,"line":1238},[644,2034,2035],{"class":650},"            - ",[644,2037,2038],{"class":654},"text",[644,2040,1974],{"class":650},[644,2042,2043],{"class":665},"\"A simple classic: mozzarella, tomatoes and basil. An everyday choice!\"\n",[644,2045,2046,2048,2051],{"class":646,"line":1253},[644,2047,1961],{"class":650},[644,2049,2050],{"class":654},"link",[644,2052,1933],{"class":650},[644,2054,2055,2057,2059],{"class":646,"line":1267},[644,2056,1971],{"class":654},[644,2058,1974],{"class":650},[644,2060,2061],{"class":665},"\"Add\"\n",[644,2063,2064,2067,2069],{"class":646,"line":1276},[644,2065,2066],{"class":654},"          url",[644,2068,1974],{"class":650},[644,2070,2071],{"class":665},"\"add?p=margherita\"\n",[644,2073,2074,2077,2079],{"class":646,"line":1282},[644,2075,2076],{"class":654},"          data-uid",[644,2078,1974],{"class":650},[644,2080,1988],{"class":1987},[644,2082,2083,2085,2087],{"class":646,"line":1288},[644,2084,1961],{"class":650},[644,2086,1964],{"class":654},[644,2088,1933],{"class":650},[644,2090,2091,2093,2095],{"class":646,"line":1297},[644,2092,1971],{"class":654},[644,2094,1974],{"class":650},[644,2096,2097],{"class":665},"\"Capricciosa\"\n",[644,2099,2100,2102,2104],{"class":646,"line":1316},[644,2101,1982],{"class":654},[644,2103,1974],{"class":650},[644,2105,2014],{"class":1987},[644,2107,2108,2110,2112],{"class":646,"line":1325},[644,2109,1961],{"class":650},[644,2111,2021],{"class":654},[644,2113,1933],{"class":650},[644,2115,2116,2118],{"class":646,"line":1335},[644,2117,2028],{"class":654},[644,2119,1933],{"class":650},[644,2121,2122,2124,2126,2128],{"class":646,"line":1345},[644,2123,2035],{"class":650},[644,2125,2038],{"class":654},[644,2127,1974],{"class":650},[644,2129,2130],{"class":665},"\"A rich taste: mozzarella, ham, mushrooms, artichokes and olives. A true favourite!\"\n",[644,2132,2134,2136,2138],{"class":646,"line":2133},24,[644,2135,1961],{"class":650},[644,2137,2050],{"class":654},[644,2139,1933],{"class":650},[644,2141,2143,2145,2147],{"class":646,"line":2142},25,[644,2144,1971],{"class":654},[644,2146,1974],{"class":650},[644,2148,2061],{"class":665},[644,2150,2152,2154,2156],{"class":646,"line":2151},26,[644,2153,2066],{"class":654},[644,2155,1974],{"class":650},[644,2157,2158],{"class":665},"\"add?p=capricciosa\"\n",[644,2160,2162,2164,2166],{"class":646,"line":2161},27,[644,2163,2076],{"class":654},[644,2165,1974],{"class":650},[644,2167,2014],{"class":1987},[11,2169,2170],{},[24,2171,2172],{},"Markdown Snapshot:",[636,2174,2177],{"className":2175,"code":2176,"language":320,"meta":308,"style":308},"language-md shiki shiki-themes github-dark github-dark","# Our Pizza\n\n## Margherita\n\nA simple classic: mozzarella, tomatoes and basil.\nAn everyday choice!\n\n[Add](add?p=margherita)\n\n## Capricciosa\n\nA rich taste: mozzarella, ham, mushrooms, artichokes and olives.\nA true favourite!\n\n[Add](add?p=capricciosa)\n",[461,2178,2179,2184,2189,2194,2198,2203,2208,2212,2217,2221,2226,2230,2235,2240,2244],{"__ignoreMap":308},[644,2180,2181],{"class":646,"line":647},[644,2182,2183],{},"# Our Pizza\n",[644,2185,2186],{"class":646,"line":309},[644,2187,2188],{"emptyLinePlaceholder":353},"\n",[644,2190,2191],{"class":646,"line":690},[644,2192,2193],{},"## Margherita\n",[644,2195,2196],{"class":646,"line":767},[644,2197,2188],{"emptyLinePlaceholder":353},[644,2199,2200],{"class":646,"line":781},[644,2201,2202],{},"A simple classic: mozzarella, tomatoes and basil.\n",[644,2204,2205],{"class":646,"line":868},[644,2206,2207],{},"An everyday choice!\n",[644,2209,2210],{"class":646,"line":883},[644,2211,2188],{"emptyLinePlaceholder":353},[644,2213,2214],{"class":646,"line":896},[644,2215,2216],{},"[Add](add?p=margherita)\n",[644,2218,2219],{"class":646,"line":909},[644,2220,2188],{"emptyLinePlaceholder":353},[644,2222,2223],{"class":646,"line":1197},[644,2224,2225],{},"## Capricciosa\n",[644,2227,2228],{"class":646,"line":1207},[644,2229,2188],{"emptyLinePlaceholder":353},[644,2231,2232],{"class":646,"line":1228},[644,2233,2234],{},"A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[644,2236,2237],{"class":646,"line":1238},[644,2238,2239],{},"A true favourite!\n",[644,2241,2242],{"class":646,"line":1253},[644,2243,2188],{"emptyLinePlaceholder":353},[644,2245,2246],{"class":646,"line":1267},[644,2247,2248],{},"[Add](add?p=capricciosa)\n",[11,2250,2251],{},[24,2252,2253],{},"Custom Format Snapshot:",[636,2255,2259],{"className":2256,"code":2258,"language":2038},[2257],"language-text","[0] H1 \"Our Pizza\"\n[1] H2 \"Margherita\"\n[2] P \"A simple classic: mozzarella, tomatoes and basil.\\nAn everyday choice!\"\n[3] A \"Add\" \"add?p=margherita\"\n[4] H2 \"Capricciosa\"\n[5] P \"A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\\nA true...\"\n[6] A \"Add\" \"add?p=capricciosa\"\n",[461,2260,2258],{"__ignoreMap":308},[11,2262,2263,2264,377],{},"Browser Use agents implement hybrid snapshots: the grounded GUI snapshot is a supplement to a custom-format indexed-list DOM snapshot, similar to the above example. Evaluations show that the indexed-list snapshot representation generally conveys most of the salient UI features for the web agent LLM backend",[504,2265,2266],{},[382,2267,1044],{"href":1041,"ariaDescribedBy":2268,"dataFootnoteRef":308,"id":2269},[510],"user-content-fnref-4-3",[62,2271,2273],{"id":2272},"non-idiomatic-application-designs","Non-Idiomatic Application Designs",[11,2275,2276],{},"An actionable element might lack affordance – not communicating its actionability through its bare appearance. That is bad UI/UX design practice. The concept extends to the DOM through HTML semantics, which communicate the general purpose of an element to web browsers and developers rather than users. Generalising to web agent LLM backends, the concept of affordance aligns between the GUI and the DOM – the model is a UI representation-agnostic user.",[11,2278,2279],{},"Missing affordances should be rectified in a snapshot wherever they can be discovered. Discoverability is another circular problem: what is an indirect affordance for actionability? Ideally, the underlying actionability is tracked, such as by checking for attached action event listeners. However, there is no browser API for this practice.",[11,2281,2282],{},"As an example for bad affordance in the GUI, imagine an overly subtle 'Shop' button. Bounding boxes in grounded GUI snapshots are a workaround – provided the element is discoverable as actionable in the DOM in the first place.",[53,2284],{"src":2285,"alt":2286,"loading":58,":width":2287},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/9.png","Example of a fictional UI/UX bad practice (overly subtle button)","480",[11,2289,2290,2291,2296],{},"As an example for bad affordance in the DOM, look at this datepicker from ",[382,2292,2295],{"href":2293,"rel":2294},"https://www.webmd.com",[386],"webmd.com",":",[53,2298],{"src":2299,"alt":2300,"loading":58,":width":2287},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/10.png","Example of an HTML bad practice (ignoring tag name semantics)",[636,2302,2304],{"className":638,"code":2303,"language":640,"meta":308,"style":308},"\u003Cdiv>\n  \u003Cspan class=\"cell day-header\">Sun\u003C/span>\n  \u003Cspan class=\"cell day-header\">Mon\u003C/span>\n  \u003Cspan class=\"cell day-header\">Tue\u003C/span>\n  \u003Cspan class=\"cell day-header\">Wed\u003C/span>\n  \u003Cspan class=\"cell day-header\">Thu\u003C/span>\n  \u003Cspan class=\"cell day-header\">Fri\u003C/span>\n  \u003Cspan class=\"cell day-header\">Sat\u003C/span>\n  \u003C!-- [...] -->\n  \u003Cspan class=\"cell day blank\">\u003C/span>\n  \u003Cspan class=\"cell day blank\">\u003C/span>\n  \u003Cspan class=\"cell day\">\u003Cspan>1\u003C/span>\u003C/span>\n  \u003Cspan class=\"cell day\">\u003Cspan>2\u003C/span>\u003C/span>\n  \u003Cspan class=\"cell day\">\u003Cspan>3\u003C/span>\u003C/span>\n  \u003C!-- [...] -->\n  \u003Cspan class=\"cell day\">\u003Cspan>29\u003C/span>\u003C/span>\n  \u003Cspan class=\"cell day\">\u003Cspan>30\u003C/span>\u003C/span>\n\u003C/div>\n",[461,2305,2306,2314,2334,2353,2372,2391,2410,2429,2448,2454,2474,2492,2521,2548,2575,2579,2606,2633],{"__ignoreMap":308},[644,2307,2308,2310,2312],{"class":646,"line":647},[644,2309,651],{"class":650},[644,2311,1099],{"class":654},[644,2313,674],{"class":650},[644,2315,2316,2318,2320,2322,2324,2327,2330,2332],{"class":646,"line":309},[644,2317,823],{"class":650},[644,2319,644],{"class":654},[644,2321,811],{"class":658},[644,2323,662],{"class":650},[644,2325,2326],{"class":665},"\"cell day-header\"",[644,2328,2329],{"class":650},">Sun\u003C/",[644,2331,644],{"class":654},[644,2333,674],{"class":650},[644,2335,2336,2338,2340,2342,2344,2346,2349,2351],{"class":646,"line":690},[644,2337,823],{"class":650},[644,2339,644],{"class":654},[644,2341,811],{"class":658},[644,2343,662],{"class":650},[644,2345,2326],{"class":665},[644,2347,2348],{"class":650},">Mon\u003C/",[644,2350,644],{"class":654},[644,2352,674],{"class":650},[644,2354,2355,2357,2359,2361,2363,2365,2368,2370],{"class":646,"line":767},[644,2356,823],{"class":650},[644,2358,644],{"class":654},[644,2360,811],{"class":658},[644,2362,662],{"class":650},[644,2364,2326],{"class":665},[644,2366,2367],{"class":650},">Tue\u003C/",[644,2369,644],{"class":654},[644,2371,674],{"class":650},[644,2373,2374,2376,2378,2380,2382,2384,2387,2389],{"class":646,"line":781},[644,2375,823],{"class":650},[644,2377,644],{"class":654},[644,2379,811],{"class":658},[644,2381,662],{"class":650},[644,2383,2326],{"class":665},[644,2385,2386],{"class":650},">Wed\u003C/",[644,2388,644],{"class":654},[644,2390,674],{"class":650},[644,2392,2393,2395,2397,2399,2401,2403,2406,2408],{"class":646,"line":868},[644,2394,823],{"class":650},[644,2396,644],{"class":654},[644,2398,811],{"class":658},[644,2400,662],{"class":650},[644,2402,2326],{"class":665},[644,2404,2405],{"class":650},">Thu\u003C/",[644,2407,644],{"class":654},[644,2409,674],{"class":650},[644,2411,2412,2414,2416,2418,2420,2422,2425,2427],{"class":646,"line":883},[644,2413,823],{"class":650},[644,2415,644],{"class":654},[644,2417,811],{"class":658},[644,2419,662],{"class":650},[644,2421,2326],{"class":665},[644,2423,2424],{"class":650},">Fri\u003C/",[644,2426,644],{"class":654},[644,2428,674],{"class":650},[644,2430,2431,2433,2435,2437,2439,2441,2444,2446],{"class":646,"line":896},[644,2432,823],{"class":650},[644,2434,644],{"class":654},[644,2436,811],{"class":658},[644,2438,662],{"class":650},[644,2440,2326],{"class":665},[644,2442,2443],{"class":650},">Sat\u003C/",[644,2445,644],{"class":654},[644,2447,674],{"class":650},[644,2449,2450],{"class":646,"line":909},[644,2451,2453],{"class":2452},"sJ8bj","  \u003C!-- [...] -->\n",[644,2455,2456,2458,2460,2462,2464,2467,2470,2472],{"class":646,"line":1197},[644,2457,823],{"class":650},[644,2459,644],{"class":654},[644,2461,811],{"class":658},[644,2463,662],{"class":650},[644,2465,2466],{"class":665},"\"cell day blank\"",[644,2468,2469],{"class":650},">\u003C/",[644,2471,644],{"class":654},[644,2473,674],{"class":650},[644,2475,2476,2478,2480,2482,2484,2486,2488,2490],{"class":646,"line":1207},[644,2477,823],{"class":650},[644,2479,644],{"class":654},[644,2481,811],{"class":658},[644,2483,662],{"class":650},[644,2485,2466],{"class":665},[644,2487,2469],{"class":650},[644,2489,644],{"class":654},[644,2491,674],{"class":650},[644,2493,2494,2496,2498,2500,2502,2505,2508,2510,2513,2515,2517,2519],{"class":646,"line":1228},[644,2495,823],{"class":650},[644,2497,644],{"class":654},[644,2499,811],{"class":658},[644,2501,662],{"class":650},[644,2503,2504],{"class":665},"\"cell day\"",[644,2506,2507],{"class":650},">\u003C",[644,2509,644],{"class":654},[644,2511,2512],{"class":650},">1\u003C/",[644,2514,644],{"class":654},[644,2516,2469],{"class":650},[644,2518,644],{"class":654},[644,2520,674],{"class":650},[644,2522,2523,2525,2527,2529,2531,2533,2535,2537,2540,2542,2544,2546],{"class":646,"line":1238},[644,2524,823],{"class":650},[644,2526,644],{"class":654},[644,2528,811],{"class":658},[644,2530,662],{"class":650},[644,2532,2504],{"class":665},[644,2534,2507],{"class":650},[644,2536,644],{"class":654},[644,2538,2539],{"class":650},">2\u003C/",[644,2541,644],{"class":654},[644,2543,2469],{"class":650},[644,2545,644],{"class":654},[644,2547,674],{"class":650},[644,2549,2550,2552,2554,2556,2558,2560,2562,2564,2567,2569,2571,2573],{"class":646,"line":1253},[644,2551,823],{"class":650},[644,2553,644],{"class":654},[644,2555,811],{"class":658},[644,2557,662],{"class":650},[644,2559,2504],{"class":665},[644,2561,2507],{"class":650},[644,2563,644],{"class":654},[644,2565,2566],{"class":650},">3\u003C/",[644,2568,644],{"class":654},[644,2570,2469],{"class":650},[644,2572,644],{"class":654},[644,2574,674],{"class":650},[644,2576,2577],{"class":646,"line":1267},[644,2578,2453],{"class":2452},[644,2580,2581,2583,2585,2587,2589,2591,2593,2595,2598,2600,2602,2604],{"class":646,"line":1276},[644,2582,823],{"class":650},[644,2584,644],{"class":654},[644,2586,811],{"class":658},[644,2588,662],{"class":650},[644,2590,2504],{"class":665},[644,2592,2507],{"class":650},[644,2594,644],{"class":654},[644,2596,2597],{"class":650},">29\u003C/",[644,2599,644],{"class":654},[644,2601,2469],{"class":650},[644,2603,644],{"class":654},[644,2605,674],{"class":650},[644,2607,2608,2610,2612,2614,2616,2618,2620,2622,2625,2627,2629,2631],{"class":646,"line":1282},[644,2609,823],{"class":650},[644,2611,644],{"class":654},[644,2613,811],{"class":658},[644,2615,662],{"class":650},[644,2617,2504],{"class":665},[644,2619,2507],{"class":650},[644,2621,644],{"class":654},[644,2623,2624],{"class":650},">30\u003C/",[644,2626,644],{"class":654},[644,2628,2469],{"class":650},[644,2630,644],{"class":654},[644,2632,674],{"class":650},[644,2634,2635,2637,2639],{"class":646,"line":1288},[644,2636,861],{"class":650},[644,2638,1099],{"class":654},[644,2640,674],{"class":650},[11,2642,2643,2644,2646,2647,2650,2651,2653,2654,2657,2658,2660],{},"The days wrapped in ",[461,2645,644],{}," (e.g., ",[461,2648,2649],{},"16",") are clickable, but the HTML communicates no such actionability. The idiomatic DOM equivalent would instead use ",[461,2652,655],{}," elements throughout, or at least assign suitable ",[461,2655,2656],{},"role"," attributes like ",[461,2659,655],{},". A DOM snapshot pipeline leaves space for solving this problem: rewrite the virtual DOM with idiomatic elements.",[636,2662,2664],{"className":638,"code":2663,"language":640,"meta":308,"style":308},"  \u003Cbutton class=\"cell day\">29\u003C/button>\n  \u003C!-- OR -->\n  \u003Cspan role=\"button\" class=\"cell day\">30\u003C/button>\n",[461,2665,2666,2684,2689],{"__ignoreMap":308},[644,2667,2668,2670,2672,2674,2676,2678,2680,2682],{"class":646,"line":647},[644,2669,823],{"class":650},[644,2671,655],{"class":654},[644,2673,811],{"class":658},[644,2675,662],{"class":650},[644,2677,2504],{"class":665},[644,2679,2597],{"class":650},[644,2681,655],{"class":654},[644,2683,674],{"class":650},[644,2685,2686],{"class":646,"line":309},[644,2687,2688],{"class":2452},"  \u003C!-- OR -->\n",[644,2690,2691,2693,2695,2698,2700,2702,2704,2706,2708,2710,2712],{"class":646,"line":690},[644,2692,823],{"class":650},[644,2694,644],{"class":654},[644,2696,2697],{"class":658}," role",[644,2699,662],{"class":650},[644,2701,1218],{"class":665},[644,2703,811],{"class":658},[644,2705,662],{"class":650},[644,2707,2504],{"class":665},[644,2709,2624],{"class":650},[644,2711,655],{"class":654},[644,2713,674],{"class":650},[62,2715,2717],{"id":2716},"choosing-between-snapshot-representations","Choosing Between Snapshot Representations",[11,2719,2720],{},"No snapshot representation fits all purposes; the two base representations alone – GUI and DOM (HTML) – come with markedly different advantages and limitations. A proper snapshot tool should therefore route and cascade:",[1558,2722,2723,2735,2741,2747],{},[85,2724,2725,2728,2729,2731,2732,2734],{},[24,2726,2727],{},"Route Modality."," Fall back to GUI snapshots if the UI is based on ",[461,2730,561],{}," or cross-origin ",[461,2733,557],{}," elements; use DOM snapshots by default.",[85,2736,2737,2740],{},[24,2738,2739],{},"Route Representation."," Categorise task and translate DOM snapshot to the most suitable representation. Categorising the task can be done with increasing levels of machine learning – simple keyword matching, or deploying a language model.",[85,2742,2743,2746],{},[24,2744,2745],{},"Scope Escalation."," If elicited action suggestions are unusable, widen the snapshot scope and representation richness.",[85,2748,2749,2752],{},[24,2750,2751],{},"Cascade to Hybrid."," If elicited action suggestions are still unusable, augment the rich DOM snapshot with a GUI snapshot for maximum grounding.",[2754,2755,2756,2778],"table",{},[2757,2758,2759],"thead",{},[2760,2761,2762,2766,2769,2772,2775],"tr",{},[2763,2764],"th",{"align":2765},"left",[2763,2767,2768],{},"GUI",[2763,2770,2771],{},"grounded",[2763,2773,2774],{},"DOM",[2763,2776,2777],{},"transformed",[2779,2780,2781,2804,2825,2848,2867,2888],"tbody",{},[2760,2782,2783,2787,2792,2796,2799],{},[2784,2785,2786],"td",{"align":2765},"LLM Input Tokens",[2784,2788,2789],{},[24,2790,2791],{},"Low",[2784,2793,2794],{},[24,2795,2791],{},[2784,2797,2798],{},"High",[2784,2800,2801,2803],{},[24,2802,2791],{}," to Moderate",[2760,2805,2806,2809,2812,2817,2821],{},[2784,2807,2808],{"align":2765},"Element Targeting",[2784,2810,2811],{},"Absolute",[2784,2813,2814],{},[24,2815,2816],{},"Relative",[2784,2818,2819],{},[24,2820,2816],{},[2784,2822,2823],{},[24,2824,2816],{},[2760,2826,2827,2830,2836,2840,2844],{},[2784,2828,2829],{"align":2765},"Snapshot Scope",[2784,2831,2832,2835],{},[24,2833,2834],{},"Free","/Viewport",[2784,2837,2838,2835],{},[24,2839,2834],{},[2784,2841,2842],{},[24,2843,2834],{},[2784,2845,2846],{},[24,2847,2834],{},[2760,2849,2850,2853,2856,2858,2863],{},[2784,2851,2852],{"align":2765},"Snapshot Context",[2784,2854,2855],{},"UI",[2784,2857,2855],{},[2784,2859,2860],{},[24,2861,2862],{},"Full",[2784,2864,2865],{},[24,2866,2862],{},[2760,2868,2869,2874,2879,2883,2886],{},[2784,2870,2871,2873],{"align":2765},[461,2872,557],{}," Context",[2784,2875,2876],{},[24,2877,2878],{},"Viewport",[2784,2880,2881],{},[24,2882,2878],{},[2784,2884,2885],{},"Same-origin only",[2784,2887,2885],{},[2760,2889,2890,2894,2899,2903,2906],{},[2784,2891,2892,2873],{"align":2765},[461,2893,561],{},[2784,2895,2896],{},[24,2897,2898],{},"Yes",[2784,2900,2901],{},[24,2902,2898],{},[2784,2904,2905],{},"No",[2784,2907,2905],{},[62,2909,2911],{"id":2910},"using-snapshots-in-the-model-context","Using Snapshots in the Model Context",[11,2913,2914],{},"Creating a snapshot is one thing. Using it as context to a model prompt is the other. Usually, conversational AI maintains a full trace of history as model context. Since a snapshot is time-sensitive, however, only the latest snapshot can be targeted with actions by an LLM.",[11,2916,2917],{},"Whether to keep a trace of previous actions and model reasoning is a question in its own right. If web browsing is modelled as a history-independent task, the snapshot-to-actions agent loop could even be separated from the persistent conversational loop as transient, one-shot model prompts.",[62,2919,2921],{"id":2920},"timing-snapshots-in-the-web-client","Timing Snapshots in the Web Client",[11,2923,2924,2925,377],{},"LLM-based web agents are much slower than humans in taking and processing snapshots. Not least for that reason, snapshot rounds should be kept to a minimum and timed so that a snapshot is taken as soon as the UI has reached a stable state. That implies a non-trivial challenge: defining what qualifies as a UI change, and at what intensity such a change counts as a state shift – beyond hard page transitions, e.g., in a single-page application",[504,2926,2927],{},[382,2928,2932],{"href":2929,"ariaDescribedBy":2930,"dataFootnoteRef":308,"id":2931},"#user-content-fn-5",[510],"user-content-fnref-5","5",[2934,2935],"hr",{},[11,2937,2938,2939,377],{},"The snapshot is the central artefact in a web agent harness. Its representation is among the most significant factors for agent success",[504,2940,2941],{},[382,2942,2946],{"href":2943,"ariaDescribedBy":2944,"dataFootnoteRef":308,"id":2945},"#user-content-fn-6",[510],"user-content-fnref-6","6",[11,2948,2949,2950,2952],{},"At Webfuse, we develop a platform for agentic browsing. A focus of our research is on efficient snapshot representations. The Automation API can be used to create next-level snapshots: timed, rectified, across ",[461,2951,557],{}," boundaries, etc.",[808,2954,2957,2962],{"className":2955,"dataFootnotes":308},[2956],"footnotes",[62,2958,2961],{"className":2959,"id":510},[2960],"sr-only","Footnotes",[1558,2963,2964,2979,2992,3004,3030,3042],{},[85,2965,2967,2971,2972],{"id":2966},"user-content-fn-1",[382,2968,2969],{"href":2969,"rel":2970},"https://arxiv.org/abs/2310.11441",[386]," ",[382,2973,2978],{"href":2974,"ariaLabel":2975,"className":2976,"dataFootnoteBackref":308},"#user-content-fnref-1","Back to reference 1",[2977],"data-footnote-backref","↩",[85,2980,2982,2983,2971,2987],{"id":2981},"user-content-fn-2","Our reimplementation of Browser Use's grounded GUI snapshots: ",[382,2984,2985],{"href":2985,"rel":2986},"https://github.com/webfuse-com/D2Snap/blob/main/snapshots/_bu.js",[386],[382,2988,2978],{"href":2989,"ariaLabel":2990,"className":2991,"dataFootnoteBackref":308},"#user-content-fnref-2","Back to reference 2",[2977],[85,2993,2995,2971,2999],{"id":2994},"user-content-fn-3",[382,2996,2997],{"href":2997,"rel":2998},"https://arxiv.org/abs/2210.03945",[386],[382,3000,2978],{"href":3001,"ariaLabel":3002,"className":3003,"dataFootnoteBackref":308},"#user-content-fnref-3","Back to reference 3",[2977],[85,3005,3007,2971,3011,2971,3016,2971,3023],{"id":3006},"user-content-fn-4",[382,3008,3009],{"href":3009,"rel":3010},"https://arxiv.org/abs/2508.04412",[386],[382,3012,2978],{"href":3013,"ariaLabel":3014,"className":3015,"dataFootnoteBackref":308},"#user-content-fnref-4","Back to reference 4",[2977],[382,3017,2978,3021],{"href":3018,"ariaLabel":3019,"className":3020,"dataFootnoteBackref":308},"#user-content-fnref-4-2","Back to reference 4-2",[2977],[504,3022,535],{},[382,3024,2978,3028],{"href":3025,"ariaLabel":3026,"className":3027,"dataFootnoteBackref":308},"#user-content-fnref-4-3","Back to reference 4-3",[2977],[504,3029,550],{},[85,3031,3033,2971,3037],{"id":3032},"user-content-fn-5",[382,3034,3035],{"href":3035,"rel":3036},"https://github.com/webfuse-com/DOMQuake",[386],[382,3038,2978],{"href":3039,"ariaLabel":3040,"className":3041,"dataFootnoteBackref":308},"#user-content-fnref-5","Back to reference 5",[2977],[85,3043,3045,2971,3049],{"id":3044},"user-content-fn-6",[382,3046,3047],{"href":3047,"rel":3048},"https://arxiv.org/abs/2504.01382",[386],[382,3050,2978],{"href":3051,"ariaLabel":3052,"className":3053,"dataFootnoteBackref":308},"#user-content-fnref-6","Back to reference 6",[2977],[3055,3056,3057],"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 .suv1-, html code.shiki .suv1-{--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sxg3X, html code.shiki .sxg3X{--shiki-default:#85E89D;--shiki-dark:#85E89D}html pre.shiki code .sFR8T, html code.shiki .sFR8T{--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .s4wv1, html code.shiki .s4wv1{--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .s8ozJ, html code.shiki .s8ozJ{--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":308,"searchDepth":309,"depth":309,"links":3059},[3060,3064,3070,3071,3072,3073,3074],{"id":412,"depth":309,"text":413,"children":3061},[3062,3063],{"id":436,"depth":690,"text":437},{"id":476,"depth":690,"text":477},{"id":538,"depth":309,"text":539,"children":3065},[3066,3067,3068,3069],{"id":568,"depth":690,"text":569},{"id":593,"depth":690,"text":594},{"id":1522,"depth":690,"text":1523},{"id":1546,"depth":690,"text":1547},{"id":2272,"depth":309,"text":2273},{"id":2716,"depth":309,"text":2717},{"id":2910,"depth":309,"text":2911},{"id":2920,"depth":309,"text":2921},{"id":510,"depth":309,"text":2961},"2025-08-28","Understand how web-based user interfaces can be serialised for use with LLM-based web agents.",{"homepage":353,"relatedLinks":3078},[3079,3082],{"text":3080,"href":3081},"DOM Downsampling for LLM-Based Web Agents","/rnd/dom-downsampling-for-llm-based-web-agents",{"text":3083,"href":3084,"external":353},"Webfuse Automation API","https://dev.webfuse.com/automation-api/","/blog/serialising-web-ui-state-for-llms-the-complete-guide",{"title":367,"description":3076},{"loc":3085},"blog/1013.serialising-web-ui-state-for-llms-the-complete-guide",[317,359,3090,3091,3092],"web-automation","llms","snapshots","X7R93b2XjyDfLllTDaNgFoo_c8AvF9oBDGzv4yiISFA",{"id":3095,"title":3096,"authorId":368,"body":3097,"category":317,"created":3573,"description":3574,"extension":320,"faqs":335,"featurePriority":335,"head":335,"hideCta":353,"landingPath":335,"meta":3575,"navigation":353,"ogImage":335,"path":3581,"robots":335,"schemaOrg":335,"seo":3582,"sitemap":3583,"stem":3584,"tags":3585,"__hash__":3587},"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":3098,"toc":3554},[3099,3117,3121,3129,3134,3137,3141,3144,3164,3168,3177,3181,3197,3202,3205,3209,3220,3224,3227,3231,3238,3242,3265,3269,3273,3276,3279,3283,3304,3307,3311,3315,3324,3335,3340,3344,3353,3356,3360,3363,3366,3370,3383,3386,3390,3399,3402,3406,3410,3413,3417,3421,3424,3498,3500,3503,3517],[11,3100,3101,3106,3107,3106,3111,3116],{},[382,3102,3105],{"href":3103,"rel":3104},"https://openai.com/index/introducing-operator/",[386],"Operator",", ",[382,3108,526],{"href":3109,"rel":3110},"https://browser-use.com/",[386],[382,3112,3115],{"href":3113,"rel":3114},"https://www.skyvern.com/",[386],"Skyvern"," – we are currently witnessing an evolution of autonomous web browsing agents. The concept of agents is, in general, ubiquitous in the era of AI.",[62,3118,3120],{"id":3119},"what-is-an-agent","What is an Agent?",[11,3122,3123,3124,377],{},"An agent is an entity that acts on behalf of another entity – its principal. Robotic agents are modelled after humans: they perceive the world and act in it to achieve a specified goal. Whilst humans perceive through their senses, agents perceive through sensors; whilst humans act through motor systems (e.g., fingers), agents act through actuators. This terminology has been transferred from hard- to software agents, particularly those premised on artificial intelligence (AI). An agent's purpose, that is, its goal, is clearly defined; the principal interfaces with that goal by assigning the agent tasks",[504,3125,3126],{},[382,3127,512],{"href":508,"ariaDescribedBy":3128,"dataFootnoteRef":308,"id":511},[510],[53,3130],{"alt":3131,"loading":58,"src":3132,"provider":60,":width":3133},"Figurative comparison of component equivalents between a human and an AI agent","/blog/a-gentle-introduction-to-ai-agents-for-the-web/1.svg","430",[11,3135,3136],{},"The analogy is more than decorative: an agent takes over the tool-use expertise, leaving the principal with only the domain expertise. Traditional software applications like Photoshop demand both.",[434,3138,3140],{"id":3139},"what-makes-an-agent-intelligent","What Makes an Agent Intelligent?",[11,3142,3143],{},"For acting on behalf of a human, developing an agent could be as simple as making it follow a hardcoded sequence of actions. This describes process automation, but not an artificially intelligent agent. Whilst definitions for AI differ, agent intelligence comes from making informed decisions that are not hardcoded. Here are common – not necessarily mutually exclusive – high-level approaches to induce intelligence:",[82,3145,3146,3152,3158],{},[85,3147,3148,3151],{},[24,3149,3150],{},"Search"," – the agent has a complete or heuristic model of the world and the action space to anticipate the effects of actions and search for a goal state.",[85,3153,3154,3157],{},[24,3155,3156],{},"Reinforcement learning"," – the agent has an initial action space and iteratively discovers the world and effects of actions, learning an optimal policy to act in order to reach a goal state.",[85,3159,3160,3163],{},[24,3161,3162],{},"Neural networks"," – the agent has no model, only examples: a network is fitted to task–solution instances and generalises to unseen, yet related tasks.",[434,3165,3167],{"id":3166},"a-quick-note-on-multi-agent-systems","A Quick Note on Multi-Agent Systems",[11,3169,3170,3171,3176],{},"Agent design gets an additional edge when other entities act in the same world as the agent. Such entities can be considered agents on their own. Their beliefs and goals might affect the agent: cooperative agents share the designed agent's goal, whilst adversarial agents have an opposite goal. In a zero-sum game, an adversarial agent maximises the exact inverse of the designed agent's utility. Knowing this, the designed agent needs to anticipate intelligent decisions by the adversary (e.g., by applying the ",[382,3172,3175],{"href":3173,"rel":3174},"https://cs.stanford.edu/people/eroberts/courses/soco/projects/2003-04/intelligent-search/minimax.html",[386],"Minimax algorithm","), as opposed to random world changes. That said, web browsing – modelled after humans – is not a typical multi-agent scenario.",[434,3178,3180],{"id":3179},"the-agent-loop","The Agent Loop",[11,3182,3183,3188,3189,3196],{},[382,3184,3187],{"href":3185,"rel":3186},"https://www.nngroup.com/people/don-norman/",[386],"Don Norman","'s ",[382,3190,3193],{"href":3191,"rel":3192},"https://jnd.org/books/the-design-of-everyday-things-revised-and-expanded-edition/",[386],[396,3194,3195],{},"Seven Stages of Action"," is a model of the human cognition cycle that generalises to an agent's lifecycle – the agent loop: with a (1) goal, (2) intent to act, (3) plan actions, (4) execute the action plan – this alters the world – then (5) perceive the new world state, (6) interpret the perception, and finally (7) evaluate the interpretation – report task success or an irrevocable failure; continue the cycle if the world state not yet reflects a goal state.",[53,3198],{"alt":3199,"loading":58,"src":3200,"provider":60,":width":3201},"Don Norman's Seven Stages of Action – a model of human cognition","/blog/a-gentle-introduction-to-ai-agents-for-the-web/2.svg","500",[11,3203,3204],{},"Humans can run many of these cycles hierarchically, with increasing frequency the smaller the task. Take driving a car as an example: choosing a route runs on the order of minutes, choosing when to change lanes on seconds, and holding the car in its lane on fractions of a second. A cycle for holding the lane (1) is: intent to actively hold the lane (2), plan to keep the steering wheel straight, then watch the road (3), execute plan (4), observe the road (5), check whether the car is in the lane (6), if not, cycle again with an adjusted action plan (e.g., slightly rotate the steering wheel to the right) (7).",[434,3206,3208],{"id":3207},"errors-and-recovery","Errors and Recovery",[11,3210,3211,3212,3215,3216,3219],{},"Precisely speaking, \"to err is human\" means that errors are inevitable when heuristically navigating the world. Consequently, AI agents regularly run into errors, too. Norman's Seven Stages of Action make two error spaces apparent: when executing an action plan; the ",[396,3213,3214],{},"Gulf of Action (Execution)"," – how to act in the world? – and when perceiving world state; the ",[396,3217,3218],{},"Gulf of Perception (Evaluation)"," – how to understand the world?",[53,3221],{"alt":3222,"loading":58,"src":3223,"provider":60,":width":3201},"The Gulf of Action (Execution) and  Perception (Evaluation) in Don Norman's Seven Stages of Action","/blog/a-gentle-introduction-to-ai-agents-for-the-web/3.svg",[11,3225,3226],{},"There are two notable kinds of errors within the Gulf of Action: mistakes and slips. A mistake occurs when the action plan is wrong, although executing this action plan might go right in itself. A slip occurs when the action plan is right, but the execution goes wrong. Here is an example: stopping a manual-shift car without pressing the clutch. This error describes a mistake if the driver did not know about the need to press the clutch, e.g., because they only knew how to operate automatic-drive cars. It is, in turn, a slip if they simply forgot to press the clutch because of fatigue. Since cognition cycles are hierarchic, most errors can be recovered within a cycle. Hearing a choking engine sound, the driver might adjust the action plan and press the clutch late. Errors that cannot be recovered – picture the car's engine dying – require adjusting the goal, which can be seen as moving on to a new cycle.",[62,3228,3230],{"id":3229},"web-browsing-agents","Web Browsing Agents",[11,3232,3233,3234,3237],{},"The advent of large language models (LLMs) has recently opened a new perspective on developing web agents – falling back on the neural networks approach to intelligence. An LLM can serve as a plug-in reasoning backend: given a task and somehow encoded UI state, it can suggest input actions – type and target, e.g., click at ",[461,3235,3236],{},"(200, 375)"," – that progress the given task. Moreover, it can decide whether a goal state has been reached. Providing a state-and-action history within context conveys to the model prior outcomes and contributes to in-context learning.",[434,3239,3241],{"id":3240},"web-browsing-is-all-about-the-journey","Web Browsing is All About the Journey",[11,3243,3244,3245,3248,3249,3254,3255,3260,3261,3264],{},"A web browsing task is any task that can be solved through a web-based user interface (UI). For instance: ",[396,3246,3247],{},"\"Book the cheapest flight from Amsterdam to New York tomorrow night\""," on ",[382,3250,3253],{"href":3251,"rel":3252},"https://www.klm.com",[386],"klm.com",". Application programming interfaces (APIs; e.g., ",[382,3256,3259],{"href":3257,"rel":3258},"https://www.ibm.com/think/topics/rest-apis",[386],"REST APIs",") are often restricted, incomplete, or unavailable. For that reason, web browsing agents today have to rely on human-facing web application UIs. Many agent use cases, such as for customer experience, even require a human in the loop. In this context, web browsing agents come at two levels: outcome-driven agents care only about reaching a goal state, which favours shortcuts like direct URL navigation or expert navigation like ",[461,3262,3263],{},"Ctrl + F",", whilst journey-driven agents are supposed to browse a web application in human fashion, via the application-native UI.",[53,3266],{"alt":3267,"loading":58,"src":3268},"A depiction of a web journey over three web application UI states","/blog/a-gentle-introduction-to-ai-agents-for-the-web/4.png",[434,3270,3272],{"id":3271},"a-formal-model-for-web-browsing","A Formal Model for Web Browsing",[11,3274,3275],{},"The world of web application UIs is hard to formalise; a complete model spans the union of every reachable UI state in every web application on the web. For that reason, conventional AI has failed to produce capable generalist web agents. From a web agent design perspective, however, an abstract model of web browsing is sufficient.",[11,3277,3278],{},"Web browsing might afford a model that is history-independent. A human could certainly pick up a partially completed browsing task. For example, completing the payment process on an airline website for an already selected flight – assuming prior actions were correct with respect to the specified task (e.g., the selected destination).",[53,3280],{"alt":3281,"loading":58,"src":3282},"Screenshot of the payment page on klm.com that reflects outcomes of prior actions and affords next actions","/blog/a-gentle-introduction-to-ai-agents-for-the-web/5.png",[11,3284,3285,3286,3291,3292,3297,3298,3303],{},"Yet, many web applications lack ",[382,3287,3290],{"href":3288,"rel":3289},"https://www.nngroup.com/articles/ten-usability-heuristics/#toc-1-visibility-of-system-status-1",[386],"visibility of system status"," – against ",[382,3293,3296],{"href":3294,"rel":3295},"https://www.nngroup.com/people/jakob-nielsen/",[386],"Jakob Nielsen","'s first heuristic for UI usability. Visibility of system status comprises reflecting both outcomes of prior actions and affordances for next actions in the UI. With this concept, web browsing is best described as a partially observable Markov decision process (POMDP)",[504,3299,3300],{},[382,3301,535],{"href":532,"ariaDescribedBy":3302,"dataFootnoteRef":308,"id":534},[510]," with, adapting to discovered UI states, where states can be tuples of UI state trajectories to contain history.",[11,3305,3306],{},"Reflex agents take actions that solely depend on the current world state. Planning agents, in turn, plan ahead. For most web browsing tasks, future UI states are roughly predictable, given that web journeys are similar across different web applications that help with similar tasks. In POMDP terms, the expected next UI state has a high probability, whilst unexpected states remain with a non-negligible probability. The further a web journey is progressed, the higher the probability of the next expected UI state gets: the flight selection step is likely followed by the passenger details step, which is even more likely followed by the payment step.",[53,3308],{"alt":3309,"loading":58,"src":3310},"Graph-based web journey representation of an unknown, adaptive, partially observable Markov decision process (POMDP)","/blog/a-gentle-introduction-to-ai-agents-for-the-web/6.png",[434,3312,3314],{"id":3313},"llm-sensors-actuators-agent","LLM + Sensors + Actuators = Agent",[11,3316,3317,3318,3323],{},"Conversationally satisfying simple information requests does not reasonably qualify an LLM as an agent – no more than it would a TF-IDF search system",[504,3319,3320],{},[382,3321,550],{"href":547,"ariaDescribedBy":3322,"dataFootnoteRef":308,"id":549},[510],", or a colleague telling you the time. The web agent LLM backend is metaphorically the brain of the agent. It abstracts the world model and state transition function, and can decide whether a goal state was reached.",[11,3325,3326,3327,3106,3329,3106,3331,3334],{},"Turning an LLM into a web agent means, at the core, connecting it with sensors and actuators, for example, the ability to take DOM snapshots and dispatch clicks via CSS selectors. This is a specialised architecture of LLM tool calling. The set of available input actions is known from human computer use: ",[396,3328,398],{},[396,3330,401],{},[396,3332,3333],{},"scrolling",", etc. The agent loop is then a continuous cycle of serialising UI state for the model to elicit action suggestions under a goal derived from the user-specified task.",[53,3336],{"alt":3337,"loading":58,"src":3338,"provider":60,":width":3339},"Figurative depiction of components in the agent loop","/blog/a-gentle-introduction-to-ai-agents-for-the-web/7.svg","460",[434,3341,3343],{"id":3342},"snapshots-serialised-ui-state","Snapshots – Serialised UI State",[11,3345,3346,3347,3352],{},"There are plenty of ways to serialise the state of a web-based UI – referred to as a snapshot. A screenshot resembles what humans see when viewing a web page's graphical UI (GUI) at a given point in time. That said, a UI can be represented in versatile ways. LLMs have demonstrated the ability to interpret HTML and even navigate a UI encoded in this way",[504,3348,3349],{},[382,3350,1044],{"href":1041,"ariaDescribedBy":3351,"dataFootnoteRef":308,"id":1043},[510],". The document object model (DOM) is a web browser's runtime model of a web page. Serialised as HTML, to that effect, DOM snapshots represent a compelling alternative to GUI snapshots, offering certain advantages, such as processability (e.g., filtering). Filtering the DOM by pruning hidden, disabled, or redundant subtrees saves LLM communication costs and works towards more stable and predictable journeys.",[11,3354,3355],{},"Outcome-driven web agents have used UI-invasive snapshot measures, such as grounding LLMs with bounding boxes around actionable elements.",[53,3357],{"alt":3358,"loading":58,"src":3359},"Example of a screenshot (GUI snapshot) with coloured bounding boxes that visually ground an LLM","/blog/a-gentle-introduction-to-ai-agents-for-the-web/8.png",[11,3361,3362],{},"The ideal snapshot representation depends on the task. To get an idea, classify between navigation and information retrieval tasks: navigation tasks require snapshots to preserve actionable elements, whilst retrieval tasks require them to preserve text – both can be sourced from DOM snapshots. Accessibility tree snapshots are another DOM-sourced representation. Web UIs rarely afford merely a single task, so many of their components are noise in any given snapshot – which is not just a UI serialisation, but one scoped to the task at hand. GUI snapshots become a necessity when the target application is graphics-based, such as a canvas-based application like Google Maps.",[11,3364,3365],{},"A snapshot impacts the width of Norman's Gulf of Perception: if a relevant element is omitted or diffused, the model is hindered in identifying correct actions to progress a web browsing task. The Gulf of Action mostly grows when the snapshot-encoded UI state and the live UI state have irrecoverably drifted apart. The agent loop should be fast to prevent such drift. The Gulf of Perception is much wider by the nature of the problem: what snapshot representation can an LLM interpret, and which representation is best?",[434,3367,3369],{"id":3368},"targeting-action-suggestions","Targeting – Action Suggestions",[11,3371,3372,3373,3106,3375,3378,3379,3382],{},"An action is a user event, such as ",[396,3374,454],{},[396,3376,3377],{},"type",", or ",[396,3380,3381],{},"scroll",", targeting a specific element in the UI. The set of available actions thereby is defined by the accepted user input types which are generally derived and standardised over the mouse and keyboard devices.",[11,3384,3385],{},"The type of snapshot representation provided to an LLM dictates how an element can be targeted for an action. Vision-based, geometric targeting is indirect and absolute, i.e., by coordinates. DOM-based targeting is direct and relative, e.g., by CSS selectors or object references. Relative targeting remains valid if the UI shifts between snapshot and action time. A shift can happen due to many reasons, for instance, a lazy-loaded image.",[434,3387,3389],{"id":3388},"the-agent-harness","The Agent Harness",[11,3391,3392,3393,3398],{},"Any custom logic that sits between the LLM backend and the web page UI (problem world) is considered an agent harness – often linguistically equated with the agent in general. Common aspects of a harness include task decomposition, model routing, snapshot creation, history management, error recovery, and timeouts. ",[382,3394,3397],{"href":3395,"rel":3396},"https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents",[386],"System prompts"," are also part of the harness, instructing a general-purpose LLM to model a web agent for a specific domain – right in context.",[11,3400,3401],{},"Designing a harness is where the POMDP and Seven Stages of Action models come into play. The POMDP model helps with context engineering, for instance, how much history to provide to the LLM. The Seven Stages of Action set out problem components and artefacts, for example, the LLM or snapshots, respectively.",[53,3403],{"alt":3404,"loading":58,"src":3405,"provider":60},"Don Norman's Seven Stages of Action mapped to the agentic web browsing problem","/blog/a-gentle-introduction-to-ai-agents-for-the-web/9.svg",[434,3407,3409],{"id":3408},"the-model-context-protocol","The Model Context Protocol",[11,3411,3412],{},"LLM providers commonly offer a structured output interface, which allows eliciting well-formed action suggestions from an LLM. A client can subsequently parse and drive these suggested actions in the live user interface. Through the model context protocol (MCP) – another web-based RPC standard – structured output can be bridged with tools that LLMs can call directly, without an extra client trip.",[53,3414],{"alt":3415,"loading":58,"src":3416,"provider":60,":width":3201},"Figurative depiction of components in the agent loop using the model context protocol (MCP)","/blog/a-gentle-introduction-to-ai-agents-for-the-web/10.svg",[434,3418,3420],{"id":3419},"web-browser-environments","Web Browser Environments",[11,3422,3423],{},"When connected to web perception and actuation tools via MCP, an ordinary AI chat UI already qualifies as an agent UI; the MCP integration decides where the actual web browser runs. There are several types of browser runtime environment:",[82,3425,3426,3441,3454,3466],{},[85,3427,3428,3431,3432,3435,3436],{},[24,3429,3430],{},"Agentic browser"," – the agent's UI embeds a browser.",[3433,3434],"br",{},"\nExample: ",[382,3437,3440],{"href":3438,"rel":3439},"https://www.perplexity.ai/comet",[386],"Perplexity Comet",[85,3442,3443,3446,3447,3435,3449],{},[24,3444,3445],{},"Cloud browser"," – the agent spins up a browser in the cloud.",[3433,3448],{},[382,3450,3453],{"href":3451,"rel":3452},"https://www.browserbase.com",[386],"Browserbase",[85,3455,3456,3459,3460,3435,3462],{},[24,3457,3458],{},"Local browser (3rd-party browser)"," – the agent spins up an isolated browser locally.",[3433,3461],{},[382,3463,3465],{"href":384,"rel":3464},[386],"Chromium + Playwright",[85,3467,3468,3471,3472],{},[24,3469,3470],{},"Local browser (1st-party browser)"," – the agent is embedded within a web application running in a user's personal browser, e.g., in the form of a chatbot.\n",[82,3473,3474,3487],{},[85,3475,3476,3479,3480,3435,3482],{},[24,3477,3478],{},"Implemented (1st-party app)"," – served directly through the website.",[3433,3481],{},[382,3483,3486],{"href":3484,"rel":3485},"https://www.cognigy.com/platform/ai-agent-studio",[386],"Cognigy Studio",[85,3488,3489,3492,3493,3435,3495],{},[24,3490,3491],{},"Augmented (3rd-party app)"," – served indirectly through a website proxy.",[3433,3494],{},[382,3496,393],{"href":391,"rel":3497},[386],[2934,3499],{},[11,3501,3502],{},"Building AI agents has been approached from different angles. LLMs have opened up new perspectives on the design and development of AI agents, particularly web agents, which work in a problem domain that is hard to grasp with a formal model. Whilst higher-level agent methodology can borrow much from established research, LLMs have introduced new challenges, such as how to take UI state snapshots for eliciting input action suggestions from such models.",[11,3504,3505,3506,3511,3512,377],{},"At Webfuse, we research agentic web browsing and develop a platform for agentic browsing. Our web application reverse proxy allows LLMs to perceive and act on the live web. Use cases include connecting a chat UI like ",[382,3507,3510],{"href":3508,"rel":3509},"https://claude.com/",[386],"Claude",", or shipping ",[382,3513,3516],{"href":3514,"rel":3515},"https://github.com/webfuse-com/extension-elevenlabs-mcp",[386],"perceive-and-act-ready chatbots",[808,3518,3520,3523],{"className":3519,"dataFootnotes":308},[2956],[62,3521,2961],{"className":3522,"id":510},[2960],[1558,3524,3525,3534,3540,3546],{},[85,3526,3527,2971,3531],{"id":2966},[382,3528,3529],{"href":3529,"rel":3530},"https://inst.eecs.berkeley.edu/~cs188/textbook/textbook_full.pdf",[386],[382,3532,2978],{"href":2974,"ariaLabel":2975,"className":3533,"dataFootnoteBackref":308},[2977],[85,3535,3536,3537],{"id":2981},"A POMDP is a decision process in which the agent cannot see the exact world state, only partial observations of it, and so must choose actions against a probability distribution over the states it might be in. ",[382,3538,2978],{"href":2989,"ariaLabel":2990,"className":3539,"dataFootnoteBackref":308},[2977],[85,3541,3542,3543],{"id":2994},"TF-IDF (term frequency-inverse document frequency) is an information retrieval method that ranks documents by how often a query term occurs in each one, weighted down by how common that term is across the whole collection – so terms that are frequent here but rare elsewhere carry the most weight. ",[382,3544,2978],{"href":3001,"ariaLabel":3002,"className":3545,"dataFootnoteBackref":308},[2977],[85,3547,3548,2971,3551],{"id":3006},[382,3549,2997],{"href":2997,"rel":3550},[386],[382,3552,2978],{"href":3013,"ariaLabel":3014,"className":3553,"dataFootnoteBackref":308},[2977],{"title":308,"searchDepth":309,"depth":309,"links":3555},[3556,3562,3572],{"id":3119,"depth":309,"text":3120,"children":3557},[3558,3559,3560,3561],{"id":3139,"depth":690,"text":3140},{"id":3166,"depth":690,"text":3167},{"id":3179,"depth":690,"text":3180},{"id":3207,"depth":690,"text":3208},{"id":3229,"depth":309,"text":3230,"children":3563},[3564,3565,3566,3567,3568,3569,3570,3571],{"id":3240,"depth":690,"text":3241},{"id":3271,"depth":690,"text":3272},{"id":3313,"depth":690,"text":3314},{"id":3342,"depth":690,"text":3343},{"id":3368,"depth":690,"text":3369},{"id":3388,"depth":690,"text":3389},{"id":3408,"depth":690,"text":3409},{"id":3419,"depth":690,"text":3420},{"id":510,"depth":309,"text":2961},"2025-06-15","Get an idea of agents and how to build AI agents that browse the web: key concepts, terminology, and challenges.",{"homepage":353,"relatedLinks":3576},[3577,3579,3580],{"text":3578,"href":3085},"Serialising Web UI State for LLMs",{"text":3080,"href":3081},{"text":3083,"href":3084,"external":353},"/blog/a-gentle-introduction-to-ai-agents-for-the-web",{"title":3096,"description":3574},{"loc":3581},"blog/1011.a-gentle-introduction-to-ai-agents-for-the-web",[317,3586,359,3090,3091],"browser-agents","65hAoQNete8P3AgO-H42P0eBhVfIkl5vIfZZAkvL-9o",1788255644856]