# Browser Agent

> Drive websites through a structured DOM/accessibility tree and a small action set — faster and more reliable than pixel-level screen control.

- **Category**: Agentic AI
- **Subcategory**: Tool Use & Environment
- **Canonical URL**: https://designpattern.fyi/patterns/browser_agent/

---

## Description
**Intent**: Give an agent web access without raw HTML soup or brittle pixel clicking.

**Context**: You need an agent that fills forms, scrapes competitive data, navigates multi-page checkouts, or researches across many sites — all with no clean API. Raw HTML is too noisy; pixel-level Computer Use is too slow and fragile for routine web work.

**Solution**: A Playwright-backed library exposes structured page state (numbered interactive elements, accessibility tree) and a compact action set (click, type, scroll, navigate). The agent reasons over the structured state and emits actions; the library executes them.


## Use Cases
- The agent must operate websites and a structured DOM/accessibility tree is available.
- Raw HTML is too noisy and pixel-level screen control is too slow or brittle for the target.
- A small action vocabulary (click, type, scroll, navigate) covers the workflow.





## Trade-offs


### Advantages

- Faster and more reliable than pixel-driven Computer Use for web tasks.

- Web-specific abstractions like 'fill form' compose naturally and read clearly in traces.




### Considerations & Drawbacks

- Still struggles with heavily dynamic JS-rendered apps where the accessibility tree is a mess.

- Anti-bot measures and CAPTCHAs break the loop and are hard to recover from gracefully.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/browser-agent/)

