[{"data":1,"prerenderedAt":3630},["ShallowReactive",2],{"/blog/human-approval-checkpoints-for-ai-agents":3,"related-/blog/human-approval-checkpoints-for-ai-agents":414},{"id":4,"title":5,"authorId":6,"body":7,"category":372,"created":373,"description":374,"extension":375,"faqs":376,"featurePriority":389,"head":390,"hideCta":391,"landingPath":390,"meta":392,"navigation":403,"ogImage":390,"path":404,"robots":390,"schemaOrg":390,"seo":405,"sitemap":406,"stem":407,"tags":408,"__hash__":413},"blog/blog/1051.human-approval-checkpoints-for-ai-agents.md","Human Approval Checkpoints for AI Agents (2026)","salome-koshadze",{"type":8,"value":9,"toc":362},"minimark",[10,14,23,26,60,65,68,74,77,105,108,111,114,119,123,126,130,133,138,141,144,161,164,168,171,175,178,181,216,219,225,228,232,235,239,242,268,271,274,277,281,284,288,359],[11,12,13],"p",{},"AI agents now run multi-step work across enterprise web apps, which gives software write access to production systems. One unverified action can send a wire transfer, change a live configuration, or edit a customer record. A checkpoint sits in front of those actions: the agent's proposed change waits until a person approves it.",[15,16],"nuxt-picture",{":height":17,":width":18,"alt":19,"loading":20,"src":21,"provider":22},"680","900","Diagram titled \"Where the Checkpoint Lives in the Stack\" showing four layers where an agent's action can be paused - the browser layer where a reviewer joins the same DOM the agent sees (Webfuse), the application layer where a proposal sits pending until a webhook writes (Velt), the development workflow where the pause happens on a design document before code is written (HumanLayer), and the orchestration runtime where a developer marks any node as an interrupt (LangGraph) - above a production systems band for wire transfers, live configuration and customer records, with an arrow showing that an unchecked action falls straight through every layer","lazy","/blog/human-approval-checkpoints-for-ai-agents/1.svg","none",[11,24,25],{},"Building that checkpoint means pausing agent execution, showing the proposed action to a reviewer, and resuming once the reviewer approves. Webfuse, HumanLayer, LangGraph and Velt each do this at a different layer of the stack - a browser proxy, a coding IDE, an orchestration framework, and a UI SDK.",[27,28,30,36,42,48,54],"tldr-box",{"title":29},"TL;DR",[11,31,32],{},[33,34,35],"strong",{},"Pick the tool by where the risky action happens.",[11,37,38,41],{},[33,39,40],{},"Webfuse"," (our own product) pauses inside the user's live browser session. Built for web apps with no API.",[11,43,44,47],{},[33,45,46],{},"HumanLayer"," puts the review on the design document, before any code is written.",[11,49,50,53],{},[33,51,52],{},"LangGraph"," pauses at a node you mark in the graph. You build the reviewer experience yourself.",[11,55,56,59],{},[33,57,58],{},"Velt"," puts approval inside your app's own UI. Proposals sit apart from live data until someone signs off.",[61,62,64],"h2",{"id":63},"webfuse-pausing-live-browser-sessions-for-a-human-to-join","Webfuse: pausing live browser sessions for a human to join",[11,66,67],{},"Webfuse runs as a proxy between the browser and the origin server. When a session starts, it intercepts the site's HTTP responses and renders the page inside a virtualized container, without touching the target app's source code. The agent reads and acts on the same DOM the person sees, in the same browser tab, in real time.",[15,69],{":height":70,":width":71,"alt":72,"loading":20,"src":73},"1508","2880","The Webfuse homepage, headlined \"Enable AI Agents to scroll on any Web App\" with the word scroll shown as a selected page element, and a subtitle describing connecting an agent to the live web through the Model Context Protocol to give an LLM eyes to see the DOM and hands to act on the user's behalf with no install required","/blog/human-approval-checkpoints-for-ai-agents/webfuse.png",[11,75,76],{},"When an agent hits a high-stakes step, Webfuse pulls a reviewer into that live session. The session becomes shared, and the reviewer sees the page itself rather than a summary of it. The pieces that make this work:",[78,79,80,87,93,99],"ul",{},[81,82,83,86],"li",{},[33,84,85],{},"Co-browsing escalation"," - a reviewer joins the live session to approve or correct what the agent is doing, in the same DOM state.",[81,88,89,92],{},[33,90,91],{},"Session recordings and audit logs"," - every agent action gets logged with a video replay, tying the model's reasoning to what happened on screen.",[81,94,95,98],{},[33,96,97],{},"Element-level rules"," - admins set allow and deny lists for specific URLs or DOM elements, so an agent can read a support ticket but not touch the billing field on the same page.",[81,100,101,104],{},[33,102,103],{},"Data masking"," - the proxy strips personal information, a card number or a password, before it reaches the model.",[11,106,107],{},"A bank employee approving a wire transfer an agent has drafted: the agent fills in the form fields, an admin rule marks the step as one that needs sign-off, and the employee gets pulled into the same session to check the numbers before clicking confirm. Both sides see the identical page state, and the video log captures the whole exchange for compliance review later.",[11,109,110],{},"Webfuse fits customer-facing workflows running on legacy web apps with no API, where the graphical interface is the only way in. It connects over MCP, so agent frameworks such as LangChain or AutoGen can drive a live session, and it supports a direct WebSocket bridge for voice agents.",[11,112,113],{},"Webfuse works at the browser layer, so a third-party proxy sits inline with production traffic. It also can't gate work that happens outside a browser: a background job, a database trigger, an internal API call.",[115,116],"article-signup-cta",{"heading":117,"subtitle":118},"Put a human in the loop of a live browser session","Webfuse runs any web app through a proxy, so an agent and a person can work in the same page at the same time. Pull a reviewer into the session before the agent submits a form, with element-level rules and a video log of every action.",[61,120,122],{"id":121},"humanlayer-stopping-the-agent-before-it-writes-code","HumanLayer: stopping the agent before it writes code",[11,124,125],{},"HumanLayer is an IDE and cloud platform built for teams running AI coding agents against large codebases. The checkpoint comes before any code gets written.",[15,127],{":height":70,":width":71,"alt":128,"loading":20,"src":129},"HumanLayer's workflow section, headlined \"Do not outsource the thinking\", with the line \"Structured workflows give the agent every opportunity to show you what it's wrong about before moving to implementation\" above a progress strip of the six QRSPI phases - Questions and Research marked complete, Design currently active, and Structure, Plan and Implement still greyed out ahead - over a panel showing the agent gathering codebase context and research findings","/blog/human-approval-checkpoints-for-ai-agents/humanlayer.png",[11,131,132],{},"The workflow is called QRSPI: Questions, Research, Design, Structure, Plan, Implement. Questions come first, before anything is written. During Research, the agent maps the codebase, its dependencies and the patterns around it. Design produces a document the team comments on, Structure breaks that into phased, verifiable steps, and Plan adds file paths, test cases and acceptance criteria. Only then does the agent move into Implement.",[15,134],{":height":135,":width":18,"alt":136,"loading":20,"src":137,"provider":22},"570","Diagram titled \"Shifting the Review Left: QRSPI\" plotting the cost to correct an error as a rising curve across HumanLayer's six phases - Questions, Research, Design, Structure, Plan and Implement - with the curve cheap and flat at the start where nothing is built yet and steepest at the point marked \"code starts here\", contrasting a roughly 200-line design document where a wrong assumption surfaces immediately against a 1,000-plus-line finished diff where the same error is already load-bearing","/blog/human-approval-checkpoints-for-ai-agents/4.svg",[11,139,140],{},"HumanLayer's stated principle: \"Do not outsource the thinking. Every phase is a place to push back.\" The design phase is where that pushback happens as a group, and the aim, in their words, is \"your whole team - humans and Agents - commenting on the design before a single line is written.\"",[11,142,143],{},"Beyond the workflow itself:",[78,145,146,152,158],{},[81,147,148,151],{},[33,149,150],{},"Task workspaces"," group agent sessions, files, and worktrees under one shared environment, so a team can see which agent is touching which part of the codebase.",[81,153,154,157],{},[33,155,156],{},"Bring-your-own-model"," support means teams plug in their own Claude, Codex, or Copilot subscription instead of paying a separate token bill.",[81,159,160],{},"A local daemon runs parallel agent sessions on a developer's machine, and the cloud side handles longer background tasks and syncs sessions across a team, so a reviewer working from a different device still sees the current state of a session.",[11,162,163],{},"HumanLayer hasn't open-sourced the QRSPI implementation, so the mechanics above come from how the team describes it publicly rather than from a spec. The scope is narrow: this is for software teams working in a codebase, not for approving agent actions in a business app.",[61,165,167],{"id":166},"langgraph-pausing-a-program-at-a-set-point-in-its-logic","LangGraph: pausing a program at a set point in its logic",[11,169,170],{},"LangGraph is a low-level framework from LangChain for building agent workflows as graphs, where nodes are functions or model calls and edges control the flow between them. It ships no review interface, only the primitives to build one.",[15,172],{":height":70,":width":71,"alt":173,"loading":20,"src":174},"The LangGraph documentation page on interrupts, explaining that interrupts pause graph execution at specific points and wait for external input before continuing, and that when an interrupt is triggered LangGraph saves the graph state through its persistence layer and waits indefinitely until execution resumes - with an on-this-page sidebar listing the common patterns, including approve or reject, review and edit state, and validating human input","/blog/human-approval-checkpoints-for-ai-agents/langgraph.png",[11,176,177],{},"A single call to a language model is stateless and forgets everything the moment it returns a response. Wrapping those calls in a graph with a persisted state object gives the agent memory across a long workflow, and it gives a pause something concrete to save and restore. That state object is typed, a dictionary or a Pydantic model in most setups, and each node records how it changed the state as the run continues.",[11,179,180],{},"The relevant primitive is the interrupt. A developer marks a node in the graph, a payment step for example, as one that should pause and wait. What that gets you:",[78,182,183,189,204,210],{},[81,184,185,188],{},[33,186,187],{},"The run stops and hands back a value."," Per the documentation, the interrupt function pauses graph execution and returns a value to the caller, then waits for you to resume with input.",[81,190,191,194,195,199,200,203],{},[33,192,193],{},"The state goes to a database."," A checkpointer writes it, ",[196,197,198],"code",{},"SqliteSaver"," for local work and ",[196,201,202],{},"PostgresSaver"," in production.",[81,205,206,209],{},[33,207,208],{},"Nothing runs while it waits."," No compute is consumed, so a graph can sit paused for minutes or days.",[81,211,212,215],{},[33,213,214],{},"Time travel rewinds a run."," A reviewer returns to an earlier checkpoint, edits a value, and branches down a different path instead of restarting from the beginning.",[11,217,218],{},"A support workflow shows the shape of it: a graph holds a customer's account ID, conversation history, and a proposed refund amount as it moves through nodes for data lookup, sentiment check, and refund calculation. A conditional edge routes any refund over fifty dollars to an interrupt node before the final execution step. The graph stops there, and a manager reviewing the state sees the agent's full reasoning trace before approving the refund through an API call that resumes the graph from that exact point.",[15,220],{":height":221,":width":222,"alt":223,"loading":20,"src":224,"provider":22},"600","940","Diagram titled \"Pausing a Graph at a Marked Node\" following a refund workflow through nodes for looking up an account, checking sentiment and drafting a refund, then a conditional edge asking whether the refund is over fifty dollars - routing under-threshold refunds automatically to execution and over-threshold refunds to an interrupt that pauses the graph, showing the state written to disk through a PostgresSaver checkpointer with an account ID, conversation history and a proposed refund of $84.00, a note that no compute runs while the run sits paused for minutes or days, and a manager reading the full reasoning trace with approve and reject controls that resume the graph through an API call","/blog/human-approval-checkpoints-for-ai-agents/3.svg",[11,226,227],{},"LangGraph suits teams building custom, often cyclical workflows who want full control over where the pause happens and what the reviewer sees. You build the review dashboard, the notification system and the resume logic yourself.",[61,229,231],{"id":230},"velt-routing-ai-proposals-through-an-approval-interface-inside-the-app","Velt: routing AI proposals through an approval interface inside the app",[11,233,234],{},"Velt is an SDK for embedding review and approval into a web product's own UI, so the reviewer stays in the app instead of moving to Slack or email. It targets apps where an agent proposes a change and a person signs off on it before the change reaches production.",[15,236],{":height":70,":width":71,"alt":237,"loading":20,"src":238},"Velt's approval flows page, headlined \"Add an approval workflow builder to your product\", with a workflow builder panel showing a Q3 forecast approval chain of three stages - an FP&A Lead marked mandatory and passed, a committee stage requiring a two-of-three quorum and still pending, and a mandatory CFO stage waiting - plus an option to add a further step","/blog/human-approval-checkpoints-for-ai-agents/velt.png",[11,240,241],{},"An agent's suggestion - a document change, a report figure, a database row - sits in a pending state, separate from live app data, until someone reviews it. The pieces developers wire up:",[78,243,244,250,256,262],{},[81,245,246,249],{},[33,247,248],{},"Approval flows"," with routing rules: a single sign-off for one type of content, a multi-step chain for another, based on role or document type.",[81,251,252,255],{},[33,253,254],{},"Contextual suggestions"," shown as inline diffs or comment threads attached to the exact UI element they affect.",[81,257,258,261],{},[33,259,260],{},"Immutable audit logs"," recording every proposal, edit, and approval with a timestamp and the approver's identity.",[81,263,264,267],{},[33,265,266],{},"Memory ingestion",", where the system indexes past approvals so future agent proposals line up with what reviewers have accepted before.",[11,269,270],{},"A financial analyst reviewing an AI-generated report sees the agent's proposed numbers highlighted in the dashboard, the analyst opens a side panel to see the agent's reasoning, edits a figure directly in the suggestion view, and clicks approve. Only then does Velt fire a webhook to the backend, which writes the change to the production database. If the change needs sign-off from more than one person, Velt routes it to the next approver in the chain automatically, and the underlying record stays untouched until every required approval comes in.",[11,272,273],{},"Velt also ships a review agent, where a model checks AI-generated content against a set of stored rules - a brand guideline, a compliance policy - and drops a comment flagging an issue before a person even opens the document. It's a first-pass check rather than a final decision, and it cuts what the human reviewer has to catch manually.",[11,275,276],{},"Velt bills on activity rather than seats, so a large but mostly passive user base does not drive the cost. Their materials describe the billing unit in two ways, as monthly active collaborators in one place and as monthly active documents - \"a unique document that has CRUD operations performed on it by any Velt feature during the month\" - in another. Velt states that its products are \"SOC 2 Type II and HIPAA compliant\", with multi-region hosting and a self-hosting option for sensitive data. It fits fintech dashboards, creative review tools, and any app where a person needs to see and edit an AI proposal in the interface they already use. Like Webfuse, it works at the app layer, so the agent logic still lives somewhere else.",[61,278,280],{"id":279},"what-these-four-have-in-common","What these four have in common",[11,282,283],{},"All four separate the proposal from the live data it would change, and all four keep a record of who saw what and when. The reviewer gets something concrete to act on: a page, a design document, a state payload, a diff. The record carries as much weight as the pause. A wire transfer approved with no trace of who clicked confirm, and on what basis, is still an audit gap.",[61,285,287],{"id":286},"which-one-fits-your-setup","Which one fits your setup",[289,290,291,307],"table",{},[292,293,294],"thead",{},[295,296,297,301,304],"tr",{},[298,299,300],"th",{},"Tool",[298,302,303],{},"Best for",[298,305,306],{},"Where it pauses",[308,309,310,323,335,347],"tbody",{},[295,311,312,317,320],{},[313,314,315],"td",{},[33,316,40],{},[313,318,319],{},"Legacy web apps with no API, customer-facing sessions",[313,321,322],{},"Inside a live browser session",[295,324,325,329,332],{},[313,326,327],{},[33,328,46],{},[313,330,331],{},"AI coding agents working in large codebases",[313,333,334],{},"Before code gets written",[295,336,337,341,344],{},[313,338,339],{},[33,340,52],{},[313,342,343],{},"Custom, often cyclical agent workflows needing full control",[313,345,346],{},"At a developer-defined graph node",[295,348,349,353,356],{},[313,350,351],{},[33,352,58],{},[313,354,355],{},"In-app review of AI-generated content, with a UI already built",[313,357,358],{},"Before a webhook writes to your database",[11,360,361],{},"The four are not mutually exclusive. A team can run LangGraph as the orchestration layer and use Webfuse for the steps that happen in a browser, or pair HumanLayer's design review with Velt's in-app sign-off on the shipped feature. The build effort differs more than the outcome: Velt and Webfuse ship a reviewer experience, LangGraph ships primitives, and HumanLayer ships a workflow you follow.",{"title":363,"searchDepth":364,"depth":364,"links":365},"",2,[366,367,368,369,370,371],{"id":63,"depth":364,"text":64},{"id":121,"depth":364,"text":122},{"id":166,"depth":364,"text":167},{"id":230,"depth":364,"text":231},{"id":279,"depth":364,"text":280},{"id":286,"depth":364,"text":287},"ai-agents","2026-08-14","Four platforms that pause an AI agent before a high-stakes action and hand the decision to a person. Compare Webfuse, HumanLayer, LangGraph and Velt on where the pause happens, what the reviewer sees, and what each one leaves you to build.","md",[377,380,383,386],{"question":378,"answer":379},"What is a human-in-the-loop checkpoint for an AI agent?","It is a deliberate pause before an agent performs an action that is hard to reverse, such as moving money, changing a live configuration or editing a customer record. The agent's proposed action is held separately from the production data until a person reviews it and approves, edits or rejects it.",{"question":381,"answer":382},"Where should the approval step sit?","At whichever layer the high-stakes action actually happens. Webfuse pauses inside a live browser session, Velt inside the application's own interface, HumanLayer before any code is written, and LangGraph at a node the developer marks in the workflow graph.",{"question":384,"answer":385},"Which option requires the least engineering work?","Velt and Webfuse ship a reviewer experience. LangGraph supplies the pause and resume primitives but leaves the review dashboard, notifications and resume logic to you, so it takes the most build effort in exchange for the most control.",{"question":387,"answer":388},"Do these tools remove the need for human review?","No. They change where and how the review happens, and they make the record of it auditable. A person still makes the decision on the actions that matter.",0,null,false,{"shortTitle":393,"relatedLinks":394},"AI Agent Approval Checkpoints",[395,399],{"text":396,"href":397,"description":398},"5 Best Tools to Let AI Agents Guide Users Through a Website (2026)","/blog/5-best-tools-to-let-ai-agents-guide-users-through-a-website-2026","A comparison of the tools that let an agent act on a live page alongside the person using it.",{"text":400,"href":401,"description":402},"How to Connect an AI Agent to the Live Web","/blog/how-to-connect-an-ai-agent-to-the-live-web","The five architectures for giving an agent an execution layer on the web, and how they differ.",true,"/blog/human-approval-checkpoints-for-ai-agents",{"title":5,"description":374},{"loc":404},"blog/1051.human-approval-checkpoints-for-ai-agents",[372,409,410,411,412],"human-in-the-loop","enterprise-ai","web-agents","governance","J5y9YguOHhFLYkGVLCdBms93PA0OP12RVSFcNifSgn0",[415,3136],{"id":416,"title":417,"authorId":418,"body":419,"category":372,"created":3117,"description":3118,"extension":375,"faqs":390,"featurePriority":390,"head":390,"hideCta":403,"landingPath":390,"meta":3119,"navigation":403,"ogImage":390,"path":3127,"robots":390,"schemaOrg":390,"seo":3128,"sitemap":3129,"stem":3130,"tags":3131,"__hash__":3135},"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":420,"toc":3100},[421,428,452,456,459,463,466,469,478,482,487,494,512,516,519,522,526,533,537,542,545,562,566,584,588,600,614,618,632,636,639,643,661,664,668,678,683,758,761,764,769,840,845,964,969,1078,1082,1093,1098,1400,1405,1559,1568,1572,1583,1588,1592,1596,1599,1602,1605,1713,1717,1720,1724,1727,1730,1735,1959,1964,2216,2221,2297,2302,2309,2318,2322,2325,2328,2331,2336,2345,2349,2689,2709,2762,2766,2769,2801,2950,2954,2957,2960,2964,2975,2978,2989,2995,3096],[11,422,423,424,427],{},"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 ",[33,425,426],{},"snapshot",".",[11,429,430,431,438,439,443,444,438,448,451],{},"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 ",[432,433,437],"a",{"href":434,"rel":435},"https://playwright.dev",[436],"nofollow","Playwright"," or ",[432,440,40],{"href":441,"rel":442},"https://www.webfuse.com",[436],", for example, ",[445,446,447],"em",{},"clicking",[445,449,450],{},"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.",[15,453],{"src":454,":alt":455},"/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,457,458],{},"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.",[61,460,462],{"id":461},"gui-snapshots","GUI Snapshots",[11,464,465],{},"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,467,468],{},"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,470,471,472,477],{},"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 – ",[432,473,476],{"href":474,"rel":475},"https://html2canvas.hertzen.com",[436],"HTML2Canvas"," demonstrates the limits.",[15,479],{"src":480,"alt":481,"loading":20},"/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",[483,484,486],"h3",{"id":485},"vision-based-targeting","Vision-Based Targeting",[11,488,489,490,493],{},"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 ",[445,491,492],{},"\"Button with Text 'Shop'\"",". On its own, semantic targeting introduces a circular problem: which element has this text?",[11,495,496,497,500,501,504,505,508,509,427],{},"Consider the web browsing task: ",[445,498,499],{},"\"Navigate to the Apple online shop\"",". In combination with an action, in this case ",[445,502,503],{},"click",", the agent could target the ",[445,506,507],{},"Shop"," button via a point coordinate, e.g., ",[196,510,511],{},"(725, 750)",[15,513],{"src":514,"alt":515,"loading":20},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/3.png","A GUI snapshot (screenshot) visualising point coordinate targeting",[11,517,518],{},"When the UI shifts between snapshot and action time, geometric targeting suggestions might have become obsolete.",[11,520,521],{},"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.",[483,523,525],{"id":524},"the-problem-with-gui-snapshots","The Problem with GUI Snapshots",[11,527,528,529,532],{},"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 ",[445,530,531],{},"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.",[15,534],{"src":535,"alt":536,"loading":20},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/4.png","A GUI snapshot (screenshot) compared to its figuratively downsampled counterpart",[538,539,541],"h4",{"id":540},"grounded-gui-snapshots","Grounded GUI Snapshots",[11,543,544],{},"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,546,547,550,551,561],{},[445,548,549],{},"Set-of-Mark"," prompting is the go-to technique to create grounded GUI snapshots",[552,553,554],"sup",{},[432,555,560],{"href":556,"ariaDescribedBy":557,"dataFootnoteRef":363,"id":559},"#user-content-fn-1",[558],"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.",[15,563],{"src":564,"alt":565,"loading":20},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/5.png","A GUI snapshot (screenshot) visualising grounded cue targeting",[11,567,568,575,576,427],{},[432,569,572],{"href":570,"rel":571},"https://browser-use.com",[436],[445,573,574],{},"Browser Use"," agents implement Set-of-Mark-grounded GUI snapshots",[552,577,578],{},[432,579,583],{"href":580,"ariaDescribedBy":581,"dataFootnoteRef":363,"id":582},"#user-content-fn-2",[558],"user-content-fnref-2","2",[61,585,587],{"id":586},"dom-snapshots","DOM Snapshots",[11,589,590,591,599],{},"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",[552,592,593],{},[432,594,598],{"href":595,"ariaDescribedBy":596,"dataFootnoteRef":363,"id":597},"#user-content-fn-3",[558],"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,601,602,603,606,607,610,611,613],{},"Cross-origin ",[196,604,605],{},"iframe"," elements and ",[196,608,609],{},"canvas"," elements are exceptions to the DOM-is-source-of-truth assumption: ",[196,612,609],{},"-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.",[483,615,617],{"id":616},"dom-based-targeting","DOM-Based Targeting",[11,619,620,621,624,625,628,629,427],{},"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 ",[196,622,623],{},"class"," and ",[196,626,627],{},"id"," attributes – every element has at least one unique CSS selector, constructed from nth-child node paths, e.g., ",[196,630,631],{},"main .section:nth-child(2) > .row:nth-of-type(5) > form button",[15,633],{"src":634,"alt":635,"loading":20},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/6.png","A DOM snapshot (HTML) visualising CSS selector targeting",[11,637,638],{},"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.",[483,640,642],{"id":641},"the-problem-with-dom-snapshots","The Problem with DOM Snapshots",[11,644,645,646,651,652,660],{},"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 ",[432,647,650],{"href":648,"rel":649},"https://edition.cnn.com",[436],"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 ",[432,653,656,659],{"href":654,"rel":655},"https://openai.com/index/gpt-4o-system-card/",[436],[445,657,658],{},"GPT-4o"," (OpenAI)","). Ultimately, raw DOM snapshots out-cost GUI snapshots.",[11,662,663],{},"Using DOM snapshots with LLM-based web agents requires size-reducing transformations, similar to image downsampling implemented behind LLM APIs.",[538,665,667],{"id":666},"extracted-dom-snapshots","Extracted DOM Snapshots",[11,669,670,671,674,675,677],{},"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-",[445,672,673],{},"k"," extractions – the ",[445,676,673],{}," highest-scoring elements – a snapshot of the virtual DOM comes at a fraction of the original DOM's size.",[11,679,680],{},[33,681,682],{},"Top-3 DOM Snapshot:",[684,685,689],"pre",{"className":686,"code":687,"language":688,"meta":363,"style":363},"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",[196,690,691,723,736],{"__ignoreMap":363},[692,693,696,700,704,708,711,715,718,720],"span",{"class":694,"line":695},"line",1,[692,697,699],{"class":698},"suv1-","\u003C",[692,701,703],{"class":702},"sxg3X","button",[692,705,707],{"class":706},"sFR8T"," type",[692,709,710],{"class":698},"=",[692,712,714],{"class":713},"s4wv1","\"submit\"",[692,716,717],{"class":698},">Submit\u003C/",[692,719,703],{"class":702},[692,721,722],{"class":698},">\n",[692,724,725,727,729,732,734],{"class":694,"line":364},[692,726,699],{"class":698},[692,728,703],{"class":702},[692,730,731],{"class":698},">More\u003C/",[692,733,703],{"class":702},[692,735,722],{"class":698},[692,737,739,741,743,746,748,751,754,756],{"class":694,"line":738},3,[692,740,699],{"class":698},[692,742,432],{"class":702},[692,744,745],{"class":706}," href",[692,747,710],{"class":698},[692,749,750],{"class":713},"\"/more\"",[692,752,753],{"class":698},">Find out more\u003C/",[692,755,432],{"class":702},[692,757,722],{"class":698},[11,759,760],{},"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,762,763],{},"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,765,766],{},[33,767,768],{},"Extracted DOM Snapshot:",[684,770,772],{"className":686,"code":771,"language":688,"meta":363,"style":363},"\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",[196,773,774,787,800,813,827],{"__ignoreMap":363},[692,775,776,778,780,783,785],{"class":694,"line":695},[692,777,699],{"class":698},[692,779,33],{"class":702},[692,781,782],{"class":698},">MacBook Air\u003C/",[692,784,33],{"class":702},[692,786,722],{"class":698},[692,788,789,791,793,796,798],{"class":694,"line":364},[692,790,699],{"class":698},[692,792,703],{"class":702},[692,794,795],{"class":698},">Add to cart\u003C/",[692,797,703],{"class":702},[692,799,722],{"class":698},[692,801,802,804,806,809,811],{"class":694,"line":738},[692,803,699],{"class":698},[692,805,11],{"class":702},[692,807,808],{"class":698},">Out of stock\u003C/",[692,810,11],{"class":702},[692,812,722],{"class":698},[692,814,816,818,820,823,825],{"class":694,"line":815},4,[692,817,699],{"class":698},[692,819,61],{"class":702},[692,821,822],{"class":698},">MacBook Pro\u003C/",[692,824,61],{"class":702},[692,826,722],{"class":698},[692,828,830,832,834,836,838],{"class":694,"line":829},5,[692,831,699],{"class":698},[692,833,703],{"class":702},[692,835,795],{"class":698},[692,837,703],{"class":702},[692,839,722],{"class":698},[11,841,842],{},[33,843,844],{},"Original DOM Snapshot – Candidate A:",[684,846,848],{"className":686,"code":847,"language":688,"meta":363,"style":363},"\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",[196,849,850,867,880,892,905,914,929,942,955],{"__ignoreMap":363},[692,851,852,854,857,860,862,865],{"class":694,"line":695},[692,853,699],{"class":698},[692,855,856],{"class":702},"section",[692,858,859],{"class":706}," class",[692,861,710],{"class":698},[692,863,864],{"class":713},"\"product\"",[692,866,722],{"class":698},[692,868,869,872,874,876,878],{"class":694,"line":364},[692,870,871],{"class":698},"  \u003C",[692,873,33],{"class":702},[692,875,782],{"class":698},[692,877,33],{"class":702},[692,879,722],{"class":698},[692,881,882,884,886,888,890],{"class":694,"line":738},[692,883,871],{"class":698},[692,885,703],{"class":702},[692,887,795],{"class":698},[692,889,703],{"class":702},[692,891,722],{"class":698},[692,893,894,896,898,900,902],{"class":694,"line":815},[692,895,871],{"class":698},[692,897,11],{"class":702},[692,899,808],{"class":698},[692,901,11],{"class":702},[692,903,904],{"class":698},">  👈\n",[692,906,907,910,912],{"class":694,"line":829},[692,908,909],{"class":698},"\u003C/",[692,911,856],{"class":702},[692,913,722],{"class":698},[692,915,917,919,921,923,925,927],{"class":694,"line":916},6,[692,918,699],{"class":698},[692,920,856],{"class":702},[692,922,859],{"class":706},[692,924,710],{"class":698},[692,926,864],{"class":713},[692,928,722],{"class":698},[692,930,932,934,936,938,940],{"class":694,"line":931},7,[692,933,871],{"class":698},[692,935,33],{"class":702},[692,937,822],{"class":698},[692,939,33],{"class":702},[692,941,722],{"class":698},[692,943,945,947,949,951,953],{"class":694,"line":944},8,[692,946,871],{"class":698},[692,948,703],{"class":702},[692,950,795],{"class":698},[692,952,703],{"class":702},[692,954,722],{"class":698},[692,956,958,960,962],{"class":694,"line":957},9,[692,959,909],{"class":698},[692,961,856],{"class":702},[692,963,722],{"class":698},[11,965,966],{},[33,967,968],{},"Original DOM Snapshot – Candidate B:",[684,970,972],{"className":686,"code":971,"language":688,"meta":363,"style":363},"\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",[196,973,974,988,1000,1012,1020,1034,1046,1058,1070],{"__ignoreMap":363},[692,975,976,978,980,982,984,986],{"class":694,"line":695},[692,977,699],{"class":698},[692,979,856],{"class":702},[692,981,859],{"class":706},[692,983,710],{"class":698},[692,985,864],{"class":713},[692,987,722],{"class":698},[692,989,990,992,994,996,998],{"class":694,"line":364},[692,991,871],{"class":698},[692,993,33],{"class":702},[692,995,782],{"class":698},[692,997,33],{"class":702},[692,999,722],{"class":698},[692,1001,1002,1004,1006,1008,1010],{"class":694,"line":738},[692,1003,871],{"class":698},[692,1005,703],{"class":702},[692,1007,795],{"class":698},[692,1009,703],{"class":702},[692,1011,722],{"class":698},[692,1013,1014,1016,1018],{"class":694,"line":815},[692,1015,909],{"class":698},[692,1017,856],{"class":702},[692,1019,722],{"class":698},[692,1021,1022,1024,1026,1028,1030,1032],{"class":694,"line":829},[692,1023,699],{"class":698},[692,1025,856],{"class":702},[692,1027,859],{"class":706},[692,1029,710],{"class":698},[692,1031,864],{"class":713},[692,1033,722],{"class":698},[692,1035,1036,1038,1040,1042,1044],{"class":694,"line":916},[692,1037,871],{"class":698},[692,1039,11],{"class":702},[692,1041,808],{"class":698},[692,1043,11],{"class":702},[692,1045,904],{"class":698},[692,1047,1048,1050,1052,1054,1056],{"class":694,"line":931},[692,1049,871],{"class":698},[692,1051,33],{"class":702},[692,1053,822],{"class":698},[692,1055,33],{"class":702},[692,1057,722],{"class":698},[692,1059,1060,1062,1064,1066,1068],{"class":694,"line":944},[692,1061,871],{"class":698},[692,1063,703],{"class":702},[692,1065,795],{"class":698},[692,1067,703],{"class":702},[692,1069,722],{"class":698},[692,1071,1072,1074,1076],{"class":694,"line":957},[692,1073,909],{"class":698},[692,1075,856],{"class":702},[692,1077,722],{"class":698},[538,1079,1081],{"id":1080},"downsampled-dom-snapshots","Downsampled DOM Snapshots",[11,1083,1084,1085,427],{},"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",[552,1086,1087],{},[432,1088,1092],{"href":1089,"ariaDescribedBy":1090,"dataFootnoteRef":363,"id":1091},"#user-content-fn-4",[558],"user-content-fnref-4","4",[11,1094,1095],{},[33,1096,1097],{},"Original DOM Snapshot:",[684,1099,1101],{"className":686,"code":1100,"language":688,"meta":363,"style":363},"\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",[196,1102,1103,1141,1172,1187,1195,1211,1225,1233,1238,1243,1253,1274,1284,1299,1313,1322,1328,1334,1343,1362,1371,1381,1391],{"__ignoreMap":363},[692,1104,1105,1107,1109,1111,1113,1116,1119,1121,1124,1127,1129,1132,1134,1136,1139],{"class":694,"line":695},[692,1106,699],{"class":698},[692,1108,856],{"class":702},[692,1110,859],{"class":706},[692,1112,710],{"class":698},[692,1114,1115],{"class":713},"\"container\"",[692,1117,1118],{"class":706}," tabindex",[692,1120,710],{"class":698},[692,1122,1123],{"class":713},"\"3\"",[692,1125,1126],{"class":706}," required",[692,1128,710],{"class":698},[692,1130,1131],{"class":713},"\"true\"",[692,1133,707],{"class":706},[692,1135,710],{"class":698},[692,1137,1138],{"class":713},"\"example\"",[692,1140,722],{"class":698},[692,1142,1143,1145,1148,1150,1152,1155,1158,1160,1163,1165,1167,1170],{"class":694,"line":364},[692,1144,871],{"class":698},[692,1146,1147],{"class":702},"div",[692,1149,859],{"class":706},[692,1151,710],{"class":698},[692,1153,1154],{"class":713},"\"mx-auto\"",[692,1156,1157],{"class":706}," data-topic",[692,1159,710],{"class":698},[692,1161,1162],{"class":713},"\"products\"",[692,1164,1126],{"class":706},[692,1166,710],{"class":698},[692,1168,1169],{"class":713},"\"false\"",[692,1171,722],{"class":698},[692,1173,1174,1177,1180,1183,1185],{"class":694,"line":738},[692,1175,1176],{"class":698},"    \u003C",[692,1178,1179],{"class":702},"h1",[692,1181,1182],{"class":698},">Our Pizza\u003C/",[692,1184,1179],{"class":702},[692,1186,722],{"class":698},[692,1188,1189,1191,1193],{"class":694,"line":815},[692,1190,1176],{"class":698},[692,1192,1147],{"class":702},[692,1194,722],{"class":698},[692,1196,1197,1200,1202,1204,1206,1209],{"class":694,"line":829},[692,1198,1199],{"class":698},"      \u003C",[692,1201,1147],{"class":702},[692,1203,859],{"class":706},[692,1205,710],{"class":698},[692,1207,1208],{"class":713},"\"shadow-lg\"",[692,1210,722],{"class":698},[692,1212,1213,1216,1218,1221,1223],{"class":694,"line":916},[692,1214,1215],{"class":698},"        \u003C",[692,1217,61],{"class":702},[692,1219,1220],{"class":698},">Margherita\u003C/",[692,1222,61],{"class":702},[692,1224,722],{"class":698},[692,1226,1227,1229,1231],{"class":694,"line":931},[692,1228,1215],{"class":698},[692,1230,11],{"class":702},[692,1232,722],{"class":698},[692,1234,1235],{"class":694,"line":944},[692,1236,1237],{"class":698},"         A simple classic: mozzarella, tomatoes and basil.\n",[692,1239,1240],{"class":694,"line":957},[692,1241,1242],{"class":698},"         An everyday choice!\n",[692,1244,1246,1249,1251],{"class":694,"line":1245},10,[692,1247,1248],{"class":698},"        \u003C/",[692,1250,11],{"class":702},[692,1252,722],{"class":698},[692,1254,1256,1258,1260,1262,1264,1267,1270,1272],{"class":694,"line":1255},11,[692,1257,1215],{"class":698},[692,1259,703],{"class":702},[692,1261,707],{"class":706},[692,1263,710],{"class":698},[692,1265,1266],{"class":713},"\"button\"",[692,1268,1269],{"class":698},">Add\u003C/",[692,1271,703],{"class":702},[692,1273,722],{"class":698},[692,1275,1277,1280,1282],{"class":694,"line":1276},12,[692,1278,1279],{"class":698},"      \u003C/",[692,1281,1147],{"class":702},[692,1283,722],{"class":698},[692,1285,1287,1289,1291,1293,1295,1297],{"class":694,"line":1286},13,[692,1288,1199],{"class":698},[692,1290,1147],{"class":702},[692,1292,859],{"class":706},[692,1294,710],{"class":698},[692,1296,1208],{"class":713},[692,1298,722],{"class":698},[692,1300,1302,1304,1306,1309,1311],{"class":694,"line":1301},14,[692,1303,1215],{"class":698},[692,1305,61],{"class":702},[692,1307,1308],{"class":698},">Capricciosa\u003C/",[692,1310,61],{"class":702},[692,1312,722],{"class":698},[692,1314,1316,1318,1320],{"class":694,"line":1315},15,[692,1317,1215],{"class":698},[692,1319,11],{"class":702},[692,1321,722],{"class":698},[692,1323,1325],{"class":694,"line":1324},16,[692,1326,1327],{"class":698},"          A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[692,1329,1331],{"class":694,"line":1330},17,[692,1332,1333],{"class":698},"          A true favourite!\n",[692,1335,1337,1339,1341],{"class":694,"line":1336},18,[692,1338,1248],{"class":698},[692,1340,11],{"class":702},[692,1342,722],{"class":698},[692,1344,1346,1348,1350,1352,1354,1356,1358,1360],{"class":694,"line":1345},19,[692,1347,1215],{"class":698},[692,1349,703],{"class":702},[692,1351,707],{"class":706},[692,1353,710],{"class":698},[692,1355,1266],{"class":713},[692,1357,1269],{"class":698},[692,1359,703],{"class":702},[692,1361,722],{"class":698},[692,1363,1365,1367,1369],{"class":694,"line":1364},20,[692,1366,1279],{"class":698},[692,1368,1147],{"class":702},[692,1370,722],{"class":698},[692,1372,1374,1377,1379],{"class":694,"line":1373},21,[692,1375,1376],{"class":698},"    \u003C/",[692,1378,1147],{"class":702},[692,1380,722],{"class":698},[692,1382,1384,1387,1389],{"class":694,"line":1383},22,[692,1385,1386],{"class":698},"  \u003C/",[692,1388,1147],{"class":702},[692,1390,722],{"class":698},[692,1392,1394,1396,1398],{"class":694,"line":1393},23,[692,1395,909],{"class":698},[692,1397,856],{"class":702},[692,1399,722],{"class":698},[11,1401,1402],{},[33,1403,1404],{},"Downsampled DOM Snapshot:",[684,1406,1408],{"className":686,"code":1407,"language":688,"meta":363,"style":363},"\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",[196,1409,1410,1436,1456,1461,1469,1474,1479,1484,1502,1507,1512,1517,1535,1543,1551],{"__ignoreMap":363},[692,1411,1412,1414,1416,1418,1420,1422,1424,1426,1428,1430,1432,1434],{"class":694,"line":695},[692,1413,699],{"class":698},[692,1415,856],{"class":702},[692,1417,859],{"class":706},[692,1419,710],{"class":698},[692,1421,1115],{"class":713},[692,1423,1126],{"class":706},[692,1425,710],{"class":698},[692,1427,1131],{"class":713},[692,1429,707],{"class":706},[692,1431,710],{"class":698},[692,1433,1138],{"class":713},[692,1435,722],{"class":698},[692,1437,1438,1440,1442,1444,1446,1448,1450,1452,1454],{"class":694,"line":364},[692,1439,871],{"class":698},[692,1441,1147],{"class":702},[692,1443,859],{"class":706},[692,1445,710],{"class":698},[692,1447,1154],{"class":713},[692,1449,1126],{"class":706},[692,1451,710],{"class":698},[692,1453,1169],{"class":713},[692,1455,722],{"class":698},[692,1457,1458],{"class":694,"line":738},[692,1459,1460],{"class":698},"    Our Pizza\n",[692,1462,1463,1465,1467],{"class":694,"line":815},[692,1464,1176],{"class":698},[692,1466,1147],{"class":702},[692,1468,722],{"class":698},[692,1470,1471],{"class":694,"line":829},[692,1472,1473],{"class":698},"      Margherita\n",[692,1475,1476],{"class":694,"line":916},[692,1477,1478],{"class":698},"      A simple classic: mozzarella, tomatoes and basil.\n",[692,1480,1481],{"class":694,"line":931},[692,1482,1483],{"class":698},"      An everyday choice!\n",[692,1485,1486,1488,1490,1492,1494,1496,1498,1500],{"class":694,"line":944},[692,1487,1199],{"class":698},[692,1489,703],{"class":702},[692,1491,707],{"class":706},[692,1493,710],{"class":698},[692,1495,1266],{"class":713},[692,1497,1269],{"class":698},[692,1499,703],{"class":702},[692,1501,722],{"class":698},[692,1503,1504],{"class":694,"line":957},[692,1505,1506],{"class":698},"      Capricciosa\n",[692,1508,1509],{"class":694,"line":1245},[692,1510,1511],{"class":698},"      A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[692,1513,1514],{"class":694,"line":1255},[692,1515,1516],{"class":698},"      A true favourite!\n",[692,1518,1519,1521,1523,1525,1527,1529,1531,1533],{"class":694,"line":1276},[692,1520,1199],{"class":698},[692,1522,703],{"class":702},[692,1524,707],{"class":706},[692,1526,710],{"class":698},[692,1528,1266],{"class":713},[692,1530,1269],{"class":698},[692,1532,703],{"class":702},[692,1534,722],{"class":698},[692,1536,1537,1539,1541],{"class":694,"line":1286},[692,1538,1376],{"class":698},[692,1540,1147],{"class":702},[692,1542,722],{"class":698},[692,1544,1545,1547,1549],{"class":694,"line":1301},[692,1546,1386],{"class":698},[692,1548,1147],{"class":702},[692,1550,722],{"class":698},[692,1552,1553,1555,1557],{"class":694,"line":1315},[692,1554,909],{"class":698},[692,1556,856],{"class":702},[692,1558,722],{"class":698},[11,1560,1561,1562,427],{},"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",[552,1563,1564],{},[432,1565,1092],{"href":1089,"ariaDescribedBy":1566,"dataFootnoteRef":363,"id":1567},[558],"user-content-fnref-4-2",[483,1569,1571],{"id":1570},"the-problem-with-dom-based-targeting","The Problem with DOM-Based Targeting",[11,1573,1574,1575,1578,1579,1582],{},"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 ",[196,1576,1577],{},"UNIQUE-ID=\"27\"",", which can be selected via ",[196,1580,1581],{},"[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,1584,1585],{},[33,1586,1587],{},"DOM Snapshot with Inlined IDs:",[15,1589],{"src":1590,"alt":1591,"loading":20},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/7.png","A DOM snapshot (HTML) visualising unique ID (attribute) targeting",[483,1593,1595],{"id":1594},"the-dom-based-snapshot-pipeline","The DOM-Based Snapshot Pipeline",[11,1597,1598],{},"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,1600,1601],{},"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,1603,1604],{},"The pipeline approach traceably goes from the raw DOM to an abstract snapshot representation. For example:",[1606,1607,1608,1631,1637,1695,1701,1707],"ol",{},[81,1609,1610,1613,1614,1619,1620,1623,1624,624,1627,1630],{},[33,1611,1612],{},"Scope Subtree."," Scope in to a task-relevant subtree. An information retrieval task on ",[432,1615,1618],{"href":1616,"rel":1617},"https://www.wikipedia.org",[436],"wikipedia.org"," can scope into the ",[196,1621,1622],{},"main"," element – ",[196,1625,1626],{},"header",[196,1628,1629],{},"footer"," are irrelevant.",[81,1632,1633,1636],{},[33,1634,1635],{},"Clone."," Clone the live DOM.",[81,1638,1639,1642,1643],{},[33,1640,1641],{},"Filter."," Apply arbitrary filters to the cloned DOM (in memory). For example:\n",[78,1644,1645,1683,1689],{},[81,1646,1647,1650,1651],{},[33,1648,1649],{},"Prune Subtrees"," E.g.:\n",[78,1652,1653,1659,1665],{},[81,1654,1655,1658],{},[33,1656,1657],{},"Non-interactive Nodes",", e.g., hidden elements.",[81,1660,1661,1664],{},[33,1662,1663],{},"Irrelevant Nodes",", e.g., comment nodes.",[81,1666,1667,1670,1671,1673,1674,1676,1677,1680,1681,427],{},[33,1668,1669],{},"Redundant Nodes",", e.g., ",[196,1672,432],{}," in the ",[196,1675,1629],{}," that has a same-",[196,1678,1679],{},"href"," equivalent in the ",[196,1682,1626],{},[81,1684,1685,1688],{},[33,1686,1687],{},"Sanitise."," E.g., sensitive information from content-editables.",[81,1690,1691,1694],{},[33,1692,1693],{},"Clean."," E.g., remove stop words from text nodes.",[81,1696,1697,1700],{},[33,1698,1699],{},"Serialise."," Serialise the cloned DOM to HTML.",[81,1702,1703,1706],{},[33,1704,1705],{},"Downsample."," Downsample the HTML to control size.",[81,1708,1709,1712],{},[33,1710,1711],{},"Translate."," Translate the downsampled HTML to any DOM-based representation, e.g., the accessibility tree.",[15,1714],{"src":1715,"alt":1716,"loading":20,"provider":22},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/8.svg","Example of a DOM snapshot pipeline",[11,1718,1719],{},"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.",[538,1721,1723],{"id":1722},"arbitrary-snapshot-representations","Arbitrary Snapshot Representations",[11,1725,1726],{},"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,1728,1729],{},"Compare the following snapshots representations for the same UI:",[11,1731,1732],{},[33,1733,1734],{},"DOM Snapshot:",[684,1736,1738],{"className":686,"code":1737,"language":688,"meta":363,"style":363},"\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",[196,1739,1740,1766,1786,1798,1806,1818,1826,1831,1836,1844,1871,1883,1891,1896,1901,1909,1935,1943,1951],{"__ignoreMap":363},[692,1741,1742,1744,1746,1748,1750,1752,1754,1756,1758,1760,1762,1764],{"class":694,"line":695},[692,1743,699],{"class":698},[692,1745,856],{"class":702},[692,1747,859],{"class":706},[692,1749,710],{"class":698},[692,1751,1115],{"class":713},[692,1753,1126],{"class":706},[692,1755,710],{"class":698},[692,1757,1131],{"class":713},[692,1759,707],{"class":706},[692,1761,710],{"class":698},[692,1763,1138],{"class":713},[692,1765,722],{"class":698},[692,1767,1768,1770,1772,1774,1776,1778,1780,1782,1784],{"class":694,"line":364},[692,1769,871],{"class":698},[692,1771,1147],{"class":702},[692,1773,859],{"class":706},[692,1775,710],{"class":698},[692,1777,1154],{"class":713},[692,1779,1126],{"class":706},[692,1781,710],{"class":698},[692,1783,1169],{"class":713},[692,1785,722],{"class":698},[692,1787,1788,1790,1792,1794,1796],{"class":694,"line":738},[692,1789,1176],{"class":698},[692,1791,1179],{"class":702},[692,1793,1182],{"class":698},[692,1795,1179],{"class":702},[692,1797,722],{"class":698},[692,1799,1800,1802,1804],{"class":694,"line":815},[692,1801,1176],{"class":698},[692,1803,1147],{"class":702},[692,1805,722],{"class":698},[692,1807,1808,1810,1812,1814,1816],{"class":694,"line":829},[692,1809,1199],{"class":698},[692,1811,61],{"class":702},[692,1813,1220],{"class":698},[692,1815,61],{"class":702},[692,1817,722],{"class":698},[692,1819,1820,1822,1824],{"class":694,"line":916},[692,1821,1199],{"class":698},[692,1823,11],{"class":702},[692,1825,722],{"class":698},[692,1827,1828],{"class":694,"line":931},[692,1829,1830],{"class":698},"        A simple classic: mozzarella, tomatoes and basil.\n",[692,1832,1833],{"class":694,"line":944},[692,1834,1835],{"class":698},"        An everyday choice!\n",[692,1837,1838,1840,1842],{"class":694,"line":957},[692,1839,1279],{"class":698},[692,1841,11],{"class":702},[692,1843,722],{"class":698},[692,1845,1846,1848,1850,1852,1854,1857,1860,1862,1865,1867,1869],{"class":694,"line":1245},[692,1847,1199],{"class":698},[692,1849,432],{"class":702},[692,1851,745],{"class":706},[692,1853,710],{"class":698},[692,1855,1856],{"class":713},"\"add?p=margherita\"",[692,1858,1859],{"class":706}," data-uid",[692,1861,710],{"class":698},[692,1863,1864],{"class":713},"\"1\"",[692,1866,1269],{"class":698},[692,1868,432],{"class":702},[692,1870,722],{"class":698},[692,1872,1873,1875,1877,1879,1881],{"class":694,"line":1255},[692,1874,1199],{"class":698},[692,1876,61],{"class":702},[692,1878,1308],{"class":698},[692,1880,61],{"class":702},[692,1882,722],{"class":698},[692,1884,1885,1887,1889],{"class":694,"line":1276},[692,1886,1199],{"class":698},[692,1888,11],{"class":702},[692,1890,722],{"class":698},[692,1892,1893],{"class":694,"line":1286},[692,1894,1895],{"class":698},"        A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[692,1897,1898],{"class":694,"line":1301},[692,1899,1900],{"class":698},"        A true favourite!\n",[692,1902,1903,1905,1907],{"class":694,"line":1315},[692,1904,1279],{"class":698},[692,1906,11],{"class":702},[692,1908,722],{"class":698},[692,1910,1911,1913,1915,1917,1919,1922,1924,1926,1929,1931,1933],{"class":694,"line":1324},[692,1912,1199],{"class":698},[692,1914,432],{"class":702},[692,1916,745],{"class":706},[692,1918,710],{"class":698},[692,1920,1921],{"class":713},"\"add?p=capricciosa\"",[692,1923,1859],{"class":706},[692,1925,710],{"class":698},[692,1927,1928],{"class":713},"\"2\"",[692,1930,1269],{"class":698},[692,1932,432],{"class":702},[692,1934,722],{"class":698},[692,1936,1937,1939,1941],{"class":694,"line":1330},[692,1938,1376],{"class":698},[692,1940,1147],{"class":702},[692,1942,722],{"class":698},[692,1944,1945,1947,1949],{"class":694,"line":1336},[692,1946,1386],{"class":698},[692,1948,1147],{"class":702},[692,1950,722],{"class":698},[692,1952,1953,1955,1957],{"class":694,"line":1345},[692,1954,909],{"class":698},[692,1956,856],{"class":702},[692,1958,722],{"class":698},[11,1960,1961],{},[33,1962,1963],{},"Accessibility Tree Snapshot:",[684,1965,1969],{"className":1966,"code":1967,"language":1968,"meta":363,"style":363},"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",[196,1970,1971,1982,1989,1998,2005,2015,2026,2037,2045,2054,2063,2072,2079,2092,2101,2110,2120,2129,2137,2146,2154,2162,2168,2179,2188,2197,2207],{"__ignoreMap":363},[692,1972,1973,1976,1979],{"class":694,"line":695},[692,1974,1975],{"class":698},"- ",[692,1977,1978],{"class":702},"document",[692,1980,1981],{"class":698},":\n",[692,1983,1984,1987],{"class":694,"line":364},[692,1985,1986],{"class":702},"  children",[692,1988,1981],{"class":698},[692,1990,1991,1994,1996],{"class":694,"line":738},[692,1992,1993],{"class":698},"    - ",[692,1995,856],{"class":702},[692,1997,1981],{"class":698},[692,1999,2000,2003],{"class":694,"line":815},[692,2001,2002],{"class":702},"      children",[692,2004,1981],{"class":698},[692,2006,2007,2010,2013],{"class":694,"line":829},[692,2008,2009],{"class":698},"        - ",[692,2011,2012],{"class":702},"heading",[692,2014,1981],{"class":698},[692,2016,2017,2020,2023],{"class":694,"line":916},[692,2018,2019],{"class":702},"          name",[692,2021,2022],{"class":698},": ",[692,2024,2025],{"class":713},"\"Our Pizza\"\n",[692,2027,2028,2031,2033],{"class":694,"line":931},[692,2029,2030],{"class":702},"          level",[692,2032,2022],{"class":698},[692,2034,2036],{"class":2035},"s8ozJ","1\n",[692,2038,2039,2041,2043],{"class":694,"line":944},[692,2040,2009],{"class":698},[692,2042,2012],{"class":702},[692,2044,1981],{"class":698},[692,2046,2047,2049,2051],{"class":694,"line":957},[692,2048,2019],{"class":702},[692,2050,2022],{"class":698},[692,2052,2053],{"class":713},"\"Margherita\"\n",[692,2055,2056,2058,2060],{"class":694,"line":1245},[692,2057,2030],{"class":702},[692,2059,2022],{"class":698},[692,2061,2062],{"class":2035},"2\n",[692,2064,2065,2067,2070],{"class":694,"line":1255},[692,2066,2009],{"class":698},[692,2068,2069],{"class":702},"paragraph",[692,2071,1981],{"class":698},[692,2073,2074,2077],{"class":694,"line":1276},[692,2075,2076],{"class":702},"          children",[692,2078,1981],{"class":698},[692,2080,2081,2084,2087,2089],{"class":694,"line":1286},[692,2082,2083],{"class":698},"            - ",[692,2085,2086],{"class":702},"text",[692,2088,2022],{"class":698},[692,2090,2091],{"class":713},"\"A simple classic: mozzarella, tomatoes and basil. An everyday choice!\"\n",[692,2093,2094,2096,2099],{"class":694,"line":1301},[692,2095,2009],{"class":698},[692,2097,2098],{"class":702},"link",[692,2100,1981],{"class":698},[692,2102,2103,2105,2107],{"class":694,"line":1315},[692,2104,2019],{"class":702},[692,2106,2022],{"class":698},[692,2108,2109],{"class":713},"\"Add\"\n",[692,2111,2112,2115,2117],{"class":694,"line":1324},[692,2113,2114],{"class":702},"          url",[692,2116,2022],{"class":698},[692,2118,2119],{"class":713},"\"add?p=margherita\"\n",[692,2121,2122,2125,2127],{"class":694,"line":1330},[692,2123,2124],{"class":702},"          data-uid",[692,2126,2022],{"class":698},[692,2128,2036],{"class":2035},[692,2130,2131,2133,2135],{"class":694,"line":1336},[692,2132,2009],{"class":698},[692,2134,2012],{"class":702},[692,2136,1981],{"class":698},[692,2138,2139,2141,2143],{"class":694,"line":1345},[692,2140,2019],{"class":702},[692,2142,2022],{"class":698},[692,2144,2145],{"class":713},"\"Capricciosa\"\n",[692,2147,2148,2150,2152],{"class":694,"line":1364},[692,2149,2030],{"class":702},[692,2151,2022],{"class":698},[692,2153,2062],{"class":2035},[692,2155,2156,2158,2160],{"class":694,"line":1373},[692,2157,2009],{"class":698},[692,2159,2069],{"class":702},[692,2161,1981],{"class":698},[692,2163,2164,2166],{"class":694,"line":1383},[692,2165,2076],{"class":702},[692,2167,1981],{"class":698},[692,2169,2170,2172,2174,2176],{"class":694,"line":1393},[692,2171,2083],{"class":698},[692,2173,2086],{"class":702},[692,2175,2022],{"class":698},[692,2177,2178],{"class":713},"\"A rich taste: mozzarella, ham, mushrooms, artichokes and olives. A true favourite!\"\n",[692,2180,2182,2184,2186],{"class":694,"line":2181},24,[692,2183,2009],{"class":698},[692,2185,2098],{"class":702},[692,2187,1981],{"class":698},[692,2189,2191,2193,2195],{"class":694,"line":2190},25,[692,2192,2019],{"class":702},[692,2194,2022],{"class":698},[692,2196,2109],{"class":713},[692,2198,2200,2202,2204],{"class":694,"line":2199},26,[692,2201,2114],{"class":702},[692,2203,2022],{"class":698},[692,2205,2206],{"class":713},"\"add?p=capricciosa\"\n",[692,2208,2210,2212,2214],{"class":694,"line":2209},27,[692,2211,2124],{"class":702},[692,2213,2022],{"class":698},[692,2215,2062],{"class":2035},[11,2217,2218],{},[33,2219,2220],{},"Markdown Snapshot:",[684,2222,2225],{"className":2223,"code":2224,"language":375,"meta":363,"style":363},"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",[196,2226,2227,2232,2237,2242,2246,2251,2256,2260,2265,2269,2274,2278,2283,2288,2292],{"__ignoreMap":363},[692,2228,2229],{"class":694,"line":695},[692,2230,2231],{},"# Our Pizza\n",[692,2233,2234],{"class":694,"line":364},[692,2235,2236],{"emptyLinePlaceholder":403},"\n",[692,2238,2239],{"class":694,"line":738},[692,2240,2241],{},"## Margherita\n",[692,2243,2244],{"class":694,"line":815},[692,2245,2236],{"emptyLinePlaceholder":403},[692,2247,2248],{"class":694,"line":829},[692,2249,2250],{},"A simple classic: mozzarella, tomatoes and basil.\n",[692,2252,2253],{"class":694,"line":916},[692,2254,2255],{},"An everyday choice!\n",[692,2257,2258],{"class":694,"line":931},[692,2259,2236],{"emptyLinePlaceholder":403},[692,2261,2262],{"class":694,"line":944},[692,2263,2264],{},"[Add](add?p=margherita)\n",[692,2266,2267],{"class":694,"line":957},[692,2268,2236],{"emptyLinePlaceholder":403},[692,2270,2271],{"class":694,"line":1245},[692,2272,2273],{},"## Capricciosa\n",[692,2275,2276],{"class":694,"line":1255},[692,2277,2236],{"emptyLinePlaceholder":403},[692,2279,2280],{"class":694,"line":1276},[692,2281,2282],{},"A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[692,2284,2285],{"class":694,"line":1286},[692,2286,2287],{},"A true favourite!\n",[692,2289,2290],{"class":694,"line":1301},[692,2291,2236],{"emptyLinePlaceholder":403},[692,2293,2294],{"class":694,"line":1315},[692,2295,2296],{},"[Add](add?p=capricciosa)\n",[11,2298,2299],{},[33,2300,2301],{},"Custom Format Snapshot:",[684,2303,2307],{"className":2304,"code":2306,"language":2086},[2305],"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",[196,2308,2306],{"__ignoreMap":363},[11,2310,2311,2312,427],{},"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",[552,2313,2314],{},[432,2315,1092],{"href":1089,"ariaDescribedBy":2316,"dataFootnoteRef":363,"id":2317},[558],"user-content-fnref-4-3",[61,2319,2321],{"id":2320},"non-idiomatic-application-designs","Non-Idiomatic Application Designs",[11,2323,2324],{},"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,2326,2327],{},"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,2329,2330],{},"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.",[15,2332],{"src":2333,"alt":2334,"loading":20,":width":2335},"/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,2337,2338,2339,2344],{},"As an example for bad affordance in the DOM, look at this datepicker from ",[432,2340,2343],{"href":2341,"rel":2342},"https://www.webmd.com",[436],"webmd.com",":",[15,2346],{"src":2347,"alt":2348,"loading":20,":width":2335},"/blog/serialising-web-ui-state-for-llms-the-complete-guide/10.png","Example of an HTML bad practice (ignoring tag name semantics)",[684,2350,2352],{"className":686,"code":2351,"language":688,"meta":363,"style":363},"\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",[196,2353,2354,2362,2382,2401,2420,2439,2458,2477,2496,2502,2522,2540,2569,2596,2623,2627,2654,2681],{"__ignoreMap":363},[692,2355,2356,2358,2360],{"class":694,"line":695},[692,2357,699],{"class":698},[692,2359,1147],{"class":702},[692,2361,722],{"class":698},[692,2363,2364,2366,2368,2370,2372,2375,2378,2380],{"class":694,"line":364},[692,2365,871],{"class":698},[692,2367,692],{"class":702},[692,2369,859],{"class":706},[692,2371,710],{"class":698},[692,2373,2374],{"class":713},"\"cell day-header\"",[692,2376,2377],{"class":698},">Sun\u003C/",[692,2379,692],{"class":702},[692,2381,722],{"class":698},[692,2383,2384,2386,2388,2390,2392,2394,2397,2399],{"class":694,"line":738},[692,2385,871],{"class":698},[692,2387,692],{"class":702},[692,2389,859],{"class":706},[692,2391,710],{"class":698},[692,2393,2374],{"class":713},[692,2395,2396],{"class":698},">Mon\u003C/",[692,2398,692],{"class":702},[692,2400,722],{"class":698},[692,2402,2403,2405,2407,2409,2411,2413,2416,2418],{"class":694,"line":815},[692,2404,871],{"class":698},[692,2406,692],{"class":702},[692,2408,859],{"class":706},[692,2410,710],{"class":698},[692,2412,2374],{"class":713},[692,2414,2415],{"class":698},">Tue\u003C/",[692,2417,692],{"class":702},[692,2419,722],{"class":698},[692,2421,2422,2424,2426,2428,2430,2432,2435,2437],{"class":694,"line":829},[692,2423,871],{"class":698},[692,2425,692],{"class":702},[692,2427,859],{"class":706},[692,2429,710],{"class":698},[692,2431,2374],{"class":713},[692,2433,2434],{"class":698},">Wed\u003C/",[692,2436,692],{"class":702},[692,2438,722],{"class":698},[692,2440,2441,2443,2445,2447,2449,2451,2454,2456],{"class":694,"line":916},[692,2442,871],{"class":698},[692,2444,692],{"class":702},[692,2446,859],{"class":706},[692,2448,710],{"class":698},[692,2450,2374],{"class":713},[692,2452,2453],{"class":698},">Thu\u003C/",[692,2455,692],{"class":702},[692,2457,722],{"class":698},[692,2459,2460,2462,2464,2466,2468,2470,2473,2475],{"class":694,"line":931},[692,2461,871],{"class":698},[692,2463,692],{"class":702},[692,2465,859],{"class":706},[692,2467,710],{"class":698},[692,2469,2374],{"class":713},[692,2471,2472],{"class":698},">Fri\u003C/",[692,2474,692],{"class":702},[692,2476,722],{"class":698},[692,2478,2479,2481,2483,2485,2487,2489,2492,2494],{"class":694,"line":944},[692,2480,871],{"class":698},[692,2482,692],{"class":702},[692,2484,859],{"class":706},[692,2486,710],{"class":698},[692,2488,2374],{"class":713},[692,2490,2491],{"class":698},">Sat\u003C/",[692,2493,692],{"class":702},[692,2495,722],{"class":698},[692,2497,2498],{"class":694,"line":957},[692,2499,2501],{"class":2500},"sJ8bj","  \u003C!-- [...] -->\n",[692,2503,2504,2506,2508,2510,2512,2515,2518,2520],{"class":694,"line":1245},[692,2505,871],{"class":698},[692,2507,692],{"class":702},[692,2509,859],{"class":706},[692,2511,710],{"class":698},[692,2513,2514],{"class":713},"\"cell day blank\"",[692,2516,2517],{"class":698},">\u003C/",[692,2519,692],{"class":702},[692,2521,722],{"class":698},[692,2523,2524,2526,2528,2530,2532,2534,2536,2538],{"class":694,"line":1255},[692,2525,871],{"class":698},[692,2527,692],{"class":702},[692,2529,859],{"class":706},[692,2531,710],{"class":698},[692,2533,2514],{"class":713},[692,2535,2517],{"class":698},[692,2537,692],{"class":702},[692,2539,722],{"class":698},[692,2541,2542,2544,2546,2548,2550,2553,2556,2558,2561,2563,2565,2567],{"class":694,"line":1276},[692,2543,871],{"class":698},[692,2545,692],{"class":702},[692,2547,859],{"class":706},[692,2549,710],{"class":698},[692,2551,2552],{"class":713},"\"cell day\"",[692,2554,2555],{"class":698},">\u003C",[692,2557,692],{"class":702},[692,2559,2560],{"class":698},">1\u003C/",[692,2562,692],{"class":702},[692,2564,2517],{"class":698},[692,2566,692],{"class":702},[692,2568,722],{"class":698},[692,2570,2571,2573,2575,2577,2579,2581,2583,2585,2588,2590,2592,2594],{"class":694,"line":1286},[692,2572,871],{"class":698},[692,2574,692],{"class":702},[692,2576,859],{"class":706},[692,2578,710],{"class":698},[692,2580,2552],{"class":713},[692,2582,2555],{"class":698},[692,2584,692],{"class":702},[692,2586,2587],{"class":698},">2\u003C/",[692,2589,692],{"class":702},[692,2591,2517],{"class":698},[692,2593,692],{"class":702},[692,2595,722],{"class":698},[692,2597,2598,2600,2602,2604,2606,2608,2610,2612,2615,2617,2619,2621],{"class":694,"line":1301},[692,2599,871],{"class":698},[692,2601,692],{"class":702},[692,2603,859],{"class":706},[692,2605,710],{"class":698},[692,2607,2552],{"class":713},[692,2609,2555],{"class":698},[692,2611,692],{"class":702},[692,2613,2614],{"class":698},">3\u003C/",[692,2616,692],{"class":702},[692,2618,2517],{"class":698},[692,2620,692],{"class":702},[692,2622,722],{"class":698},[692,2624,2625],{"class":694,"line":1315},[692,2626,2501],{"class":2500},[692,2628,2629,2631,2633,2635,2637,2639,2641,2643,2646,2648,2650,2652],{"class":694,"line":1324},[692,2630,871],{"class":698},[692,2632,692],{"class":702},[692,2634,859],{"class":706},[692,2636,710],{"class":698},[692,2638,2552],{"class":713},[692,2640,2555],{"class":698},[692,2642,692],{"class":702},[692,2644,2645],{"class":698},">29\u003C/",[692,2647,692],{"class":702},[692,2649,2517],{"class":698},[692,2651,692],{"class":702},[692,2653,722],{"class":698},[692,2655,2656,2658,2660,2662,2664,2666,2668,2670,2673,2675,2677,2679],{"class":694,"line":1330},[692,2657,871],{"class":698},[692,2659,692],{"class":702},[692,2661,859],{"class":706},[692,2663,710],{"class":698},[692,2665,2552],{"class":713},[692,2667,2555],{"class":698},[692,2669,692],{"class":702},[692,2671,2672],{"class":698},">30\u003C/",[692,2674,692],{"class":702},[692,2676,2517],{"class":698},[692,2678,692],{"class":702},[692,2680,722],{"class":698},[692,2682,2683,2685,2687],{"class":694,"line":1336},[692,2684,909],{"class":698},[692,2686,1147],{"class":702},[692,2688,722],{"class":698},[11,2690,2691,2692,2694,2695,2698,2699,2701,2702,2705,2706,2708],{},"The days wrapped in ",[196,2693,692],{}," (e.g., ",[196,2696,2697],{},"16",") are clickable, but the HTML communicates no such actionability. The idiomatic DOM equivalent would instead use ",[196,2700,703],{}," elements throughout, or at least assign suitable ",[196,2703,2704],{},"role"," attributes like ",[196,2707,703],{},". A DOM snapshot pipeline leaves space for solving this problem: rewrite the virtual DOM with idiomatic elements.",[684,2710,2712],{"className":686,"code":2711,"language":688,"meta":363,"style":363},"  \u003Cbutton class=\"cell day\">29\u003C/button>\n  \u003C!-- OR -->\n  \u003Cspan role=\"button\" class=\"cell day\">30\u003C/button>\n",[196,2713,2714,2732,2737],{"__ignoreMap":363},[692,2715,2716,2718,2720,2722,2724,2726,2728,2730],{"class":694,"line":695},[692,2717,871],{"class":698},[692,2719,703],{"class":702},[692,2721,859],{"class":706},[692,2723,710],{"class":698},[692,2725,2552],{"class":713},[692,2727,2645],{"class":698},[692,2729,703],{"class":702},[692,2731,722],{"class":698},[692,2733,2734],{"class":694,"line":364},[692,2735,2736],{"class":2500},"  \u003C!-- OR -->\n",[692,2738,2739,2741,2743,2746,2748,2750,2752,2754,2756,2758,2760],{"class":694,"line":738},[692,2740,871],{"class":698},[692,2742,692],{"class":702},[692,2744,2745],{"class":706}," role",[692,2747,710],{"class":698},[692,2749,1266],{"class":713},[692,2751,859],{"class":706},[692,2753,710],{"class":698},[692,2755,2552],{"class":713},[692,2757,2672],{"class":698},[692,2759,703],{"class":702},[692,2761,722],{"class":698},[61,2763,2765],{"id":2764},"choosing-between-snapshot-representations","Choosing Between Snapshot Representations",[11,2767,2768],{},"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:",[1606,2770,2771,2783,2789,2795],{},[81,2772,2773,2776,2777,2779,2780,2782],{},[33,2774,2775],{},"Route Modality."," Fall back to GUI snapshots if the UI is based on ",[196,2778,609],{}," or cross-origin ",[196,2781,605],{}," elements; use DOM snapshots by default.",[81,2784,2785,2788],{},[33,2786,2787],{},"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.",[81,2790,2791,2794],{},[33,2792,2793],{},"Scope Escalation."," If elicited action suggestions are unusable, widen the snapshot scope and representation richness.",[81,2796,2797,2800],{},[33,2798,2799],{},"Cascade to Hybrid."," If elicited action suggestions are still unusable, augment the rich DOM snapshot with a GUI snapshot for maximum grounding.",[289,2802,2803,2822],{},[292,2804,2805],{},[295,2806,2807,2810,2813,2816,2819],{},[298,2808],{"align":2809},"left",[298,2811,2812],{},"GUI",[298,2814,2815],{},"grounded",[298,2817,2818],{},"DOM",[298,2820,2821],{},"transformed",[308,2823,2824,2846,2867,2890,2909,2930],{},[295,2825,2826,2829,2834,2838,2841],{},[313,2827,2828],{"align":2809},"LLM Input Tokens",[313,2830,2831],{},[33,2832,2833],{},"Low",[313,2835,2836],{},[33,2837,2833],{},[313,2839,2840],{},"High",[313,2842,2843,2845],{},[33,2844,2833],{}," to Moderate",[295,2847,2848,2851,2854,2859,2863],{},[313,2849,2850],{"align":2809},"Element Targeting",[313,2852,2853],{},"Absolute",[313,2855,2856],{},[33,2857,2858],{},"Relative",[313,2860,2861],{},[33,2862,2858],{},[313,2864,2865],{},[33,2866,2858],{},[295,2868,2869,2872,2878,2882,2886],{},[313,2870,2871],{"align":2809},"Snapshot Scope",[313,2873,2874,2877],{},[33,2875,2876],{},"Free","/Viewport",[313,2879,2880,2877],{},[33,2881,2876],{},[313,2883,2884],{},[33,2885,2876],{},[313,2887,2888],{},[33,2889,2876],{},[295,2891,2892,2895,2898,2900,2905],{},[313,2893,2894],{"align":2809},"Snapshot Context",[313,2896,2897],{},"UI",[313,2899,2897],{},[313,2901,2902],{},[33,2903,2904],{},"Full",[313,2906,2907],{},[33,2908,2904],{},[295,2910,2911,2916,2921,2925,2928],{},[313,2912,2913,2915],{"align":2809},[196,2914,605],{}," Context",[313,2917,2918],{},[33,2919,2920],{},"Viewport",[313,2922,2923],{},[33,2924,2920],{},[313,2926,2927],{},"Same-origin only",[313,2929,2927],{},[295,2931,2932,2936,2941,2945,2948],{},[313,2933,2934,2915],{"align":2809},[196,2935,609],{},[313,2937,2938],{},[33,2939,2940],{},"Yes",[313,2942,2943],{},[33,2944,2940],{},[313,2946,2947],{},"No",[313,2949,2947],{},[61,2951,2953],{"id":2952},"using-snapshots-in-the-model-context","Using Snapshots in the Model Context",[11,2955,2956],{},"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,2958,2959],{},"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.",[61,2961,2963],{"id":2962},"timing-snapshots-in-the-web-client","Timing Snapshots in the Web Client",[11,2965,2966,2967,427],{},"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",[552,2968,2969],{},[432,2970,2974],{"href":2971,"ariaDescribedBy":2972,"dataFootnoteRef":363,"id":2973},"#user-content-fn-5",[558],"user-content-fnref-5","5",[2976,2977],"hr",{},[11,2979,2980,2981,427],{},"The snapshot is the central artefact in a web agent harness. Its representation is among the most significant factors for agent success",[552,2982,2983],{},[432,2984,2988],{"href":2985,"ariaDescribedBy":2986,"dataFootnoteRef":363,"id":2987},"#user-content-fn-6",[558],"user-content-fnref-6","6",[11,2990,2991,2992,2994],{},"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 ",[196,2993,605],{}," boundaries, etc.",[856,2996,2999,3004],{"className":2997,"dataFootnotes":363},[2998],"footnotes",[61,3000,3003],{"className":3001,"id":558},[3002],"sr-only","Footnotes",[1606,3005,3006,3021,3034,3046,3072,3084],{},[81,3007,3009,3013,3014],{"id":3008},"user-content-fn-1",[432,3010,3011],{"href":3011,"rel":3012},"https://arxiv.org/abs/2310.11441",[436]," ",[432,3015,3020],{"href":3016,"ariaLabel":3017,"className":3018,"dataFootnoteBackref":363},"#user-content-fnref-1","Back to reference 1",[3019],"data-footnote-backref","↩",[81,3022,3024,3025,3013,3029],{"id":3023},"user-content-fn-2","Our reimplementation of Browser Use's grounded GUI snapshots: ",[432,3026,3027],{"href":3027,"rel":3028},"https://github.com/webfuse-com/D2Snap/blob/main/snapshots/_bu.js",[436],[432,3030,3020],{"href":3031,"ariaLabel":3032,"className":3033,"dataFootnoteBackref":363},"#user-content-fnref-2","Back to reference 2",[3019],[81,3035,3037,3013,3041],{"id":3036},"user-content-fn-3",[432,3038,3039],{"href":3039,"rel":3040},"https://arxiv.org/abs/2210.03945",[436],[432,3042,3020],{"href":3043,"ariaLabel":3044,"className":3045,"dataFootnoteBackref":363},"#user-content-fnref-3","Back to reference 3",[3019],[81,3047,3049,3013,3053,3013,3058,3013,3065],{"id":3048},"user-content-fn-4",[432,3050,3051],{"href":3051,"rel":3052},"https://arxiv.org/abs/2508.04412",[436],[432,3054,3020],{"href":3055,"ariaLabel":3056,"className":3057,"dataFootnoteBackref":363},"#user-content-fnref-4","Back to reference 4",[3019],[432,3059,3020,3063],{"href":3060,"ariaLabel":3061,"className":3062,"dataFootnoteBackref":363},"#user-content-fnref-4-2","Back to reference 4-2",[3019],[552,3064,583],{},[432,3066,3020,3070],{"href":3067,"ariaLabel":3068,"className":3069,"dataFootnoteBackref":363},"#user-content-fnref-4-3","Back to reference 4-3",[3019],[552,3071,598],{},[81,3073,3075,3013,3079],{"id":3074},"user-content-fn-5",[432,3076,3077],{"href":3077,"rel":3078},"https://github.com/webfuse-com/DOMQuake",[436],[432,3080,3020],{"href":3081,"ariaLabel":3082,"className":3083,"dataFootnoteBackref":363},"#user-content-fnref-5","Back to reference 5",[3019],[81,3085,3087,3013,3091],{"id":3086},"user-content-fn-6",[432,3088,3089],{"href":3089,"rel":3090},"https://arxiv.org/abs/2504.01382",[436],[432,3092,3020],{"href":3093,"ariaLabel":3094,"className":3095,"dataFootnoteBackref":363},"#user-content-fnref-6","Back to reference 6",[3019],[3097,3098,3099],"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":363,"searchDepth":364,"depth":364,"links":3101},[3102,3106,3112,3113,3114,3115,3116],{"id":461,"depth":364,"text":462,"children":3103},[3104,3105],{"id":485,"depth":738,"text":486},{"id":524,"depth":738,"text":525},{"id":586,"depth":364,"text":587,"children":3107},[3108,3109,3110,3111],{"id":616,"depth":738,"text":617},{"id":641,"depth":738,"text":642},{"id":1570,"depth":738,"text":1571},{"id":1594,"depth":738,"text":1595},{"id":2320,"depth":364,"text":2321},{"id":2764,"depth":364,"text":2765},{"id":2952,"depth":364,"text":2953},{"id":2962,"depth":364,"text":2963},{"id":558,"depth":364,"text":3003},"2025-08-28","Understand how web-based user interfaces can be serialised for use with LLM-based web agents.",{"homepage":403,"relatedLinks":3120},[3121,3124],{"text":3122,"href":3123},"DOM Downsampling for LLM-Based Web Agents","/rnd/dom-downsampling-for-llm-based-web-agents",{"text":3125,"href":3126,"external":403},"Webfuse Automation API","https://dev.webfuse.com/automation-api/","/blog/serialising-web-ui-state-for-llms-the-complete-guide",{"title":417,"description":3118},{"loc":3127},"blog/1013.serialising-web-ui-state-for-llms-the-complete-guide",[372,411,3132,3133,3134],"web-automation","llms","snapshots","X7R93b2XjyDfLllTDaNgFoo_c8AvF9oBDGzv4yiISFA",{"id":3137,"title":3138,"authorId":418,"body":3139,"category":372,"created":3615,"description":3616,"extension":375,"faqs":390,"featurePriority":390,"head":390,"hideCta":403,"landingPath":390,"meta":3617,"navigation":403,"ogImage":390,"path":3623,"robots":390,"schemaOrg":390,"seo":3624,"sitemap":3625,"stem":3626,"tags":3627,"__hash__":3629},"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":3140,"toc":3596},[3141,3159,3163,3171,3176,3179,3183,3186,3206,3210,3219,3223,3239,3244,3247,3251,3262,3266,3269,3273,3280,3284,3307,3311,3315,3318,3321,3325,3346,3349,3353,3357,3366,3377,3382,3386,3395,3398,3402,3405,3408,3412,3425,3428,3432,3441,3444,3448,3452,3455,3459,3463,3466,3540,3542,3545,3559],[11,3142,3143,3148,3149,3148,3153,3158],{},[432,3144,3147],{"href":3145,"rel":3146},"https://openai.com/index/introducing-operator/",[436],"Operator",", ",[432,3150,574],{"href":3151,"rel":3152},"https://browser-use.com/",[436],[432,3154,3157],{"href":3155,"rel":3156},"https://www.skyvern.com/",[436],"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.",[61,3160,3162],{"id":3161},"what-is-an-agent","What is an Agent?",[11,3164,3165,3166,427],{},"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",[552,3167,3168],{},[432,3169,560],{"href":556,"ariaDescribedBy":3170,"dataFootnoteRef":363,"id":559},[558],[15,3172],{"alt":3173,"loading":20,"src":3174,"provider":22,":width":3175},"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,3177,3178],{},"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.",[483,3180,3182],{"id":3181},"what-makes-an-agent-intelligent","What Makes an Agent Intelligent?",[11,3184,3185],{},"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:",[78,3187,3188,3194,3200],{},[81,3189,3190,3193],{},[33,3191,3192],{},"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.",[81,3195,3196,3199],{},[33,3197,3198],{},"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.",[81,3201,3202,3205],{},[33,3203,3204],{},"Neural networks"," – the agent has no model, only examples: a network is fitted to task–solution instances and generalises to unseen, yet related tasks.",[483,3207,3209],{"id":3208},"a-quick-note-on-multi-agent-systems","A Quick Note on Multi-Agent Systems",[11,3211,3212,3213,3218],{},"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 ",[432,3214,3217],{"href":3215,"rel":3216},"https://cs.stanford.edu/people/eroberts/courses/soco/projects/2003-04/intelligent-search/minimax.html",[436],"Minimax algorithm","), as opposed to random world changes. That said, web browsing – modelled after humans – is not a typical multi-agent scenario.",[483,3220,3222],{"id":3221},"the-agent-loop","The Agent Loop",[11,3224,3225,3230,3231,3238],{},[432,3226,3229],{"href":3227,"rel":3228},"https://www.nngroup.com/people/don-norman/",[436],"Don Norman","'s ",[432,3232,3235],{"href":3233,"rel":3234},"https://jnd.org/books/the-design-of-everyday-things-revised-and-expanded-edition/",[436],[445,3236,3237],{},"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.",[15,3240],{"alt":3241,"loading":20,"src":3242,"provider":22,":width":3243},"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,3245,3246],{},"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).",[483,3248,3250],{"id":3249},"errors-and-recovery","Errors and Recovery",[11,3252,3253,3254,3257,3258,3261],{},"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 ",[445,3255,3256],{},"Gulf of Action (Execution)"," – how to act in the world? – and when perceiving world state; the ",[445,3259,3260],{},"Gulf of Perception (Evaluation)"," – how to understand the world?",[15,3263],{"alt":3264,"loading":20,"src":3265,"provider":22,":width":3243},"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,3267,3268],{},"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.",[61,3270,3272],{"id":3271},"web-browsing-agents","Web Browsing Agents",[11,3274,3275,3276,3279],{},"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 ",[196,3277,3278],{},"(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.",[483,3281,3283],{"id":3282},"web-browsing-is-all-about-the-journey","Web Browsing is All About the Journey",[11,3285,3286,3287,3290,3291,3296,3297,3302,3303,3306],{},"A web browsing task is any task that can be solved through a web-based user interface (UI). For instance: ",[445,3288,3289],{},"\"Book the cheapest flight from Amsterdam to New York tomorrow night\""," on ",[432,3292,3295],{"href":3293,"rel":3294},"https://www.klm.com",[436],"klm.com",". Application programming interfaces (APIs; e.g., ",[432,3298,3301],{"href":3299,"rel":3300},"https://www.ibm.com/think/topics/rest-apis",[436],"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 ",[196,3304,3305],{},"Ctrl + F",", whilst journey-driven agents are supposed to browse a web application in human fashion, via the application-native UI.",[15,3308],{"alt":3309,"loading":20,"src":3310},"A depiction of a web journey over three web application UI states","/blog/a-gentle-introduction-to-ai-agents-for-the-web/4.png",[483,3312,3314],{"id":3313},"a-formal-model-for-web-browsing","A Formal Model for Web Browsing",[11,3316,3317],{},"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,3319,3320],{},"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).",[15,3322],{"alt":3323,"loading":20,"src":3324},"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,3326,3327,3328,3333,3334,3339,3340,3345],{},"Yet, many web applications lack ",[432,3329,3332],{"href":3330,"rel":3331},"https://www.nngroup.com/articles/ten-usability-heuristics/#toc-1-visibility-of-system-status-1",[436],"visibility of system status"," – against ",[432,3335,3338],{"href":3336,"rel":3337},"https://www.nngroup.com/people/jakob-nielsen/",[436],"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)",[552,3341,3342],{},[432,3343,583],{"href":580,"ariaDescribedBy":3344,"dataFootnoteRef":363,"id":582},[558]," with, adapting to discovered UI states, where states can be tuples of UI state trajectories to contain history.",[11,3347,3348],{},"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.",[15,3350],{"alt":3351,"loading":20,"src":3352},"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",[483,3354,3356],{"id":3355},"llm-sensors-actuators-agent","LLM + Sensors + Actuators = Agent",[11,3358,3359,3360,3365],{},"Conversationally satisfying simple information requests does not reasonably qualify an LLM as an agent – no more than it would a TF-IDF search system",[552,3361,3362],{},[432,3363,598],{"href":595,"ariaDescribedBy":3364,"dataFootnoteRef":363,"id":597},[558],", 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,3367,3368,3369,3148,3371,3148,3373,3376],{},"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: ",[445,3370,447],{},[445,3372,450],{},[445,3374,3375],{},"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.",[15,3378],{"alt":3379,"loading":20,"src":3380,"provider":22,":width":3381},"Figurative depiction of components in the agent loop","/blog/a-gentle-introduction-to-ai-agents-for-the-web/7.svg","460",[483,3383,3385],{"id":3384},"snapshots-serialised-ui-state","Snapshots – Serialised UI State",[11,3387,3388,3389,3394],{},"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",[552,3390,3391],{},[432,3392,1092],{"href":1089,"ariaDescribedBy":3393,"dataFootnoteRef":363,"id":1091},[558],". 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,3396,3397],{},"Outcome-driven web agents have used UI-invasive snapshot measures, such as grounding LLMs with bounding boxes around actionable elements.",[15,3399],{"alt":3400,"loading":20,"src":3401},"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,3403,3404],{},"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,3406,3407],{},"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?",[483,3409,3411],{"id":3410},"targeting-action-suggestions","Targeting – Action Suggestions",[11,3413,3414,3415,3148,3417,3420,3421,3424],{},"An action is a user event, such as ",[445,3416,503],{},[445,3418,3419],{},"type",", or ",[445,3422,3423],{},"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,3426,3427],{},"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.",[483,3429,3431],{"id":3430},"the-agent-harness","The Agent Harness",[11,3433,3434,3435,3440],{},"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. ",[432,3436,3439],{"href":3437,"rel":3438},"https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents",[436],"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,3442,3443],{},"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.",[15,3445],{"alt":3446,"loading":20,"src":3447,"provider":22},"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",[483,3449,3451],{"id":3450},"the-model-context-protocol","The Model Context Protocol",[11,3453,3454],{},"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.",[15,3456],{"alt":3457,"loading":20,"src":3458,"provider":22,":width":3243},"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",[483,3460,3462],{"id":3461},"web-browser-environments","Web Browser Environments",[11,3464,3465],{},"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:",[78,3467,3468,3483,3496,3508],{},[81,3469,3470,3473,3474,3477,3478],{},[33,3471,3472],{},"Agentic browser"," – the agent's UI embeds a browser.",[3475,3476],"br",{},"\nExample: ",[432,3479,3482],{"href":3480,"rel":3481},"https://www.perplexity.ai/comet",[436],"Perplexity Comet",[81,3484,3485,3488,3489,3477,3491],{},[33,3486,3487],{},"Cloud browser"," – the agent spins up a browser in the cloud.",[3475,3490],{},[432,3492,3495],{"href":3493,"rel":3494},"https://www.browserbase.com",[436],"Browserbase",[81,3497,3498,3501,3502,3477,3504],{},[33,3499,3500],{},"Local browser (3rd-party browser)"," – the agent spins up an isolated browser locally.",[3475,3503],{},[432,3505,3507],{"href":434,"rel":3506},[436],"Chromium + Playwright",[81,3509,3510,3513,3514],{},[33,3511,3512],{},"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",[78,3515,3516,3529],{},[81,3517,3518,3521,3522,3477,3524],{},[33,3519,3520],{},"Implemented (1st-party app)"," – served directly through the website.",[3475,3523],{},[432,3525,3528],{"href":3526,"rel":3527},"https://www.cognigy.com/platform/ai-agent-studio",[436],"Cognigy Studio",[81,3530,3531,3534,3535,3477,3537],{},[33,3532,3533],{},"Augmented (3rd-party app)"," – served indirectly through a website proxy.",[3475,3536],{},[432,3538,40],{"href":441,"rel":3539},[436],[2976,3541],{},[11,3543,3544],{},"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,3546,3547,3548,3553,3554,427],{},"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 ",[432,3549,3552],{"href":3550,"rel":3551},"https://claude.com/",[436],"Claude",", or shipping ",[432,3555,3558],{"href":3556,"rel":3557},"https://github.com/webfuse-com/extension-elevenlabs-mcp",[436],"perceive-and-act-ready chatbots",[856,3560,3562,3565],{"className":3561,"dataFootnotes":363},[2998],[61,3563,3003],{"className":3564,"id":558},[3002],[1606,3566,3567,3576,3582,3588],{},[81,3568,3569,3013,3573],{"id":3008},[432,3570,3571],{"href":3571,"rel":3572},"https://inst.eecs.berkeley.edu/~cs188/textbook/textbook_full.pdf",[436],[432,3574,3020],{"href":3016,"ariaLabel":3017,"className":3575,"dataFootnoteBackref":363},[3019],[81,3577,3578,3579],{"id":3023},"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. ",[432,3580,3020],{"href":3031,"ariaLabel":3032,"className":3581,"dataFootnoteBackref":363},[3019],[81,3583,3584,3585],{"id":3036},"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. ",[432,3586,3020],{"href":3043,"ariaLabel":3044,"className":3587,"dataFootnoteBackref":363},[3019],[81,3589,3590,3013,3593],{"id":3048},[432,3591,3039],{"href":3039,"rel":3592},[436],[432,3594,3020],{"href":3055,"ariaLabel":3056,"className":3595,"dataFootnoteBackref":363},[3019],{"title":363,"searchDepth":364,"depth":364,"links":3597},[3598,3604,3614],{"id":3161,"depth":364,"text":3162,"children":3599},[3600,3601,3602,3603],{"id":3181,"depth":738,"text":3182},{"id":3208,"depth":738,"text":3209},{"id":3221,"depth":738,"text":3222},{"id":3249,"depth":738,"text":3250},{"id":3271,"depth":364,"text":3272,"children":3605},[3606,3607,3608,3609,3610,3611,3612,3613],{"id":3282,"depth":738,"text":3283},{"id":3313,"depth":738,"text":3314},{"id":3355,"depth":738,"text":3356},{"id":3384,"depth":738,"text":3385},{"id":3410,"depth":738,"text":3411},{"id":3430,"depth":738,"text":3431},{"id":3450,"depth":738,"text":3451},{"id":3461,"depth":738,"text":3462},{"id":558,"depth":364,"text":3003},"2025-06-15","Get an idea of agents and how to build AI agents that browse the web: key concepts, terminology, and challenges.",{"homepage":403,"relatedLinks":3618},[3619,3621,3622],{"text":3620,"href":3127},"Serialising Web UI State for LLMs",{"text":3122,"href":3123},{"text":3125,"href":3126,"external":403},"/blog/a-gentle-introduction-to-ai-agents-for-the-web",{"title":3138,"description":3616},{"loc":3623},"blog/1011.a-gentle-introduction-to-ai-agents-for-the-web",[372,3628,411,3132,3133],"browser-agents","65hAoQNete8P3AgO-H42P0eBhVfIkl5vIfZZAkvL-9o",1788255644855]