[{"data":1,"prerenderedAt":4026},["ShallowReactive",2],{"/blog/fitting-an-architectural-model-to-web-actuation":3,"related-/blog/fitting-an-architectural-model-to-web-actuation":840},{"id":4,"title":5,"authorId":6,"body":7,"category":819,"created":820,"description":821,"extension":822,"faqs":823,"featurePriority":823,"head":823,"hideCta":824,"landingPath":823,"meta":825,"navigation":824,"ogImage":823,"path":830,"robots":823,"schemaOrg":823,"seo":831,"sitemap":832,"stem":833,"tags":834,"__hash__":839},"blog/blog/1013.fitting-an-architectural-model-to-web-actuation.md","Fitting an Architectural Model to Web Actuation","thassilo-schiepanski",{"type":8,"value":9,"toc":804},"minimark",[10,14,19,35,127,146,153,158,174,178,200,204,208,211,353,364,368,387,391,409,413,416,423,451,461,492,504,531,538,575,579,583,586,590,618,622,651,655,670,692,696,703,716,719,736,739,754,758,770,774,777,781,784,791,794,797,800],[11,12,13],"p",{},"Actuation, a term borrowed from robotics, describes an artificial entity’s active manipulation of a problem-specific world. For example: robotic sorting of objects in a warehouse, where the robot is the entity and the warehouse and its items constitute the world. In the context of web agents, where an AI agent is the entity and the web application is the world, actuation comprises synthetic input to the application’s user interface (UI). When web agents are deployed directly on human-facing UIs, synthetic input – programmatically dispatched in the client – emulates human user input.",[15,16,18],"h2",{"id":17},"events-atomic-signals","Events – Atomic Signals",[11,20,21,22,26,27,30,31,34],{},"Events represent the atomic signal of an application state change, such as an aspect of a user action. In the DOM API, an event is an ",[23,24,25],"code",{},"Event"," instance dispatched on a specific ",[23,28,29],{},"EventTarget"," instance, such as an ",[23,32,33],{},"HTMLElement",". Events can invoke any number of application-defined event listeners and browser-native behaviour.",[36,37,42],"pre",{"className":38,"code":39,"language":40,"meta":41,"style":41},"language-ts shiki shiki-themes github-dark github-dark","document.querySelector(\"button#submit-button\")\n  ?.addEventListener(\"click\", (event: MouseEvent) => {\n    console.debug(\"Submit button clicked:\", event.target);\n  });\n","ts","",[23,43,44,67,104,121],{"__ignoreMap":41},[45,46,49,53,57,60,64],"span",{"class":47,"line":48},"line",1,[45,50,52],{"class":51},"suv1-","document.",[45,54,56],{"class":55},"sFR8T","querySelector",[45,58,59],{"class":51},"(",[45,61,63],{"class":62},"s4wv1","\"button#submit-button\"",[45,65,66],{"class":51},")\n",[45,68,70,73,76,78,81,84,88,92,95,98,101],{"class":47,"line":69},2,[45,71,72],{"class":51},"  ?.",[45,74,75],{"class":55},"addEventListener",[45,77,59],{"class":51},[45,79,80],{"class":62},"\"click\"",[45,82,83],{"class":51},", (",[45,85,87],{"class":86},"s-3mD","event",[45,89,91],{"class":90},"sOPea",":",[45,93,94],{"class":55}," MouseEvent",[45,96,97],{"class":51},") ",[45,99,100],{"class":90},"=>",[45,102,103],{"class":51}," {\n",[45,105,107,110,113,115,118],{"class":47,"line":106},3,[45,108,109],{"class":51},"    console.",[45,111,112],{"class":55},"debug",[45,114,59],{"class":51},[45,116,117],{"class":62},"\"Submit button clicked:\"",[45,119,120],{"class":51},", event.target);\n",[45,122,124],{"class":47,"line":123},4,[45,125,126],{"class":51},"  });\n",[11,128,129,130,133,134,137,138,141,142,145],{},"Input devices trigger events inheriting from ",[23,131,132],{},"UIEvent",", such as ",[23,135,136],{},"MouseEvent"," or ",[23,139,140],{},"KeyboardEvent",". Each such event is targeted at a specific element in the DOM and at the view (i.e., the ",[23,143,144],{},"Window",") that the element belongs to.",[147,148],"nuxt-picture",{"alt":149,"loading":150,"provider":151,"src":152},"High-level UIEvent class diagram","lazy","none","/blog/fitting-an-architectural-model-to-web-actuation/1.svg",[154,155,157],"h3",{"id":156},"event-class-inconsistencies","Event Class Inconsistencies",[11,159,160,161,163,164,167,168,170,171,173],{},"Strictly speaking, not every event that can be triggered by input devices is classified as ",[23,162,132],{},", despite being practically related to a specific view. For example, ",[23,165,166],{},"ClipboardEvent"," does not inherit from ",[23,169,132],{},". With regard to actuation, the browser-native event classification is not ideal. The sub-classification as a ",[23,172,132],{}," is historical rather than conceptual.",[147,175],{"alt":176,"loading":150,"provider":151,"src":177},"High-level Event class inheritance diagram","/blog/fitting-an-architectural-model-to-web-actuation/2.svg",[11,179,180,181,183,184,186,187,189,190,192,193,196,197,199],{},"To fit an architectural model to the DOM standard, it is best to distinguish between physical and virtual input device effects. Whilst the keyboard is a physical input device and thus ",[23,182,140],{}," is a ",[23,185,132],{}," class, the clipboard is not such an input device and hence ",[23,188,166],{}," is not a ",[23,191,132],{}," class. Input itself is not a device either, but ",[23,194,195],{},"InputEvent"," is, in most cases, indirectly caused by a ",[23,198,140],{}," targeted at an editable element.",[147,201],{"alt":202,"loading":150,"provider":151,"src":203},"Full Event class diagram","/blog/fitting-an-architectural-model-to-web-actuation/3.svg",[154,205,207],{"id":206},"the-istrusted-roadblock","The 'isTrusted' Roadblock",[11,209,210],{},"Specific event options depend on the input action:",[36,212,214],{"className":38,"code":213,"language":40,"meta":41,"style":41},"const options: PointerEventInit = {\n  clientX,\n  clientY,\n  screenX: clientX + window.screenX,\n  screenY: clientY + window.screenY,\n  detail: 1,\n  pointerId: 1,\n  pointerType: \"mouse\",\n  bubbles: true,\n  cancelable: true,\n  composed: true,\n  isPrimary: true,\n  view: window\n};\n",[23,215,216,235,240,245,256,267,279,289,300,311,321,331,341,347],{"__ignoreMap":41},[45,217,218,221,225,227,230,233],{"class":47,"line":48},[45,219,220],{"class":90},"const",[45,222,224],{"class":223},"s8ozJ"," options",[45,226,91],{"class":90},[45,228,229],{"class":55}," PointerEventInit",[45,231,232],{"class":90}," =",[45,234,103],{"class":51},[45,236,237],{"class":47,"line":69},[45,238,239],{"class":51},"  clientX,\n",[45,241,242],{"class":47,"line":106},[45,243,244],{"class":51},"  clientY,\n",[45,246,247,250,253],{"class":47,"line":123},[45,248,249],{"class":51},"  screenX: clientX ",[45,251,252],{"class":90},"+",[45,254,255],{"class":51}," window.screenX,\n",[45,257,259,262,264],{"class":47,"line":258},5,[45,260,261],{"class":51},"  screenY: clientY ",[45,263,252],{"class":90},[45,265,266],{"class":51}," window.screenY,\n",[45,268,270,273,276],{"class":47,"line":269},6,[45,271,272],{"class":51},"  detail: ",[45,274,275],{"class":223},"1",[45,277,278],{"class":51},",\n",[45,280,282,285,287],{"class":47,"line":281},7,[45,283,284],{"class":51},"  pointerId: ",[45,286,275],{"class":223},[45,288,278],{"class":51},[45,290,292,295,298],{"class":47,"line":291},8,[45,293,294],{"class":51},"  pointerType: ",[45,296,297],{"class":62},"\"mouse\"",[45,299,278],{"class":51},[45,301,303,306,309],{"class":47,"line":302},9,[45,304,305],{"class":51},"  bubbles: ",[45,307,308],{"class":223},"true",[45,310,278],{"class":51},[45,312,314,317,319],{"class":47,"line":313},10,[45,315,316],{"class":51},"  cancelable: ",[45,318,308],{"class":223},[45,320,278],{"class":51},[45,322,324,327,329],{"class":47,"line":323},11,[45,325,326],{"class":51},"  composed: ",[45,328,308],{"class":223},[45,330,278],{"class":51},[45,332,334,337,339],{"class":47,"line":333},12,[45,335,336],{"class":51},"  isPrimary: ",[45,338,308],{"class":223},[45,340,278],{"class":51},[45,342,344],{"class":47,"line":343},13,[45,345,346],{"class":51},"  view: window\n",[45,348,350],{"class":47,"line":349},14,[45,351,352],{"class":51},"};\n",[11,354,355,356,359,360,363],{},"These options are reflected by the event instance identically, as read by listeners. However, the ",[23,357,358],{},"isTrusted"," read-only property is set by the browser. It is not overridable. The browser strictly sets it to ",[23,361,362],{},"false"," for synthetic events not coming directly from a physical input device.",[15,365,367],{"id":366},"input-actions-event-sequences","Input Actions – Event Sequences",[11,369,370,371,374,375,379,380,383,384,386],{},"Input actions are user actions, composed of atomic events. For instance, a ",[23,372,373],{},"mousedown"," event is necessary for a ",[376,377,378],"em",{},"click"," action, but only a subsequent ",[23,381,382],{},"mouseup"," event on the same target element renders it complete through a ",[23,385,378],{}," event. Atomic events in an action sequence allow for fine-grained application control.",[147,388],{"alt":389,"loading":150,"provider":151,"src":390},"Abstract mouse click action event sequence","/blog/fitting-an-architectural-model-to-web-actuation/4.svg",[11,392,393,394,397,398,401,402,405,406,408],{},"There is no DOM API for synthetic input on the action level, only for creating and dispatching atomic events: ",[23,395,396],{},"e = new MouseEvent(\"click\")"," and ",[23,399,400],{},"EventTarget.dispatchEvent(e)",". ",[23,403,404],{},"HTMLElement.click()"," is but a shorthand for an atomic ",[23,407,378],{}," event dispatch, not for the fully qualified input action.",[154,410,412],{"id":411},"symmetry-in-event-sequences","Symmetry in Event Sequences",[11,414,415],{},"By design of button-based input devices, which are almost imperative for human motor skills, actions are generally based on symmetric event sequences – symmetry between button activation and deactivation. Symmetry thereby holds over abstract event classes: (A) activation events, (B) apex events, and (C) deactivation events.",[11,417,418,419,422],{},"Here is the event sequence for ",[376,420,421],{},"typing"," a single symbol:",[424,425,426,433,439,445],"ol",{},[427,428,429,432],"li",{},[23,430,431],{},"keydown"," (A, activation)",[427,434,435,438],{},[23,436,437],{},"beforeinput"," (B, apex)",[427,440,441,444],{},[23,442,443],{},"input"," (B)",[427,446,447,450],{},[23,448,449],{},"keyup"," (C, deactivation)",[11,452,453,454,456,457,460],{},"Some actions like ",[376,455,378],{}," have apex events at the end, because the symmetry of events is necessary to qualify the action as such. Here is the event sequence for ",[376,458,459],{},"clicking",", i.e., mouse-down and -up on the same target:",[424,462,463,472,481,488],{},[427,464,465,467,468,471],{},[23,466,373],{}," (A; target ",[23,469,470],{},"T",")",[427,473,474,477,478,480],{},[23,475,476],{},"focus"," (B; if ",[23,479,470],{}," is focusable)",[427,482,483,485,486,471],{},[23,484,382],{}," (C; ",[23,487,470],{},[427,489,490,444],{},[23,491,378],{},[11,493,494,495,497,498,137,501,91],{},"Moving the mouse to a different target in between activation (1) and deactivation (3) events would not render a ",[376,496,378],{}," action on ",[23,499,500],{},"T1",[23,502,503],{},"T2",[424,505,506,512,516,522],{},[427,507,508,467,510,471],{},[23,509,373],{},[23,511,500],{},[427,513,514,444],{},[23,515,476],{},[427,517,518,485,520,471],{},[23,519,382],{},[23,521,503],{},[427,523,524,526,527,397,529,471],{},[23,525,378],{}," (B; nearest common ancestor of ",[23,528,500],{},[23,530,503],{},[11,532,533,534,537],{},"An action itself can also be a composition of actions: a ",[376,535,536],{},"double-click",", for instance, is two consecutive clicks in a short timeframe:",[424,539,540,545,549,554,558,562,566,570],{},[427,541,542,544],{},[23,543,373],{}," (A)",[427,546,547,444],{},[23,548,476],{},[427,550,551,553],{},[23,552,382],{}," (C)",[427,555,556,444],{},[23,557,378],{},[427,559,560,544],{},[23,561,373],{},[427,563,564,553],{},[23,565,382],{},[427,567,568,444],{},[23,569,378],{},[427,571,572,444],{},[23,573,574],{},"dblclick",[147,576],{"alt":577,"loading":150,"provider":151,"src":578},"Entity relationship diagram for input actions and atomic events","/blog/fitting-an-architectural-model-to-web-actuation/5.svg",[154,580,582],{"id":581},"event-and-action-equivalency","Event and Action Equivalency",[11,584,585],{},"Web standards primarily consider two high-level devices: the keyboard and the mouse – with the stylus (or finger) as a substitute for the mouse on touchscreen devices.",[147,587],{"alt":588,"loading":150,"provider":151,"src":589},"Approximate input action event sequences by input devices","/blog/fitting-an-architectural-model-to-web-actuation/6.svg",[11,591,592,593,595,596,599,600,603,604,607,608,610,611,613,614,617],{},"Action anatomy across input devices considerably overlaps: not least for accessibility reasons, a ",[23,594,378],{}," can also be triggered through the keyboard – an ",[23,597,598],{},"Enter","- or ",[23,601,602],{},"Space","-bound ",[376,605,606],{},"key press"," action that commonly mirrors a ",[376,609,378],{},". Whilst the ",[376,612,378],{}," action is generally associated with the mouse device, it is technically a generic ",[376,615,616],{},"fire"," action to trigger natively or programmatically attached effects.",[147,619],{"alt":620,"loading":150,"provider":151,"src":621},"Abstract mouse and keyboard click action event sequences compared","/blog/fitting-an-architectural-model-to-web-actuation/7.svg",[11,623,624,625,397,628,630,631,634,635,637,638,634,641,643,644,647,648,650],{},"Touchscreen devices exchange the mouse for the screen itself. Via stylus (or finger), the ",[23,626,627],{},"TouchEvent",[23,629,136],{}," classes are mostly equivalent: a ",[23,632,633],{},"touchstart"," corresponds to a ",[23,636,373],{},", and a ",[376,639,640],{},"tap",[376,642,378],{},". The ",[23,645,646],{},"PointerEvent"," class, which inherits from ",[23,649,136],{},", unifies both kinds of input, covering their intersecting properties.",[147,652],{"alt":653,"loading":150,"provider":151,"src":654},"Abstract mouse, stylus, and keyboard click action event sequences compared","/blog/fitting-an-architectural-model-to-web-actuation/8.svg",[11,656,657,658,397,660,663,664,666,667,669],{},"Aligned with the two significant input devices, ",[376,659,378],{},[376,661,662],{},"type"," represent the central input actions for navigating a web-based UI: ",[376,665,378],{}," as a universal trigger action, and ",[376,668,662],{}," for providing individual data – symbol by symbol.",[11,671,672,673,397,675,677,678,681,682,685,686,397,688,691],{},"The ",[376,674,378],{},[376,676,662],{}," actions get a web agent far, with certain caveats. The dropdown of a ",[23,679,680],{},"\u003Cselect>"," element, for instance, is by default OS-native. Dropdown interaction is hidden from the DOM. A synthetic ",[376,683,684],{},"select"," is hence just the resulting event sequence: setting the value, followed by ",[23,687,443],{},[23,689,690],{},"change"," events.",[154,693,695],{"id":694},"browser-native-side-effects","Browser-Native Side Effects",[11,697,698,699,702],{},"On specific target elements, generic input actions can trigger specific events. Clicking a form submit button issues a ",[23,700,701],{},"submit"," event on the form at the end of the input action event sequence.",[11,704,705,706,708,709,711,712,715],{},"Calling ",[23,707,404],{}," does not render a full ",[376,710,378],{}," input action. By contrast, ",[23,713,714],{},"HTMLElement.focus()"," runs a focus shift event sequence across related elements: the previously focused element is blurred, then the focus target is focused. Focus events never fire if the page's window has no focus, e.g., if the browser is running in the background, which is why a synthetic focus-shift routine is often favourable.",[11,717,718],{},"If the targeted element is focusable and another element has focus at the moment:",[424,720,721,729],{},[427,722,723,726,727,471],{},[23,724,725],{},"blur"," (B, target ",[23,728,500],{},[427,730,731,726,734,471],{},[23,732,733],{},"focusout",[23,735,500],{},[11,737,738],{},"Subsequently:",[424,740,741,747],{"start":106},[427,742,743,726,745,471],{},[23,744,476],{},[23,746,503],{},[427,748,749,726,752,471],{},[23,750,751],{},"focusin",[23,753,503],{},[15,755,757],{"id":756},"primary-and-secondary-actions","Primary and Secondary Actions",[11,759,760,763,764,766,767,769],{},[376,761,762],{},"Click",", ",[376,765,662],{},", and ",[376,768,684],{}," are primary input actions – they are functionally required to solve a specified web browsing task. Secondary browser actions exist for ergonomic reasons, but are generally not functionally required. The two prevalent secondary input actions in a browser arose with the graphical UI: scrolling and mouse pointer movement.",[154,771,773],{"id":772},"scrolling-scoping-the-gui-in-the-viewport","Scrolling: Scoping the GUI in the Viewport",[11,775,776],{},"In order to point at a target element with the physical mouse device pointer, a human user must scroll it into the viewport, as the pointer's location is constrained by the browser's viewport. Synthetic actions are independent of the physical mouse. Event properties, such as the mouse position, can be set programmatically. However, scrolling the target element into view is a desirable side effect to cause synthetically, so a human supervisor can trace AI agent actions.",[154,778,780],{"id":779},"mouse-pointer-scoping-targets-in-the-gui","Mouse Pointer: Scoping Targets in the GUI",[11,782,783],{},"The physical mouse pointer cannot be moved programmatically. A virtual mouse pointer is the answer; it moreover visualises the agent as a co-browsing agent that can ideally be cut off by the human.",[11,785,786,787,790],{},"The degree to which to maintain a virtual mouse pointer depends on the agent design objective. A full-fledged virtual mouse pointer emits mouse events over all elements along its movement trajectory. The trajectory can follow any continuous and differentiable function, and the same holds for the timing. A human mouse movement generally consists of a fast initial sweep toward the target, then slower corrective adjustments – Fitts's Law describes a natural mouse movement duration based on spatial target element properties. Synthetic mouse events do not apply CSS pseudo-classes, such as ",[23,788,789],{},":hover",".",[792,793],"hr",{},[11,795,796],{},"No strict model fits the problem of web actuation: event classes are historical rather than conceptual, events sequences are only roughly symmetric, and browser-native side effects vary by target element. Visualising the key concepts – atomic events, abstract sequence symmetry, and primary versus secondary actions – nonetheless helps when designing a web actuation API.",[11,798,799],{},"Webfuse provides automated agents with human-like input capabilities on any web-based UI – including trusted events and a seamless virtual mouse pointer.",[801,802,803],"style",{},"html pre.shiki code .suv1-, html code.shiki .suv1-{--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}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 .s-3mD, html code.shiki .s-3mD{--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .sOPea, html code.shiki .sOPea{--shiki-default:#F97583;--shiki-dark:#F97583}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 .s8ozJ, html code.shiki .s8ozJ{--shiki-default:#79B8FF;--shiki-dark:#79B8FF}",{"title":41,"searchDepth":69,"depth":69,"links":805},[806,810,815],{"id":17,"depth":69,"text":18,"children":807},[808,809],{"id":156,"depth":106,"text":157},{"id":206,"depth":106,"text":207},{"id":366,"depth":69,"text":367,"children":811},[812,813,814],{"id":411,"depth":106,"text":412},{"id":581,"depth":106,"text":582},{"id":694,"depth":106,"text":695},{"id":756,"depth":69,"text":757,"children":816},[817,818],{"id":772,"depth":106,"text":773},{"id":779,"depth":106,"text":780},"ai-agents","2025-09-07","Derive an approximate model of web actuation that is required by web agents facing human-centric user interfaces.","md",null,true,{"homepage":824,"relatedLinks":826},[827],{"text":828,"href":829,"external":824},"Webfuse Automation API","https://dev.webfuse.com/automation-api/","/blog/fitting-an-architectural-model-to-web-actuation",{"title":5,"description":821},{"loc":830},"blog/1013.fitting-an-architectural-model-to-web-actuation",[819,835,836,837,838],"web-agents","web-automation","actuation","synthetic-actions","raUH3EaPQMvk1-fW_xQFBj3k4W3exBRbhBz68CpORXg",[841,3534],{"id":842,"title":843,"authorId":6,"body":844,"category":819,"created":3518,"description":3519,"extension":822,"faqs":823,"featurePriority":823,"head":823,"hideCta":824,"landingPath":823,"meta":3520,"navigation":824,"ogImage":823,"path":3526,"robots":823,"schemaOrg":823,"seo":3527,"sitemap":3528,"stem":3529,"tags":3530,"__hash__":3533},"blog/blog/1012.serialising-web-ui-state-for-llms-the-complete-guide.md","Serialising Web UI State for LLMs: The Complete Guide",{"type":8,"value":845,"toc":3501},[846,853,874,879,882,886,889,892,901,905,909,916,933,937,940,943,947,954,958,963,966,982,986,1004,1008,1020,1034,1038,1051,1055,1058,1062,1080,1083,1087,1097,1102,1169,1172,1175,1180,1249,1254,1369,1374,1483,1487,1498,1503,1800,1805,1959,1968,1972,1983,1988,1992,1996,1999,2002,2005,2113,2117,2120,2124,2127,2130,2135,2359,2364,2615,2620,2696,2701,2708,2717,2721,2724,2727,2730,2735,2743,2747,3087,3107,3160,3164,3167,3199,3354,3358,3361,3364,3368,3379,3381,3392,3398,3498],[11,847,848,849,790],{},"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 ",[850,851,852],"strong",{},"snapshot",[11,854,855,856,137,863,868,869,137,871,873],{},"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 ",[857,858,862],"a",{"href":859,"rel":860},"https://playwright.dev",[861],"nofollow","Playwright",[857,864,867],{"href":865,"rel":866},"https://www.webfuse.com",[861],"Webfuse",", for example, ",[376,870,459],{},[376,872,421],{},". 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.",[147,875],{"alt":876,"loading":150,"src":877,":width":878,"provider":151},"Figurative depiction of two key artefacts along the agent loop: the snapshot towards the LLM and the input action towards the browser","/blog/serialising-web-ui-state-for-llms-the-complete-guide/1.svg","460",[11,880,881],{},"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.",[15,883,885],{"id":884},"gui-snapshots","GUI Snapshots",[11,887,888],{},"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,890,891],{},"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,893,894,895,900],{},"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 – ",[857,896,899],{"href":897,"rel":898},"https://html2canvas.hertzen.com",[861],"HTML2Canvas"," demonstrates the limits.",[147,902],{"alt":903,"loading":150,"src":904},"The same web-based user interface serialised via browser-native screenshot API and the client-side library HTML2Canvas showing significant geometric differences","/blog/serialising-web-ui-state-for-llms-the-complete-guide/2.png",[154,906,908],{"id":907},"vision-based-targeting","Vision-Based Targeting",[11,910,911,912,915],{},"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 ",[376,913,914],{},"\"Button with Text 'Shop'\"",". On its own, semantic targeting introduces a circular problem: which element has this text?",[11,917,918,919,922,923,925,926,929,930,790],{},"Consider the web browsing task: ",[376,920,921],{},"\"Navigate to the Apple online shop\"",". In combination with an action, in this case ",[376,924,378],{},", the agent could target the ",[376,927,928],{},"Shop"," button via a point coordinate, e.g., ",[23,931,932],{},"(725, 750)",[147,934],{"alt":935,"loading":150,"src":936},"A GUI snapshot (screenshot) visualising point coordinate targeting","/blog/serialising-web-ui-state-for-llms-the-complete-guide/3.png",[11,938,939],{},"When the UI shifts between snapshot and action time, geometric targeting suggestions might have become obsolete.",[11,941,942],{},"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.",[154,944,946],{"id":945},"the-problem-with-gui-snapshots","The Problem with GUI Snapshots",[11,948,949,950,953],{},"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 ",[376,951,952],{},"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.",[147,955],{"alt":956,"loading":150,"src":957},"A GUI snapshot (screenshot) compared to its figuratively downsampled counterpart","/blog/serialising-web-ui-state-for-llms-the-complete-guide/4.png",[959,960,962],"h4",{"id":961},"grounded-gui-snapshots","Grounded GUI Snapshots",[11,964,965],{},"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,967,968,971,972,981],{},[376,969,970],{},"Set-of-Mark"," prompting is the go-to technique to create grounded GUI snapshots",[973,974,975],"sup",{},[857,976,275],{"href":977,"ariaDescribedBy":978,"dataFootnoteRef":41,"id":980},"#user-content-fn-1",[979],"footnote-label","user-content-fnref-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.",[147,983],{"alt":984,"loading":150,"src":985},"A GUI snapshot (screenshot) visualising grounded cue targeting","/blog/serialising-web-ui-state-for-llms-the-complete-guide/5.png",[11,987,988,995,996,790],{},[857,989,992],{"href":990,"rel":991},"https://browser-use.com",[861],[376,993,994],{},"Browser Use"," agents implement Set-of-Mark-grounded GUI snapshots",[973,997,998],{},[857,999,1003],{"href":1000,"ariaDescribedBy":1001,"dataFootnoteRef":41,"id":1002},"#user-content-fn-2",[979],"user-content-fnref-2","2",[15,1005,1007],{"id":1006},"dom-snapshots","DOM Snapshots",[11,1009,1010,1011,1019],{},"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",[973,1012,1013],{},[857,1014,1018],{"href":1015,"ariaDescribedBy":1016,"dataFootnoteRef":41,"id":1017},"#user-content-fn-3",[979],"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,1021,1022,1023,1026,1027,1030,1031,1033],{},"Cross-origin ",[23,1024,1025],{},"iframe"," elements and ",[23,1028,1029],{},"canvas"," elements are exceptions to the DOM-is-source-of-truth assumption: ",[23,1032,1029],{},"-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.",[154,1035,1037],{"id":1036},"dom-based-targeting","DOM-Based Targeting",[11,1039,1040,1041,397,1044,1047,1048,790],{},"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 ",[23,1042,1043],{},"class",[23,1045,1046],{},"id"," attributes – every element has at least one unique CSS selector, constructed from nth-child node paths, e.g., ",[23,1049,1050],{},"main .section:nth-child(2) > .row:nth-of-type(5) > form button",[147,1052],{"alt":1053,"loading":150,"src":1054},"A DOM snapshot (HTML) visualising CSS selector targeting","/blog/serialising-web-ui-state-for-llms-the-complete-guide/6.png",[11,1056,1057],{},"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.",[154,1059,1061],{"id":1060},"the-problem-with-dom-snapshots","The Problem with DOM Snapshots",[11,1063,1064,1065,1070,1071,1079],{},"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 ",[857,1066,1069],{"href":1067,"rel":1068},"https://edition.cnn.com",[861],"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 ",[857,1072,1075,1078],{"href":1073,"rel":1074},"https://openai.com/index/gpt-4o-system-card/",[861],[376,1076,1077],{},"GPT-4o"," (OpenAI)","). Ultimately, raw DOM snapshots out-cost GUI snapshots.",[11,1081,1082],{},"Using DOM snapshots with LLM-based web agents requires size-reducing transformations, similar to image downsampling implemented behind LLM APIs.",[959,1084,1086],{"id":1085},"extracted-dom-snapshots","Extracted DOM Snapshots",[11,1088,1089,1090,1093,1094,1096],{},"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-",[376,1091,1092],{},"k"," extractions – the ",[376,1095,1092],{}," highest-scoring elements – a snapshot of the virtual DOM comes at a fraction of the original DOM's size.",[11,1098,1099],{},[850,1100,1101],{},"Top-3 DOM Snapshot:",[36,1103,1107],{"className":1104,"code":1105,"language":1106,"meta":41,"style":41},"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",[23,1108,1109,1135,1148],{"__ignoreMap":41},[45,1110,1111,1114,1118,1121,1124,1127,1130,1132],{"class":47,"line":48},[45,1112,1113],{"class":51},"\u003C",[45,1115,1117],{"class":1116},"sxg3X","button",[45,1119,1120],{"class":55}," type",[45,1122,1123],{"class":51},"=",[45,1125,1126],{"class":62},"\"submit\"",[45,1128,1129],{"class":51},">Submit\u003C/",[45,1131,1117],{"class":1116},[45,1133,1134],{"class":51},">\n",[45,1136,1137,1139,1141,1144,1146],{"class":47,"line":69},[45,1138,1113],{"class":51},[45,1140,1117],{"class":1116},[45,1142,1143],{"class":51},">More\u003C/",[45,1145,1117],{"class":1116},[45,1147,1134],{"class":51},[45,1149,1150,1152,1154,1157,1159,1162,1165,1167],{"class":47,"line":106},[45,1151,1113],{"class":51},[45,1153,857],{"class":1116},[45,1155,1156],{"class":55}," href",[45,1158,1123],{"class":51},[45,1160,1161],{"class":62},"\"/more\"",[45,1163,1164],{"class":51},">Find out more\u003C/",[45,1166,857],{"class":1116},[45,1168,1134],{"class":51},[11,1170,1171],{},"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,1173,1174],{},"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,1176,1177],{},[850,1178,1179],{},"Extracted DOM Snapshot:",[36,1181,1183],{"className":1104,"code":1182,"language":1106,"meta":41,"style":41},"\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",[23,1184,1185,1198,1211,1224,1237],{"__ignoreMap":41},[45,1186,1187,1189,1191,1194,1196],{"class":47,"line":48},[45,1188,1113],{"class":51},[45,1190,850],{"class":1116},[45,1192,1193],{"class":51},">MacBook Air\u003C/",[45,1195,850],{"class":1116},[45,1197,1134],{"class":51},[45,1199,1200,1202,1204,1207,1209],{"class":47,"line":69},[45,1201,1113],{"class":51},[45,1203,1117],{"class":1116},[45,1205,1206],{"class":51},">Add to cart\u003C/",[45,1208,1117],{"class":1116},[45,1210,1134],{"class":51},[45,1212,1213,1215,1217,1220,1222],{"class":47,"line":106},[45,1214,1113],{"class":51},[45,1216,11],{"class":1116},[45,1218,1219],{"class":51},">Out of stock\u003C/",[45,1221,11],{"class":1116},[45,1223,1134],{"class":51},[45,1225,1226,1228,1230,1233,1235],{"class":47,"line":123},[45,1227,1113],{"class":51},[45,1229,15],{"class":1116},[45,1231,1232],{"class":51},">MacBook Pro\u003C/",[45,1234,15],{"class":1116},[45,1236,1134],{"class":51},[45,1238,1239,1241,1243,1245,1247],{"class":47,"line":258},[45,1240,1113],{"class":51},[45,1242,1117],{"class":1116},[45,1244,1206],{"class":51},[45,1246,1117],{"class":1116},[45,1248,1134],{"class":51},[11,1250,1251],{},[850,1252,1253],{},"Original DOM Snapshot – Candidate A:",[36,1255,1257],{"className":1104,"code":1256,"language":1106,"meta":41,"style":41},"\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",[23,1258,1259,1276,1289,1301,1314,1323,1337,1349,1361],{"__ignoreMap":41},[45,1260,1261,1263,1266,1269,1271,1274],{"class":47,"line":48},[45,1262,1113],{"class":51},[45,1264,1265],{"class":1116},"section",[45,1267,1268],{"class":55}," class",[45,1270,1123],{"class":51},[45,1272,1273],{"class":62},"\"product\"",[45,1275,1134],{"class":51},[45,1277,1278,1281,1283,1285,1287],{"class":47,"line":69},[45,1279,1280],{"class":51},"  \u003C",[45,1282,850],{"class":1116},[45,1284,1193],{"class":51},[45,1286,850],{"class":1116},[45,1288,1134],{"class":51},[45,1290,1291,1293,1295,1297,1299],{"class":47,"line":106},[45,1292,1280],{"class":51},[45,1294,1117],{"class":1116},[45,1296,1206],{"class":51},[45,1298,1117],{"class":1116},[45,1300,1134],{"class":51},[45,1302,1303,1305,1307,1309,1311],{"class":47,"line":123},[45,1304,1280],{"class":51},[45,1306,11],{"class":1116},[45,1308,1219],{"class":51},[45,1310,11],{"class":1116},[45,1312,1313],{"class":51},">  👈\n",[45,1315,1316,1319,1321],{"class":47,"line":258},[45,1317,1318],{"class":51},"\u003C/",[45,1320,1265],{"class":1116},[45,1322,1134],{"class":51},[45,1324,1325,1327,1329,1331,1333,1335],{"class":47,"line":269},[45,1326,1113],{"class":51},[45,1328,1265],{"class":1116},[45,1330,1268],{"class":55},[45,1332,1123],{"class":51},[45,1334,1273],{"class":62},[45,1336,1134],{"class":51},[45,1338,1339,1341,1343,1345,1347],{"class":47,"line":281},[45,1340,1280],{"class":51},[45,1342,850],{"class":1116},[45,1344,1232],{"class":51},[45,1346,850],{"class":1116},[45,1348,1134],{"class":51},[45,1350,1351,1353,1355,1357,1359],{"class":47,"line":291},[45,1352,1280],{"class":51},[45,1354,1117],{"class":1116},[45,1356,1206],{"class":51},[45,1358,1117],{"class":1116},[45,1360,1134],{"class":51},[45,1362,1363,1365,1367],{"class":47,"line":302},[45,1364,1318],{"class":51},[45,1366,1265],{"class":1116},[45,1368,1134],{"class":51},[11,1370,1371],{},[850,1372,1373],{},"Original DOM Snapshot – Candidate B:",[36,1375,1377],{"className":1104,"code":1376,"language":1106,"meta":41,"style":41},"\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",[23,1378,1379,1393,1405,1417,1425,1439,1451,1463,1475],{"__ignoreMap":41},[45,1380,1381,1383,1385,1387,1389,1391],{"class":47,"line":48},[45,1382,1113],{"class":51},[45,1384,1265],{"class":1116},[45,1386,1268],{"class":55},[45,1388,1123],{"class":51},[45,1390,1273],{"class":62},[45,1392,1134],{"class":51},[45,1394,1395,1397,1399,1401,1403],{"class":47,"line":69},[45,1396,1280],{"class":51},[45,1398,850],{"class":1116},[45,1400,1193],{"class":51},[45,1402,850],{"class":1116},[45,1404,1134],{"class":51},[45,1406,1407,1409,1411,1413,1415],{"class":47,"line":106},[45,1408,1280],{"class":51},[45,1410,1117],{"class":1116},[45,1412,1206],{"class":51},[45,1414,1117],{"class":1116},[45,1416,1134],{"class":51},[45,1418,1419,1421,1423],{"class":47,"line":123},[45,1420,1318],{"class":51},[45,1422,1265],{"class":1116},[45,1424,1134],{"class":51},[45,1426,1427,1429,1431,1433,1435,1437],{"class":47,"line":258},[45,1428,1113],{"class":51},[45,1430,1265],{"class":1116},[45,1432,1268],{"class":55},[45,1434,1123],{"class":51},[45,1436,1273],{"class":62},[45,1438,1134],{"class":51},[45,1440,1441,1443,1445,1447,1449],{"class":47,"line":269},[45,1442,1280],{"class":51},[45,1444,11],{"class":1116},[45,1446,1219],{"class":51},[45,1448,11],{"class":1116},[45,1450,1313],{"class":51},[45,1452,1453,1455,1457,1459,1461],{"class":47,"line":281},[45,1454,1280],{"class":51},[45,1456,850],{"class":1116},[45,1458,1232],{"class":51},[45,1460,850],{"class":1116},[45,1462,1134],{"class":51},[45,1464,1465,1467,1469,1471,1473],{"class":47,"line":291},[45,1466,1280],{"class":51},[45,1468,1117],{"class":1116},[45,1470,1206],{"class":51},[45,1472,1117],{"class":1116},[45,1474,1134],{"class":51},[45,1476,1477,1479,1481],{"class":47,"line":302},[45,1478,1318],{"class":51},[45,1480,1265],{"class":1116},[45,1482,1134],{"class":51},[959,1484,1486],{"id":1485},"downsampled-dom-snapshots","Downsampled DOM Snapshots",[11,1488,1489,1490,790],{},"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",[973,1491,1492],{},[857,1493,1497],{"href":1494,"ariaDescribedBy":1495,"dataFootnoteRef":41,"id":1496},"#user-content-fn-4",[979],"user-content-fnref-4","4",[11,1499,1500],{},[850,1501,1502],{},"Original DOM Snapshot:",[36,1504,1506],{"className":1104,"code":1505,"language":1106,"meta":41,"style":41},"\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",[23,1507,1508,1546,1577,1592,1600,1616,1630,1638,1643,1648,1657,1677,1686,1700,1713,1722,1728,1734,1743,1762,1771,1781,1791],{"__ignoreMap":41},[45,1509,1510,1512,1514,1516,1518,1521,1524,1526,1529,1532,1534,1537,1539,1541,1544],{"class":47,"line":48},[45,1511,1113],{"class":51},[45,1513,1265],{"class":1116},[45,1515,1268],{"class":55},[45,1517,1123],{"class":51},[45,1519,1520],{"class":62},"\"container\"",[45,1522,1523],{"class":55}," tabindex",[45,1525,1123],{"class":51},[45,1527,1528],{"class":62},"\"3\"",[45,1530,1531],{"class":55}," required",[45,1533,1123],{"class":51},[45,1535,1536],{"class":62},"\"true\"",[45,1538,1120],{"class":55},[45,1540,1123],{"class":51},[45,1542,1543],{"class":62},"\"example\"",[45,1545,1134],{"class":51},[45,1547,1548,1550,1553,1555,1557,1560,1563,1565,1568,1570,1572,1575],{"class":47,"line":69},[45,1549,1280],{"class":51},[45,1551,1552],{"class":1116},"div",[45,1554,1268],{"class":55},[45,1556,1123],{"class":51},[45,1558,1559],{"class":62},"\"mx-auto\"",[45,1561,1562],{"class":55}," data-topic",[45,1564,1123],{"class":51},[45,1566,1567],{"class":62},"\"products\"",[45,1569,1531],{"class":55},[45,1571,1123],{"class":51},[45,1573,1574],{"class":62},"\"false\"",[45,1576,1134],{"class":51},[45,1578,1579,1582,1585,1588,1590],{"class":47,"line":106},[45,1580,1581],{"class":51},"    \u003C",[45,1583,1584],{"class":1116},"h1",[45,1586,1587],{"class":51},">Our Pizza\u003C/",[45,1589,1584],{"class":1116},[45,1591,1134],{"class":51},[45,1593,1594,1596,1598],{"class":47,"line":123},[45,1595,1581],{"class":51},[45,1597,1552],{"class":1116},[45,1599,1134],{"class":51},[45,1601,1602,1605,1607,1609,1611,1614],{"class":47,"line":258},[45,1603,1604],{"class":51},"      \u003C",[45,1606,1552],{"class":1116},[45,1608,1268],{"class":55},[45,1610,1123],{"class":51},[45,1612,1613],{"class":62},"\"shadow-lg\"",[45,1615,1134],{"class":51},[45,1617,1618,1621,1623,1626,1628],{"class":47,"line":269},[45,1619,1620],{"class":51},"        \u003C",[45,1622,15],{"class":1116},[45,1624,1625],{"class":51},">Margherita\u003C/",[45,1627,15],{"class":1116},[45,1629,1134],{"class":51},[45,1631,1632,1634,1636],{"class":47,"line":281},[45,1633,1620],{"class":51},[45,1635,11],{"class":1116},[45,1637,1134],{"class":51},[45,1639,1640],{"class":47,"line":291},[45,1641,1642],{"class":51},"         A simple classic: mozzarella, tomatoes and basil.\n",[45,1644,1645],{"class":47,"line":302},[45,1646,1647],{"class":51},"         An everyday choice!\n",[45,1649,1650,1653,1655],{"class":47,"line":313},[45,1651,1652],{"class":51},"        \u003C/",[45,1654,11],{"class":1116},[45,1656,1134],{"class":51},[45,1658,1659,1661,1663,1665,1667,1670,1673,1675],{"class":47,"line":323},[45,1660,1620],{"class":51},[45,1662,1117],{"class":1116},[45,1664,1120],{"class":55},[45,1666,1123],{"class":51},[45,1668,1669],{"class":62},"\"button\"",[45,1671,1672],{"class":51},">Add\u003C/",[45,1674,1117],{"class":1116},[45,1676,1134],{"class":51},[45,1678,1679,1682,1684],{"class":47,"line":333},[45,1680,1681],{"class":51},"      \u003C/",[45,1683,1552],{"class":1116},[45,1685,1134],{"class":51},[45,1687,1688,1690,1692,1694,1696,1698],{"class":47,"line":343},[45,1689,1604],{"class":51},[45,1691,1552],{"class":1116},[45,1693,1268],{"class":55},[45,1695,1123],{"class":51},[45,1697,1613],{"class":62},[45,1699,1134],{"class":51},[45,1701,1702,1704,1706,1709,1711],{"class":47,"line":349},[45,1703,1620],{"class":51},[45,1705,15],{"class":1116},[45,1707,1708],{"class":51},">Capricciosa\u003C/",[45,1710,15],{"class":1116},[45,1712,1134],{"class":51},[45,1714,1716,1718,1720],{"class":47,"line":1715},15,[45,1717,1620],{"class":51},[45,1719,11],{"class":1116},[45,1721,1134],{"class":51},[45,1723,1725],{"class":47,"line":1724},16,[45,1726,1727],{"class":51},"          A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[45,1729,1731],{"class":47,"line":1730},17,[45,1732,1733],{"class":51},"          A true favourite!\n",[45,1735,1737,1739,1741],{"class":47,"line":1736},18,[45,1738,1652],{"class":51},[45,1740,11],{"class":1116},[45,1742,1134],{"class":51},[45,1744,1746,1748,1750,1752,1754,1756,1758,1760],{"class":47,"line":1745},19,[45,1747,1620],{"class":51},[45,1749,1117],{"class":1116},[45,1751,1120],{"class":55},[45,1753,1123],{"class":51},[45,1755,1669],{"class":62},[45,1757,1672],{"class":51},[45,1759,1117],{"class":1116},[45,1761,1134],{"class":51},[45,1763,1765,1767,1769],{"class":47,"line":1764},20,[45,1766,1681],{"class":51},[45,1768,1552],{"class":1116},[45,1770,1134],{"class":51},[45,1772,1774,1777,1779],{"class":47,"line":1773},21,[45,1775,1776],{"class":51},"    \u003C/",[45,1778,1552],{"class":1116},[45,1780,1134],{"class":51},[45,1782,1784,1787,1789],{"class":47,"line":1783},22,[45,1785,1786],{"class":51},"  \u003C/",[45,1788,1552],{"class":1116},[45,1790,1134],{"class":51},[45,1792,1794,1796,1798],{"class":47,"line":1793},23,[45,1795,1318],{"class":51},[45,1797,1265],{"class":1116},[45,1799,1134],{"class":51},[11,1801,1802],{},[850,1803,1804],{},"Downsampled DOM Snapshot:",[36,1806,1808],{"className":1104,"code":1807,"language":1106,"meta":41,"style":41},"\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",[23,1809,1810,1836,1856,1861,1869,1874,1879,1884,1902,1907,1912,1917,1935,1943,1951],{"__ignoreMap":41},[45,1811,1812,1814,1816,1818,1820,1822,1824,1826,1828,1830,1832,1834],{"class":47,"line":48},[45,1813,1113],{"class":51},[45,1815,1265],{"class":1116},[45,1817,1268],{"class":55},[45,1819,1123],{"class":51},[45,1821,1520],{"class":62},[45,1823,1531],{"class":55},[45,1825,1123],{"class":51},[45,1827,1536],{"class":62},[45,1829,1120],{"class":55},[45,1831,1123],{"class":51},[45,1833,1543],{"class":62},[45,1835,1134],{"class":51},[45,1837,1838,1840,1842,1844,1846,1848,1850,1852,1854],{"class":47,"line":69},[45,1839,1280],{"class":51},[45,1841,1552],{"class":1116},[45,1843,1268],{"class":55},[45,1845,1123],{"class":51},[45,1847,1559],{"class":62},[45,1849,1531],{"class":55},[45,1851,1123],{"class":51},[45,1853,1574],{"class":62},[45,1855,1134],{"class":51},[45,1857,1858],{"class":47,"line":106},[45,1859,1860],{"class":51},"    Our Pizza\n",[45,1862,1863,1865,1867],{"class":47,"line":123},[45,1864,1581],{"class":51},[45,1866,1552],{"class":1116},[45,1868,1134],{"class":51},[45,1870,1871],{"class":47,"line":258},[45,1872,1873],{"class":51},"      Margherita\n",[45,1875,1876],{"class":47,"line":269},[45,1877,1878],{"class":51},"      A simple classic: mozzarella, tomatoes and basil.\n",[45,1880,1881],{"class":47,"line":281},[45,1882,1883],{"class":51},"      An everyday choice!\n",[45,1885,1886,1888,1890,1892,1894,1896,1898,1900],{"class":47,"line":291},[45,1887,1604],{"class":51},[45,1889,1117],{"class":1116},[45,1891,1120],{"class":55},[45,1893,1123],{"class":51},[45,1895,1669],{"class":62},[45,1897,1672],{"class":51},[45,1899,1117],{"class":1116},[45,1901,1134],{"class":51},[45,1903,1904],{"class":47,"line":302},[45,1905,1906],{"class":51},"      Capricciosa\n",[45,1908,1909],{"class":47,"line":313},[45,1910,1911],{"class":51},"      A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[45,1913,1914],{"class":47,"line":323},[45,1915,1916],{"class":51},"      A true favourite!\n",[45,1918,1919,1921,1923,1925,1927,1929,1931,1933],{"class":47,"line":333},[45,1920,1604],{"class":51},[45,1922,1117],{"class":1116},[45,1924,1120],{"class":55},[45,1926,1123],{"class":51},[45,1928,1669],{"class":62},[45,1930,1672],{"class":51},[45,1932,1117],{"class":1116},[45,1934,1134],{"class":51},[45,1936,1937,1939,1941],{"class":47,"line":343},[45,1938,1776],{"class":51},[45,1940,1552],{"class":1116},[45,1942,1134],{"class":51},[45,1944,1945,1947,1949],{"class":47,"line":349},[45,1946,1786],{"class":51},[45,1948,1552],{"class":1116},[45,1950,1134],{"class":51},[45,1952,1953,1955,1957],{"class":47,"line":1715},[45,1954,1318],{"class":51},[45,1956,1265],{"class":1116},[45,1958,1134],{"class":51},[11,1960,1961,1962,790],{},"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",[973,1963,1964],{},[857,1965,1497],{"href":1494,"ariaDescribedBy":1966,"dataFootnoteRef":41,"id":1967},[979],"user-content-fnref-4-2",[154,1969,1971],{"id":1970},"the-problem-with-dom-based-targeting","The Problem with DOM-Based Targeting",[11,1973,1974,1975,1978,1979,1982],{},"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 ",[23,1976,1977],{},"UNIQUE-ID=\"27\"",", which can be selected via ",[23,1980,1981],{},"[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,1984,1985],{},[850,1986,1987],{},"DOM Snapshot with Inlined IDs:",[147,1989],{"alt":1990,"loading":150,"src":1991},"A DOM snapshot (HTML) visualising unique ID (attribute) targeting","/blog/serialising-web-ui-state-for-llms-the-complete-guide/7.png",[154,1993,1995],{"id":1994},"the-dom-based-snapshot-pipeline","The DOM-Based Snapshot Pipeline",[11,1997,1998],{},"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,2000,2001],{},"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,2003,2004],{},"The pipeline approach traceably goes from the raw DOM to an abstract snapshot representation. For example:",[424,2006,2007,2030,2036,2095,2101,2107],{},[427,2008,2009,2012,2013,2018,2019,2022,2023,397,2026,2029],{},[850,2010,2011],{},"Scope Subtree."," Scope in to a task-relevant subtree. An information retrieval task on ",[857,2014,2017],{"href":2015,"rel":2016},"https://www.wikipedia.org",[861],"wikipedia.org"," can scope into the ",[23,2020,2021],{},"main"," element – ",[23,2024,2025],{},"header",[23,2027,2028],{},"footer"," are irrelevant.",[427,2031,2032,2035],{},[850,2033,2034],{},"Clone."," Clone the live DOM.",[427,2037,2038,2041,2042],{},[850,2039,2040],{},"Filter."," Apply arbitrary filters to the cloned DOM (in memory). For example:\n",[2043,2044,2045,2083,2089],"ul",{},[427,2046,2047,2050,2051],{},[850,2048,2049],{},"Prune Subtrees"," E.g.:\n",[2043,2052,2053,2059,2065],{},[427,2054,2055,2058],{},[850,2056,2057],{},"Non-interactive Nodes",", e.g., hidden elements.",[427,2060,2061,2064],{},[850,2062,2063],{},"Irrelevant Nodes",", e.g., comment nodes.",[427,2066,2067,2070,2071,2073,2074,2076,2077,2080,2081,790],{},[850,2068,2069],{},"Redundant Nodes",", e.g., ",[23,2072,857],{}," in the ",[23,2075,2028],{}," that has a same-",[23,2078,2079],{},"href"," equivalent in the ",[23,2082,2025],{},[427,2084,2085,2088],{},[850,2086,2087],{},"Sanitise."," E.g., sensitive information from content-editables.",[427,2090,2091,2094],{},[850,2092,2093],{},"Clean."," E.g., remove stop words from text nodes.",[427,2096,2097,2100],{},[850,2098,2099],{},"Serialise."," Serialise the cloned DOM to HTML.",[427,2102,2103,2106],{},[850,2104,2105],{},"Downsample."," Downsample the HTML to control size.",[427,2108,2109,2112],{},[850,2110,2111],{},"Translate."," Translate the downsampled HTML to any DOM-based representation, e.g., the accessibility tree.",[147,2114],{"alt":2115,"loading":150,"src":2116,"provider":151},"Example of a DOM snapshot pipeline","/blog/serialising-web-ui-state-for-llms-the-complete-guide/8.svg",[11,2118,2119],{},"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.",[959,2121,2123],{"id":2122},"arbitrary-snapshot-representations","Arbitrary Snapshot Representations",[11,2125,2126],{},"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,2128,2129],{},"Compare the following snapshots representations for the same UI:",[11,2131,2132],{},[850,2133,2134],{},"DOM Snapshot:",[36,2136,2138],{"className":1104,"code":2137,"language":1106,"meta":41,"style":41},"\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",[23,2139,2140,2166,2186,2198,2206,2218,2226,2231,2236,2244,2271,2283,2291,2296,2301,2309,2335,2343,2351],{"__ignoreMap":41},[45,2141,2142,2144,2146,2148,2150,2152,2154,2156,2158,2160,2162,2164],{"class":47,"line":48},[45,2143,1113],{"class":51},[45,2145,1265],{"class":1116},[45,2147,1268],{"class":55},[45,2149,1123],{"class":51},[45,2151,1520],{"class":62},[45,2153,1531],{"class":55},[45,2155,1123],{"class":51},[45,2157,1536],{"class":62},[45,2159,1120],{"class":55},[45,2161,1123],{"class":51},[45,2163,1543],{"class":62},[45,2165,1134],{"class":51},[45,2167,2168,2170,2172,2174,2176,2178,2180,2182,2184],{"class":47,"line":69},[45,2169,1280],{"class":51},[45,2171,1552],{"class":1116},[45,2173,1268],{"class":55},[45,2175,1123],{"class":51},[45,2177,1559],{"class":62},[45,2179,1531],{"class":55},[45,2181,1123],{"class":51},[45,2183,1574],{"class":62},[45,2185,1134],{"class":51},[45,2187,2188,2190,2192,2194,2196],{"class":47,"line":106},[45,2189,1581],{"class":51},[45,2191,1584],{"class":1116},[45,2193,1587],{"class":51},[45,2195,1584],{"class":1116},[45,2197,1134],{"class":51},[45,2199,2200,2202,2204],{"class":47,"line":123},[45,2201,1581],{"class":51},[45,2203,1552],{"class":1116},[45,2205,1134],{"class":51},[45,2207,2208,2210,2212,2214,2216],{"class":47,"line":258},[45,2209,1604],{"class":51},[45,2211,15],{"class":1116},[45,2213,1625],{"class":51},[45,2215,15],{"class":1116},[45,2217,1134],{"class":51},[45,2219,2220,2222,2224],{"class":47,"line":269},[45,2221,1604],{"class":51},[45,2223,11],{"class":1116},[45,2225,1134],{"class":51},[45,2227,2228],{"class":47,"line":281},[45,2229,2230],{"class":51},"        A simple classic: mozzarella, tomatoes and basil.\n",[45,2232,2233],{"class":47,"line":291},[45,2234,2235],{"class":51},"        An everyday choice!\n",[45,2237,2238,2240,2242],{"class":47,"line":302},[45,2239,1681],{"class":51},[45,2241,11],{"class":1116},[45,2243,1134],{"class":51},[45,2245,2246,2248,2250,2252,2254,2257,2260,2262,2265,2267,2269],{"class":47,"line":313},[45,2247,1604],{"class":51},[45,2249,857],{"class":1116},[45,2251,1156],{"class":55},[45,2253,1123],{"class":51},[45,2255,2256],{"class":62},"\"add?p=margherita\"",[45,2258,2259],{"class":55}," data-uid",[45,2261,1123],{"class":51},[45,2263,2264],{"class":62},"\"1\"",[45,2266,1672],{"class":51},[45,2268,857],{"class":1116},[45,2270,1134],{"class":51},[45,2272,2273,2275,2277,2279,2281],{"class":47,"line":323},[45,2274,1604],{"class":51},[45,2276,15],{"class":1116},[45,2278,1708],{"class":51},[45,2280,15],{"class":1116},[45,2282,1134],{"class":51},[45,2284,2285,2287,2289],{"class":47,"line":333},[45,2286,1604],{"class":51},[45,2288,11],{"class":1116},[45,2290,1134],{"class":51},[45,2292,2293],{"class":47,"line":343},[45,2294,2295],{"class":51},"        A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[45,2297,2298],{"class":47,"line":349},[45,2299,2300],{"class":51},"        A true favourite!\n",[45,2302,2303,2305,2307],{"class":47,"line":1715},[45,2304,1681],{"class":51},[45,2306,11],{"class":1116},[45,2308,1134],{"class":51},[45,2310,2311,2313,2315,2317,2319,2322,2324,2326,2329,2331,2333],{"class":47,"line":1724},[45,2312,1604],{"class":51},[45,2314,857],{"class":1116},[45,2316,1156],{"class":55},[45,2318,1123],{"class":51},[45,2320,2321],{"class":62},"\"add?p=capricciosa\"",[45,2323,2259],{"class":55},[45,2325,1123],{"class":51},[45,2327,2328],{"class":62},"\"2\"",[45,2330,1672],{"class":51},[45,2332,857],{"class":1116},[45,2334,1134],{"class":51},[45,2336,2337,2339,2341],{"class":47,"line":1730},[45,2338,1776],{"class":51},[45,2340,1552],{"class":1116},[45,2342,1134],{"class":51},[45,2344,2345,2347,2349],{"class":47,"line":1736},[45,2346,1786],{"class":51},[45,2348,1552],{"class":1116},[45,2350,1134],{"class":51},[45,2352,2353,2355,2357],{"class":47,"line":1745},[45,2354,1318],{"class":51},[45,2356,1265],{"class":1116},[45,2358,1134],{"class":51},[11,2360,2361],{},[850,2362,2363],{},"Accessibility Tree Snapshot:",[36,2365,2369],{"className":2366,"code":2367,"language":2368,"meta":41,"style":41},"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",[23,2370,2371,2382,2389,2398,2405,2415,2426,2436,2444,2453,2462,2471,2478,2491,2500,2509,2519,2528,2536,2545,2553,2561,2567,2578,2587,2596,2606],{"__ignoreMap":41},[45,2372,2373,2376,2379],{"class":47,"line":48},[45,2374,2375],{"class":51},"- ",[45,2377,2378],{"class":1116},"document",[45,2380,2381],{"class":51},":\n",[45,2383,2384,2387],{"class":47,"line":69},[45,2385,2386],{"class":1116},"  children",[45,2388,2381],{"class":51},[45,2390,2391,2394,2396],{"class":47,"line":106},[45,2392,2393],{"class":51},"    - ",[45,2395,1265],{"class":1116},[45,2397,2381],{"class":51},[45,2399,2400,2403],{"class":47,"line":123},[45,2401,2402],{"class":1116},"      children",[45,2404,2381],{"class":51},[45,2406,2407,2410,2413],{"class":47,"line":258},[45,2408,2409],{"class":51},"        - ",[45,2411,2412],{"class":1116},"heading",[45,2414,2381],{"class":51},[45,2416,2417,2420,2423],{"class":47,"line":269},[45,2418,2419],{"class":1116},"          name",[45,2421,2422],{"class":51},": ",[45,2424,2425],{"class":62},"\"Our Pizza\"\n",[45,2427,2428,2431,2433],{"class":47,"line":281},[45,2429,2430],{"class":1116},"          level",[45,2432,2422],{"class":51},[45,2434,2435],{"class":223},"1\n",[45,2437,2438,2440,2442],{"class":47,"line":291},[45,2439,2409],{"class":51},[45,2441,2412],{"class":1116},[45,2443,2381],{"class":51},[45,2445,2446,2448,2450],{"class":47,"line":302},[45,2447,2419],{"class":1116},[45,2449,2422],{"class":51},[45,2451,2452],{"class":62},"\"Margherita\"\n",[45,2454,2455,2457,2459],{"class":47,"line":313},[45,2456,2430],{"class":1116},[45,2458,2422],{"class":51},[45,2460,2461],{"class":223},"2\n",[45,2463,2464,2466,2469],{"class":47,"line":323},[45,2465,2409],{"class":51},[45,2467,2468],{"class":1116},"paragraph",[45,2470,2381],{"class":51},[45,2472,2473,2476],{"class":47,"line":333},[45,2474,2475],{"class":1116},"          children",[45,2477,2381],{"class":51},[45,2479,2480,2483,2486,2488],{"class":47,"line":343},[45,2481,2482],{"class":51},"            - ",[45,2484,2485],{"class":1116},"text",[45,2487,2422],{"class":51},[45,2489,2490],{"class":62},"\"A simple classic: mozzarella, tomatoes and basil. An everyday choice!\"\n",[45,2492,2493,2495,2498],{"class":47,"line":349},[45,2494,2409],{"class":51},[45,2496,2497],{"class":1116},"link",[45,2499,2381],{"class":51},[45,2501,2502,2504,2506],{"class":47,"line":1715},[45,2503,2419],{"class":1116},[45,2505,2422],{"class":51},[45,2507,2508],{"class":62},"\"Add\"\n",[45,2510,2511,2514,2516],{"class":47,"line":1724},[45,2512,2513],{"class":1116},"          url",[45,2515,2422],{"class":51},[45,2517,2518],{"class":62},"\"add?p=margherita\"\n",[45,2520,2521,2524,2526],{"class":47,"line":1730},[45,2522,2523],{"class":1116},"          data-uid",[45,2525,2422],{"class":51},[45,2527,2435],{"class":223},[45,2529,2530,2532,2534],{"class":47,"line":1736},[45,2531,2409],{"class":51},[45,2533,2412],{"class":1116},[45,2535,2381],{"class":51},[45,2537,2538,2540,2542],{"class":47,"line":1745},[45,2539,2419],{"class":1116},[45,2541,2422],{"class":51},[45,2543,2544],{"class":62},"\"Capricciosa\"\n",[45,2546,2547,2549,2551],{"class":47,"line":1764},[45,2548,2430],{"class":1116},[45,2550,2422],{"class":51},[45,2552,2461],{"class":223},[45,2554,2555,2557,2559],{"class":47,"line":1773},[45,2556,2409],{"class":51},[45,2558,2468],{"class":1116},[45,2560,2381],{"class":51},[45,2562,2563,2565],{"class":47,"line":1783},[45,2564,2475],{"class":1116},[45,2566,2381],{"class":51},[45,2568,2569,2571,2573,2575],{"class":47,"line":1793},[45,2570,2482],{"class":51},[45,2572,2485],{"class":1116},[45,2574,2422],{"class":51},[45,2576,2577],{"class":62},"\"A rich taste: mozzarella, ham, mushrooms, artichokes and olives. A true favourite!\"\n",[45,2579,2581,2583,2585],{"class":47,"line":2580},24,[45,2582,2409],{"class":51},[45,2584,2497],{"class":1116},[45,2586,2381],{"class":51},[45,2588,2590,2592,2594],{"class":47,"line":2589},25,[45,2591,2419],{"class":1116},[45,2593,2422],{"class":51},[45,2595,2508],{"class":62},[45,2597,2599,2601,2603],{"class":47,"line":2598},26,[45,2600,2513],{"class":1116},[45,2602,2422],{"class":51},[45,2604,2605],{"class":62},"\"add?p=capricciosa\"\n",[45,2607,2609,2611,2613],{"class":47,"line":2608},27,[45,2610,2523],{"class":1116},[45,2612,2422],{"class":51},[45,2614,2461],{"class":223},[11,2616,2617],{},[850,2618,2619],{},"Markdown Snapshot:",[36,2621,2624],{"className":2622,"code":2623,"language":822,"meta":41,"style":41},"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",[23,2625,2626,2631,2636,2641,2645,2650,2655,2659,2664,2668,2673,2677,2682,2687,2691],{"__ignoreMap":41},[45,2627,2628],{"class":47,"line":48},[45,2629,2630],{},"# Our Pizza\n",[45,2632,2633],{"class":47,"line":69},[45,2634,2635],{"emptyLinePlaceholder":824},"\n",[45,2637,2638],{"class":47,"line":106},[45,2639,2640],{},"## Margherita\n",[45,2642,2643],{"class":47,"line":123},[45,2644,2635],{"emptyLinePlaceholder":824},[45,2646,2647],{"class":47,"line":258},[45,2648,2649],{},"A simple classic: mozzarella, tomatoes and basil.\n",[45,2651,2652],{"class":47,"line":269},[45,2653,2654],{},"An everyday choice!\n",[45,2656,2657],{"class":47,"line":281},[45,2658,2635],{"emptyLinePlaceholder":824},[45,2660,2661],{"class":47,"line":291},[45,2662,2663],{},"[Add](add?p=margherita)\n",[45,2665,2666],{"class":47,"line":302},[45,2667,2635],{"emptyLinePlaceholder":824},[45,2669,2670],{"class":47,"line":313},[45,2671,2672],{},"## Capricciosa\n",[45,2674,2675],{"class":47,"line":323},[45,2676,2635],{"emptyLinePlaceholder":824},[45,2678,2679],{"class":47,"line":333},[45,2680,2681],{},"A rich taste: mozzarella, ham, mushrooms, artichokes and olives.\n",[45,2683,2684],{"class":47,"line":343},[45,2685,2686],{},"A true favourite!\n",[45,2688,2689],{"class":47,"line":349},[45,2690,2635],{"emptyLinePlaceholder":824},[45,2692,2693],{"class":47,"line":1715},[45,2694,2695],{},"[Add](add?p=capricciosa)\n",[11,2697,2698],{},[850,2699,2700],{},"Custom Format Snapshot:",[36,2702,2706],{"className":2703,"code":2705,"language":2485},[2704],"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",[23,2707,2705],{"__ignoreMap":41},[11,2709,2710,2711,790],{},"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",[973,2712,2713],{},[857,2714,1497],{"href":1494,"ariaDescribedBy":2715,"dataFootnoteRef":41,"id":2716},[979],"user-content-fnref-4-3",[15,2718,2720],{"id":2719},"non-idiomatic-application-designs","Non-Idiomatic Application Designs",[11,2722,2723],{},"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,2725,2726],{},"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,2728,2729],{},"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.",[147,2731],{"alt":2732,"loading":150,"src":2733,":width":2734},"Example of a fictional UI/UX bad practice (overly subtle button)","/blog/serialising-web-ui-state-for-llms-the-complete-guide/9.png","480",[11,2736,2737,2738,91],{},"As an example for bad affordance in the DOM, look at this datepicker from ",[857,2739,2742],{"href":2740,"rel":2741},"https://www.webmd.com",[861],"webmd.com",[147,2744],{"alt":2745,"loading":150,"src":2746,":width":2734},"Example of an HTML bad practice (ignoring tag name semantics)","/blog/serialising-web-ui-state-for-llms-the-complete-guide/10.png",[36,2748,2750],{"className":1104,"code":2749,"language":1106,"meta":41,"style":41},"\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",[23,2751,2752,2760,2780,2799,2818,2837,2856,2875,2894,2900,2920,2938,2967,2994,3021,3025,3052,3079],{"__ignoreMap":41},[45,2753,2754,2756,2758],{"class":47,"line":48},[45,2755,1113],{"class":51},[45,2757,1552],{"class":1116},[45,2759,1134],{"class":51},[45,2761,2762,2764,2766,2768,2770,2773,2776,2778],{"class":47,"line":69},[45,2763,1280],{"class":51},[45,2765,45],{"class":1116},[45,2767,1268],{"class":55},[45,2769,1123],{"class":51},[45,2771,2772],{"class":62},"\"cell day-header\"",[45,2774,2775],{"class":51},">Sun\u003C/",[45,2777,45],{"class":1116},[45,2779,1134],{"class":51},[45,2781,2782,2784,2786,2788,2790,2792,2795,2797],{"class":47,"line":106},[45,2783,1280],{"class":51},[45,2785,45],{"class":1116},[45,2787,1268],{"class":55},[45,2789,1123],{"class":51},[45,2791,2772],{"class":62},[45,2793,2794],{"class":51},">Mon\u003C/",[45,2796,45],{"class":1116},[45,2798,1134],{"class":51},[45,2800,2801,2803,2805,2807,2809,2811,2814,2816],{"class":47,"line":123},[45,2802,1280],{"class":51},[45,2804,45],{"class":1116},[45,2806,1268],{"class":55},[45,2808,1123],{"class":51},[45,2810,2772],{"class":62},[45,2812,2813],{"class":51},">Tue\u003C/",[45,2815,45],{"class":1116},[45,2817,1134],{"class":51},[45,2819,2820,2822,2824,2826,2828,2830,2833,2835],{"class":47,"line":258},[45,2821,1280],{"class":51},[45,2823,45],{"class":1116},[45,2825,1268],{"class":55},[45,2827,1123],{"class":51},[45,2829,2772],{"class":62},[45,2831,2832],{"class":51},">Wed\u003C/",[45,2834,45],{"class":1116},[45,2836,1134],{"class":51},[45,2838,2839,2841,2843,2845,2847,2849,2852,2854],{"class":47,"line":269},[45,2840,1280],{"class":51},[45,2842,45],{"class":1116},[45,2844,1268],{"class":55},[45,2846,1123],{"class":51},[45,2848,2772],{"class":62},[45,2850,2851],{"class":51},">Thu\u003C/",[45,2853,45],{"class":1116},[45,2855,1134],{"class":51},[45,2857,2858,2860,2862,2864,2866,2868,2871,2873],{"class":47,"line":281},[45,2859,1280],{"class":51},[45,2861,45],{"class":1116},[45,2863,1268],{"class":55},[45,2865,1123],{"class":51},[45,2867,2772],{"class":62},[45,2869,2870],{"class":51},">Fri\u003C/",[45,2872,45],{"class":1116},[45,2874,1134],{"class":51},[45,2876,2877,2879,2881,2883,2885,2887,2890,2892],{"class":47,"line":291},[45,2878,1280],{"class":51},[45,2880,45],{"class":1116},[45,2882,1268],{"class":55},[45,2884,1123],{"class":51},[45,2886,2772],{"class":62},[45,2888,2889],{"class":51},">Sat\u003C/",[45,2891,45],{"class":1116},[45,2893,1134],{"class":51},[45,2895,2896],{"class":47,"line":302},[45,2897,2899],{"class":2898},"sJ8bj","  \u003C!-- [...] -->\n",[45,2901,2902,2904,2906,2908,2910,2913,2916,2918],{"class":47,"line":313},[45,2903,1280],{"class":51},[45,2905,45],{"class":1116},[45,2907,1268],{"class":55},[45,2909,1123],{"class":51},[45,2911,2912],{"class":62},"\"cell day blank\"",[45,2914,2915],{"class":51},">\u003C/",[45,2917,45],{"class":1116},[45,2919,1134],{"class":51},[45,2921,2922,2924,2926,2928,2930,2932,2934,2936],{"class":47,"line":323},[45,2923,1280],{"class":51},[45,2925,45],{"class":1116},[45,2927,1268],{"class":55},[45,2929,1123],{"class":51},[45,2931,2912],{"class":62},[45,2933,2915],{"class":51},[45,2935,45],{"class":1116},[45,2937,1134],{"class":51},[45,2939,2940,2942,2944,2946,2948,2951,2954,2956,2959,2961,2963,2965],{"class":47,"line":333},[45,2941,1280],{"class":51},[45,2943,45],{"class":1116},[45,2945,1268],{"class":55},[45,2947,1123],{"class":51},[45,2949,2950],{"class":62},"\"cell day\"",[45,2952,2953],{"class":51},">\u003C",[45,2955,45],{"class":1116},[45,2957,2958],{"class":51},">1\u003C/",[45,2960,45],{"class":1116},[45,2962,2915],{"class":51},[45,2964,45],{"class":1116},[45,2966,1134],{"class":51},[45,2968,2969,2971,2973,2975,2977,2979,2981,2983,2986,2988,2990,2992],{"class":47,"line":343},[45,2970,1280],{"class":51},[45,2972,45],{"class":1116},[45,2974,1268],{"class":55},[45,2976,1123],{"class":51},[45,2978,2950],{"class":62},[45,2980,2953],{"class":51},[45,2982,45],{"class":1116},[45,2984,2985],{"class":51},">2\u003C/",[45,2987,45],{"class":1116},[45,2989,2915],{"class":51},[45,2991,45],{"class":1116},[45,2993,1134],{"class":51},[45,2995,2996,2998,3000,3002,3004,3006,3008,3010,3013,3015,3017,3019],{"class":47,"line":349},[45,2997,1280],{"class":51},[45,2999,45],{"class":1116},[45,3001,1268],{"class":55},[45,3003,1123],{"class":51},[45,3005,2950],{"class":62},[45,3007,2953],{"class":51},[45,3009,45],{"class":1116},[45,3011,3012],{"class":51},">3\u003C/",[45,3014,45],{"class":1116},[45,3016,2915],{"class":51},[45,3018,45],{"class":1116},[45,3020,1134],{"class":51},[45,3022,3023],{"class":47,"line":1715},[45,3024,2899],{"class":2898},[45,3026,3027,3029,3031,3033,3035,3037,3039,3041,3044,3046,3048,3050],{"class":47,"line":1724},[45,3028,1280],{"class":51},[45,3030,45],{"class":1116},[45,3032,1268],{"class":55},[45,3034,1123],{"class":51},[45,3036,2950],{"class":62},[45,3038,2953],{"class":51},[45,3040,45],{"class":1116},[45,3042,3043],{"class":51},">29\u003C/",[45,3045,45],{"class":1116},[45,3047,2915],{"class":51},[45,3049,45],{"class":1116},[45,3051,1134],{"class":51},[45,3053,3054,3056,3058,3060,3062,3064,3066,3068,3071,3073,3075,3077],{"class":47,"line":1730},[45,3055,1280],{"class":51},[45,3057,45],{"class":1116},[45,3059,1268],{"class":55},[45,3061,1123],{"class":51},[45,3063,2950],{"class":62},[45,3065,2953],{"class":51},[45,3067,45],{"class":1116},[45,3069,3070],{"class":51},">30\u003C/",[45,3072,45],{"class":1116},[45,3074,2915],{"class":51},[45,3076,45],{"class":1116},[45,3078,1134],{"class":51},[45,3080,3081,3083,3085],{"class":47,"line":1736},[45,3082,1318],{"class":51},[45,3084,1552],{"class":1116},[45,3086,1134],{"class":51},[11,3088,3089,3090,3092,3093,3096,3097,3099,3100,3103,3104,3106],{},"The days wrapped in ",[23,3091,45],{}," (e.g., ",[23,3094,3095],{},"16",") are clickable, but the HTML communicates no such actionability. The idiomatic DOM equivalent would instead use ",[23,3098,1117],{}," elements throughout, or at least assign suitable ",[23,3101,3102],{},"role"," attributes like ",[23,3105,1117],{},". A DOM snapshot pipeline leaves space for solving this problem: rewrite the virtual DOM with idiomatic elements.",[36,3108,3110],{"className":1104,"code":3109,"language":1106,"meta":41,"style":41},"  \u003Cbutton class=\"cell day\">29\u003C/button>\n  \u003C!-- OR -->\n  \u003Cspan role=\"button\" class=\"cell day\">30\u003C/button>\n",[23,3111,3112,3130,3135],{"__ignoreMap":41},[45,3113,3114,3116,3118,3120,3122,3124,3126,3128],{"class":47,"line":48},[45,3115,1280],{"class":51},[45,3117,1117],{"class":1116},[45,3119,1268],{"class":55},[45,3121,1123],{"class":51},[45,3123,2950],{"class":62},[45,3125,3043],{"class":51},[45,3127,1117],{"class":1116},[45,3129,1134],{"class":51},[45,3131,3132],{"class":47,"line":69},[45,3133,3134],{"class":2898},"  \u003C!-- OR -->\n",[45,3136,3137,3139,3141,3144,3146,3148,3150,3152,3154,3156,3158],{"class":47,"line":106},[45,3138,1280],{"class":51},[45,3140,45],{"class":1116},[45,3142,3143],{"class":55}," role",[45,3145,1123],{"class":51},[45,3147,1669],{"class":62},[45,3149,1268],{"class":55},[45,3151,1123],{"class":51},[45,3153,2950],{"class":62},[45,3155,3070],{"class":51},[45,3157,1117],{"class":1116},[45,3159,1134],{"class":51},[15,3161,3163],{"id":3162},"choosing-between-snapshot-representations","Choosing Between Snapshot Representations",[11,3165,3166],{},"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:",[424,3168,3169,3181,3187,3193],{},[427,3170,3171,3174,3175,3177,3178,3180],{},[850,3172,3173],{},"Route Modality."," Fall back to GUI snapshots if the UI is based on ",[23,3176,1029],{}," or cross-origin ",[23,3179,1025],{}," elements; use DOM snapshots by default.",[427,3182,3183,3186],{},[850,3184,3185],{},"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.",[427,3188,3189,3192],{},[850,3190,3191],{},"Scope Escalation."," If elicited action suggestions are unusable, widen the snapshot scope and representation richness.",[427,3194,3195,3198],{},[850,3196,3197],{},"Cascade to Hybrid."," If elicited action suggestions are still unusable, augment the rich DOM snapshot with a GUI snapshot for maximum grounding.",[3200,3201,3202,3224],"table",{},[3203,3204,3205],"thead",{},[3206,3207,3208,3212,3215,3218,3221],"tr",{},[3209,3210],"th",{"align":3211},"left",[3209,3213,3214],{},"GUI",[3209,3216,3217],{},"grounded",[3209,3219,3220],{},"DOM",[3209,3222,3223],{},"transformed",[3225,3226,3227,3250,3271,3294,3313,3334],"tbody",{},[3206,3228,3229,3233,3238,3242,3245],{},[3230,3231,3232],"td",{"align":3211},"LLM Input Tokens",[3230,3234,3235],{},[850,3236,3237],{},"Low",[3230,3239,3240],{},[850,3241,3237],{},[3230,3243,3244],{},"High",[3230,3246,3247,3249],{},[850,3248,3237],{}," to Moderate",[3206,3251,3252,3255,3258,3263,3267],{},[3230,3253,3254],{"align":3211},"Element Targeting",[3230,3256,3257],{},"Absolute",[3230,3259,3260],{},[850,3261,3262],{},"Relative",[3230,3264,3265],{},[850,3266,3262],{},[3230,3268,3269],{},[850,3270,3262],{},[3206,3272,3273,3276,3282,3286,3290],{},[3230,3274,3275],{"align":3211},"Snapshot Scope",[3230,3277,3278,3281],{},[850,3279,3280],{},"Free","/Viewport",[3230,3283,3284,3281],{},[850,3285,3280],{},[3230,3287,3288],{},[850,3289,3280],{},[3230,3291,3292],{},[850,3293,3280],{},[3206,3295,3296,3299,3302,3304,3309],{},[3230,3297,3298],{"align":3211},"Snapshot Context",[3230,3300,3301],{},"UI",[3230,3303,3301],{},[3230,3305,3306],{},[850,3307,3308],{},"Full",[3230,3310,3311],{},[850,3312,3308],{},[3206,3314,3315,3320,3325,3329,3332],{},[3230,3316,3317,3319],{"align":3211},[23,3318,1025],{}," Context",[3230,3321,3322],{},[850,3323,3324],{},"Viewport",[3230,3326,3327],{},[850,3328,3324],{},[3230,3330,3331],{},"Same-origin only",[3230,3333,3331],{},[3206,3335,3336,3340,3345,3349,3352],{},[3230,3337,3338,3319],{"align":3211},[23,3339,1029],{},[3230,3341,3342],{},[850,3343,3344],{},"Yes",[3230,3346,3347],{},[850,3348,3344],{},[3230,3350,3351],{},"No",[3230,3353,3351],{},[15,3355,3357],{"id":3356},"using-snapshots-in-the-model-context","Using Snapshots In the Model Context",[11,3359,3360],{},"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,3362,3363],{},"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.",[15,3365,3367],{"id":3366},"timing-snapshots-in-the-web-client","Timing Snapshots In the Web Client",[11,3369,3370,3371,790],{},"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",[973,3372,3373],{},[857,3374,3378],{"href":3375,"ariaDescribedBy":3376,"dataFootnoteRef":41,"id":3377},"#user-content-fn-5",[979],"user-content-fnref-5","5",[792,3380],{},[11,3382,3383,3384,790],{},"The snapshot is the central artefact in a web agent harness. Its representation is among the most significant factors for agent success",[973,3385,3386],{},[857,3387,3391],{"href":3388,"ariaDescribedBy":3389,"dataFootnoteRef":41,"id":3390},"#user-content-fn-6",[979],"user-content-fnref-6","6",[11,3393,3394,3395,3397],{},"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 ",[23,3396,1025],{}," boundaries, etc.",[1265,3399,3402,3407],{"className":3400,"dataFootnotes":41},[3401],"footnotes",[15,3403,3406],{"className":3404,"id":979},[3405],"sr-only","Footnotes",[424,3408,3409,3424,3436,3448,3474,3486],{},[427,3410,3412,3416,3417],{"id":3411},"user-content-fn-1",[857,3413,3414],{"href":3414,"rel":3415},"https://arxiv.org/abs/2310.11441",[861]," ",[857,3418,3423],{"href":3419,"ariaLabel":3420,"className":3421,"dataFootnoteBackref":41},"#user-content-fnref-1","Back to reference 1",[3422],"data-footnote-backref","↩",[427,3425,3427,3416,3431],{"id":3426},"user-content-fn-2",[857,3428,3429],{"href":3429,"rel":3430},"https://github.com/webfuse-com/D2Snap/blob/main/snapshots/_bu.js",[861],[857,3432,3423],{"href":3433,"ariaLabel":3434,"className":3435,"dataFootnoteBackref":41},"#user-content-fnref-2","Back to reference 2",[3422],[427,3437,3439,3416,3443],{"id":3438},"user-content-fn-3",[857,3440,3441],{"href":3441,"rel":3442},"https://arxiv.org/abs/2210.03945",[861],[857,3444,3423],{"href":3445,"ariaLabel":3446,"className":3447,"dataFootnoteBackref":41},"#user-content-fnref-3","Back to reference 3",[3422],[427,3449,3451,3416,3455,3416,3460,3416,3467],{"id":3450},"user-content-fn-4",[857,3452,3453],{"href":3453,"rel":3454},"https://arxiv.org/abs/2508.04412",[861],[857,3456,3423],{"href":3457,"ariaLabel":3458,"className":3459,"dataFootnoteBackref":41},"#user-content-fnref-4","Back to reference 4",[3422],[857,3461,3423,3465],{"href":3462,"ariaLabel":3463,"className":3464,"dataFootnoteBackref":41},"#user-content-fnref-4-2","Back to reference 4-2",[3422],[973,3466,1003],{},[857,3468,3423,3472],{"href":3469,"ariaLabel":3470,"className":3471,"dataFootnoteBackref":41},"#user-content-fnref-4-3","Back to reference 4-3",[3422],[973,3473,1018],{},[427,3475,3477,3416,3481],{"id":3476},"user-content-fn-5",[857,3478,3479],{"href":3479,"rel":3480},"https://github.com/webfuse-com/DOMQuake",[861],[857,3482,3423],{"href":3483,"ariaLabel":3484,"className":3485,"dataFootnoteBackref":41},"#user-content-fnref-5","Back to reference 5",[3422],[427,3487,3489,3416,3493],{"id":3488},"user-content-fn-6",[857,3490,3491],{"href":3491,"rel":3492},"https://arxiv.org/abs/2504.01382",[861],[857,3494,3423],{"href":3495,"ariaLabel":3496,"className":3497,"dataFootnoteBackref":41},"#user-content-fnref-6","Back to reference 6",[3422],[801,3499,3500],{},"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":41,"searchDepth":69,"depth":69,"links":3502},[3503,3507,3513,3514,3515,3516,3517],{"id":884,"depth":69,"text":885,"children":3504},[3505,3506],{"id":907,"depth":106,"text":908},{"id":945,"depth":106,"text":946},{"id":1006,"depth":69,"text":1007,"children":3508},[3509,3510,3511,3512],{"id":1036,"depth":106,"text":1037},{"id":1060,"depth":106,"text":1061},{"id":1970,"depth":106,"text":1971},{"id":1994,"depth":106,"text":1995},{"id":2719,"depth":69,"text":2720},{"id":3162,"depth":69,"text":3163},{"id":3356,"depth":69,"text":3357},{"id":3366,"depth":69,"text":3367},{"id":979,"depth":69,"text":3406},"2025-08-28","Explore methods for serialising web user interfaces into representations for use with LLM-based web agents.",{"homepage":824,"relatedLinks":3521},[3522,3525],{"text":3523,"href":3524},"DOM Downsampling for LLM-Based Web Agents","/rnd/dom-downsampling-for-llm-based-web-agents",{"text":828,"href":829,"external":824},"/blog/serialising-web-ui-state-for-llms-the-complete-guide",{"title":843,"description":3519},{"loc":3526},"blog/1012.serialising-web-ui-state-for-llms-the-complete-guide",[819,835,836,3531,3532],"llms","snapshots","285N3vlYQ11bTzTvFK8_1nz5QJDIUJu6BDSVzk1WFW0",{"id":3535,"title":3536,"authorId":6,"body":3537,"category":819,"created":4011,"description":4012,"extension":822,"faqs":823,"featurePriority":823,"head":823,"hideCta":824,"landingPath":823,"meta":4013,"navigation":824,"ogImage":823,"path":4019,"robots":823,"schemaOrg":823,"seo":4020,"sitemap":4021,"stem":4022,"tags":4023,"__hash__":4025},"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":3538,"toc":3992},[3539,3556,3560,3568,3573,3576,3580,3583,3603,3607,3616,3620,3636,3641,3644,3648,3659,3663,3666,3670,3677,3681,3704,3708,3712,3715,3718,3722,3743,3746,3750,3754,3763,3774,3778,3782,3791,3794,3798,3801,3804,3808,3820,3823,3827,3836,3839,3844,3848,3851,3855,3859,3862,3936,3938,3941,3955],[11,3540,3541,763,3546,763,3550,3555],{},[857,3542,3545],{"href":3543,"rel":3544},"https://openai.com/index/introducing-operator/",[861],"Operator",[857,3547,994],{"href":3548,"rel":3549},"https://browser-use.com/",[861],[857,3551,3554],{"href":3552,"rel":3553},"https://www.skyvern.com/",[861],"Skyvern"," – we are currently witnessing an evolution of autonomous web browsing agents. The concept of agents is ubiquitous in the era of AI.",[15,3557,3559],{"id":3558},"what-is-an-agent","What is an Agent?",[11,3561,3562,3563,790],{},"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",[973,3564,3565],{},[857,3566,275],{"href":977,"ariaDescribedBy":3567,"dataFootnoteRef":41,"id":980},[979],[147,3569],{"alt":3570,"loading":150,"src":3571,"provider":151,":width":3572},"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,3574,3575],{},"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.",[154,3577,3579],{"id":3578},"what-makes-an-agent-intelligent","What Makes an Agent Intelligent?",[11,3581,3582],{},"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:",[2043,3584,3585,3591,3597],{},[427,3586,3587,3590],{},[850,3588,3589],{},"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.",[427,3592,3593,3596],{},[850,3594,3595],{},"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.",[427,3598,3599,3602],{},[850,3600,3601],{},"Neural networks"," – the agent has no model, only examples: a network is fitted to task–solution instances and generalises to unseen, yet related tasks.",[154,3604,3606],{"id":3605},"a-quick-note-on-multi-agent-systems","A Quick Note on Multi-Agent Systems",[11,3608,3609,3610,3615],{},"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 ",[857,3611,3614],{"href":3612,"rel":3613},"https://cs.stanford.edu/people/eroberts/courses/soco/projects/2003-04/intelligent-search/minimax.html",[861],"Minimax algorithm","), as opposed to random world changes. That said, web browsing – modelled after humans – is not a typical multi-agent scenario.",[154,3617,3619],{"id":3618},"the-agent-loop","The Agent Loop",[11,3621,3622,3627,3628,3635],{},[857,3623,3626],{"href":3624,"rel":3625},"https://www.nngroup.com/people/don-norman/",[861],"Don Norman","'s ",[857,3629,3632],{"href":3630,"rel":3631},"https://jnd.org/books/the-design-of-everyday-things-revised-and-expanded-edition/",[861],[376,3633,3634],{},"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.",[147,3637],{"alt":3638,"loading":150,"src":3639,"provider":151,":width":3640},"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,3642,3643],{},"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).",[154,3645,3647],{"id":3646},"errors-and-recovery","Errors and Recovery",[11,3649,3650,3651,3654,3655,3658],{},"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 ",[376,3652,3653],{},"Gulf of Action (Execution)"," – how to act in the world? – and when perceiving world state; the ",[376,3656,3657],{},"Gulf of Perception (Evaluation)"," – how to understand the world?",[147,3660],{"alt":3661,"loading":150,"src":3662,"provider":151,":width":3640},"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,3664,3665],{},"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.",[15,3667,3669],{"id":3668},"web-browsing-agents","Web Browsing Agents",[11,3671,3672,3673,3676],{},"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 ",[23,3674,3675],{},"(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.",[154,3678,3680],{"id":3679},"web-browsing-is-all-about-the-journey","Web Browsing is All About the Journey",[11,3682,3683,3684,3687,3688,3693,3694,3699,3700,3703],{},"A web browsing task is any task that can be solved through a web-based user interface (UI). For instance: ",[376,3685,3686],{},"\"Book the cheapest flight from Amsterdam to New York tomorrow night\""," on ",[857,3689,3692],{"href":3690,"rel":3691},"https://www.klm.com",[861],"klm.com",". Application programming interfaces (APIs; e.g., ",[857,3695,3698],{"href":3696,"rel":3697},"https://www.ibm.com/think/topics/rest-apis",[861],"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 ",[23,3701,3702],{},"Ctrl + F",", whilst journey-driven agents are supposed to browse a web application in human fashion, via the application-native UI.",[147,3705],{"alt":3706,"loading":150,"src":3707},"A depiction of a web journey over three web application UI states","/blog/a-gentle-introduction-to-ai-agents-for-the-web/4.png",[154,3709,3711],{"id":3710},"a-formal-model-for-web-browsing","A Formal Model for Web Browsing",[11,3713,3714],{},"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,3716,3717],{},"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).",[147,3719],{"alt":3720,"loading":150,"src":3721},"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,3723,3724,3725,3730,3731,3736,3737,3742],{},"Yet, many web applications lack ",[857,3726,3729],{"href":3727,"rel":3728},"https://www.nngroup.com/articles/ten-usability-heuristics/#toc-1-visibility-of-system-status-1",[861],"visibility of system status"," – against ",[857,3732,3735],{"href":3733,"rel":3734},"https://www.nngroup.com/people/jakob-nielsen/",[861],"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)",[973,3738,3739],{},[857,3740,1003],{"href":1000,"ariaDescribedBy":3741,"dataFootnoteRef":41,"id":1002},[979],", adapting to discovered UI states, where states can be tuples of UI state trajectories to contain history.",[11,3744,3745],{},"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.",[147,3747],{"alt":3748,"loading":150,"src":3749},"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",[154,3751,3753],{"id":3752},"llm-sensors-actuators-agent","LLM + Sensors + Actuators = Agent",[11,3755,3756,3757,3762],{},"Conversationally satisfying simple information requests does not reasonably qualify an LLM as an agent – no more than it would a TF-IDF search system",[973,3758,3759],{},[857,3760,1018],{"href":1015,"ariaDescribedBy":3761,"dataFootnoteRef":41,"id":1017},[979],", 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,3764,3765,3766,763,3768,763,3770,3773],{},"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: ",[376,3767,459],{},[376,3769,421],{},[376,3771,3772],{},"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.",[147,3775],{"alt":3776,"loading":150,"src":3777,"provider":151,":width":878},"Figurative depiction of components in the agent loop","/blog/a-gentle-introduction-to-ai-agents-for-the-web/7.svg",[154,3779,3781],{"id":3780},"snapshots-serialised-ui-state","Snapshots – Serialised UI State",[11,3783,3784,3785,3790],{},"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",[973,3786,3787],{},[857,3788,1497],{"href":1494,"ariaDescribedBy":3789,"dataFootnoteRef":41,"id":1496},[979],". 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,3792,3793],{},"Outcome-driven web agents have used UI-invasive snapshot measures, such as grounding LLMs with bounding boxes around actionable elements.",[147,3795],{"alt":3796,"loading":150,"src":3797},"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,3799,3800],{},"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,3802,3803],{},"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?",[154,3805,3807],{"id":3806},"targeting-action-suggestions","Targeting – Action Suggestions",[11,3809,3810,3811,763,3813,3815,3816,3819],{},"An action is a user event, such as ",[376,3812,378],{},[376,3814,662],{},", or ",[376,3817,3818],{},"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,3821,3822],{},"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.",[154,3824,3826],{"id":3825},"the-agent-harness","The Agent Harness",[11,3828,3829,3830,3835],{},"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. ",[857,3831,3834],{"href":3832,"rel":3833},"https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents",[861],"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,3837,3838],{},"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.",[147,3840],{"alt":3841,"loading":150,"src":3842,"provider":3843},"Don Norman's Seven Stages of Action mapped to the agentic web browsing proble","/blog/a-gentle-introduction-to-ai-agents-for-the-web/9.svg","none\"",[154,3845,3847],{"id":3846},"the-model-context-protocol","The Model Context Protocol",[11,3849,3850],{},"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.",[147,3852],{"alt":3853,"loading":150,"src":3854,"provider":151,":width":3640},"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",[154,3856,3858],{"id":3857},"web-browser-environments","Web Browser Environments",[11,3860,3861],{},"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:",[2043,3863,3864,3879,3892,3904],{},[427,3865,3866,3869,3870,3873,3874],{},[850,3867,3868],{},"Agentic browser"," – the agent's UI embeds a browser.",[3871,3872],"br",{},"\nExample: ",[857,3875,3878],{"href":3876,"rel":3877},"https://www.perplexity.ai/comet",[861],"Perplexity Comet",[427,3880,3881,3884,3885,3873,3887],{},[850,3882,3883],{},"Cloud browser"," – the agent spins up a browser in the cloud.",[3871,3886],{},[857,3888,3891],{"href":3889,"rel":3890},"https://www.browserbase.com",[861],"Browserbase",[427,3893,3894,3897,3898,3873,3900],{},[850,3895,3896],{},"Local browser (3rd-party browser)"," – the agent spins up an isolated browser locally.",[3871,3899],{},[857,3901,3903],{"href":859,"rel":3902},[861],"Chromium + Playwright",[427,3905,3906,3909,3910],{},[850,3907,3908],{},"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",[2043,3911,3912,3925],{},[427,3913,3914,3917,3918,3873,3920],{},[850,3915,3916],{},"Implemented (1st-party app)"," – served directly through the website.",[3871,3919],{},[857,3921,3924],{"href":3922,"rel":3923},"https://www.cognigy.com/platform/ai-agent-studio",[861],"Cognigy Studio",[427,3926,3927,3930,3931,3873,3933],{},[850,3928,3929],{},"Augmented (3rd-party app)"," – served indirectly through a website proxy.",[3871,3932],{},[857,3934,867],{"href":865,"rel":3935},[861],[792,3937],{},[11,3939,3940],{},"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,3942,3943,3944,3949,3950,790],{},"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 ",[857,3945,3948],{"href":3946,"rel":3947},"https://claude.com/",[861],"Claude",", or shipping ",[857,3951,3954],{"href":3952,"rel":3953},"https://github.com/webfuse-com/extension-elevenlabs-mcp",[861],"perceive-and-act-ready chatbots",[1265,3956,3958,3961],{"className":3957,"dataFootnotes":41},[3401],[15,3959,3406],{"className":3960,"id":979},[3405],[424,3962,3963,3972,3978,3984],{},[427,3964,3965,3416,3969],{"id":3411},[857,3966,3967],{"href":3967,"rel":3968},"https://inst.eecs.berkeley.edu/~cs188/textbook/textbook_full.pdf",[861],[857,3970,3423],{"href":3419,"ariaLabel":3420,"className":3971,"dataFootnoteBackref":41},[3422],[427,3973,3974,3975],{"id":3426},"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. ",[857,3976,3423],{"href":3433,"ariaLabel":3434,"className":3977,"dataFootnoteBackref":41},[3422],[427,3979,3980,3981],{"id":3438},"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. ",[857,3982,3423],{"href":3445,"ariaLabel":3446,"className":3983,"dataFootnoteBackref":41},[3422],[427,3985,3986,3416,3989],{"id":3450},[857,3987,3441],{"href":3441,"rel":3988},[861],[857,3990,3423],{"href":3457,"ariaLabel":3458,"className":3991,"dataFootnoteBackref":41},[3422],{"title":41,"searchDepth":69,"depth":69,"links":3993},[3994,4000,4010],{"id":3558,"depth":69,"text":3559,"children":3995},[3996,3997,3998,3999],{"id":3578,"depth":106,"text":3579},{"id":3605,"depth":106,"text":3606},{"id":3618,"depth":106,"text":3619},{"id":3646,"depth":106,"text":3647},{"id":3668,"depth":69,"text":3669,"children":4001},[4002,4003,4004,4005,4006,4007,4008,4009],{"id":3679,"depth":106,"text":3680},{"id":3710,"depth":106,"text":3711},{"id":3752,"depth":106,"text":3753},{"id":3780,"depth":106,"text":3781},{"id":3806,"depth":106,"text":3807},{"id":3825,"depth":106,"text":3826},{"id":3846,"depth":106,"text":3847},{"id":3857,"depth":106,"text":3858},{"id":979,"depth":69,"text":3406},"2025-06-15","Get an idea of agents and how to build AI agents that browse the web: key concepts, terminology, and challenges.",{"homepage":824,"relatedLinks":4014},[4015,4017,4018],{"text":4016,"href":3526},"Serialising Web UI State for LLMs",{"text":3523,"href":3524},{"text":828,"href":829,"external":824},"/blog/a-gentle-introduction-to-ai-agents-for-the-web",{"title":3536,"description":4012},{"loc":4019},"blog/1011.a-gentle-introduction-to-ai-agents-for-the-web",[819,4024,835,836,3531],"browser-agents","eIZdr4_B1-ptgNA1m1a9XagYCif9cYLlCXkgWdLl09U",1794323827510]