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