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