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