logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·01.11.26
← Back to news

Show HN: Reverse-engineering web apps into agent tools

View on HN
43 points|19 comments|by pancomplex|Jul 9, 2026

Transforming Web Applications into Agentic Tools

The current state of AI agents interacting with the web is, frankly, suboptimal. While we have seen a surge in "browser agents," the prevailing methodology relies on simulating a human user—clicking buttons, scrolling through pages, and scraping the DOM. This approach is effective fundamentally flawed.

The Core Problem: The "DOM Trap"

Most agents use tools like Playwright or Puppeteer to "see" a website. However, relying on the Document Object Model (DOM) introduces several critical failure points:

  1. Fragility: A single CSS class change can break a selector, rendering the agent blind.
  2. Latency: Loading full HTML pages and executing JavaScript is agonizingly slow.
  3. Token Bloat: Feeding raw HTML into a Large Language Model (LLM) consumes massive amounts of context window, increasing costs and decreasing reasoning quality.

"The DOM is essentially a lie; it is a presentation layer. The real truth of a web application lives in the network tab."

A Better Way: Reverse-Engineering the API

Instead of pretending to be a human with a mouse, we can treat web applications as what they actually are: front-ends for internal APIs. By reverse-engineering these apps, we can convert a visual interface into a set of structured tools (JSON schemas) that an LLM can call directly.

The Workflow Process

The transition from a website to a tool follows a specific pipeline:

  1. Observation: The user performs the desired action while a proxy captures all outgoing HTTP requests.
  2. Extraction: The system identifies the specific API endpoints, headers, and payloads required to complete the task.
  3. Generalization: An LLM analyzes the captured data to replace specific values (e.g., user_id: "12345") with generic parameters (e.g., user_id: "string").
  4. Deployment: The resulting schema is plugged into the agent's toolset.

Comparison: Browser-Based vs. API-Based Agents

FeatureBrowser-Based (DOM)API-Based (Reverse Engineered)
Execution SpeedSlow (Page Loads)Fast (Direct HTTP)
ReliabilityLow (Brittle Selectors)High (Stable Endpoints)
Token UsageHigh (HTML dumps)Low (JSON payloads)
ComplexityHigh (UI Navigation)Low (Parameter Mapping)

Technical Implementation

To turn a request into a tool, we map the network traffic to a standard tool definition. For example, a request to fetch a user's profile might be transformed into the following:

{
  "name": "get_user_profile",
  "description": "Retrieves detailed profile information for a specific user via internal API",
  "parameters": {
    "type": "object",
    "properties": {
      "user_id": {
        "type": "string",
        "description": "The unique identifier of the user"
      }
    },
    "required": ["user_id"]
  }
}

The Math of Efficiency

If we define the cost of an operation CCC as a function of the number of tokens TTT and the price per token PPP, the browser-based approach is significantly more expensive:

Cbrowser=(Thtml+Tprompt)×PC_{browser} = (T_{html} + T_{prompt}) \times PCbrowser​=(Thtml​+Tprompt​)×P Capi=(Tjson+Tprompt)×PC_{api} = (T_{json} + T_{prompt}) \times PCapi​=(Tjson​+Tprompt​)×P

Since Thtml≫TjsonT_{html} \gg T_{json}Thtml​≫Tjson​, the API approach reduces operational overhead by orders of magnitude.

Getting Started

If you want to begin converting your favorite web apps into tools, follow these steps:

  • Set up a capturing proxy (e.g., Mitmproxy).
  • Record a "Golden Path" session of the desired action.
  • Feed the request/response pairs into an LLM for schema generation.
  • Test the tool via a direct `