Lesson 10.07 · Phase 10 · Coding & Computer-Use Agents

Browser agents

A browser agent doesn't read HTML. It reads a snapshot: the page's interactive elements as a numbered list, plus its visible text. It acts by number: click [5], type into [2]. Everything on the page is written by someone else, so the snapshot drops hidden content, fences visible text off as untrusted, rejects refs from old snapshots, and the browser enforces an allow-list of sites and asks before anything that spends money.

Learning objectives

  • Turn HTML into a compact snapshot of numbered interactive elements and visible text, dropping hidden content.
  • Implement navigate, click, type and select against element refs, with stale-ref detection.
  • Contain prompt injection from page content: untrusted text fencing, a site allow-list, and approval for consequential actions.
  • Compare DOM/accessibility snapshots with screenshot-based control (Lesson 8).

Raw HTML is the wrong input for a model. A flight results page is 300 KB of markup, scripts and tracking pixels around 2 KB of content. Give the model the HTML and it runs out of context. Give it only the text and it can't tell which "Book" belongs to which flight.

Loading the full lesson…