AI in Software Development: Why Web Pages Need Machine-Readable Capabilities for the Last Mile

    This article examines why AI coding tools still struggle to reliably operate real-world web systems, and how structured, machine-readable capability interfaces can close the gap. It explains the limits of pixel- and DOM-based automation, outlines four design constraints for registering callable tools on a page, and covers key engineering concerns such as capability granularity, idempotency, least-privilege exposure, observability, and versioning. It also discusses how this shift moves developer focus from writing implementations to defining correct problems and stable contracts, along with a practical action checklist for teams.

    1. Framing the Right Question: Not “Can It Write Code?” but “Can It Reliably Drive a System?”

    Debates about whether AI coding tools can fully take over development often miss the point. Code generation is only one link in the software delivery chain. The harder problem is getting a model to understand a system that is already running: under what conditions a button on a page becomes clickable, how state changes after submission, and what error is returned on failure. A key observation is that operating web pages through visual recognition and element guessing involves a large amount of luck. That points to the core contradiction: inference based on pixels and tag trees is a probabilistic reconstruction, while engineering requires deterministic contracts.

    A more accurate framing is this: AI can already handle a large amount of coding and refactoring work, but to execute tasks reliably in real business systems, it needs a machine-readable capability description layer. This is also the direction the industry has been converging on: let applications actively declare what can be invoked, instead of making agents reverse-engineer how.

    2. Why “Looking at the Page and Guessing the Structure” Is Unreliable

    Traditional automation relies on three approaches: parsing tag structure, matching text features, and comparing screenshots. Under modern front-end architectures, all three degrade.

    • Uncertain rendering timing: content is generated asynchronously by scripts, and element appearance time, animation intermediate states, and skeleton screens all interfere with locating elements.
    • Decoupled semantics and presentation: the same visual button may be rendered by different components, class names are hashed by build tools, and text is replaced through internationalization.
    • Large state space: the same control behaves completely differently when loading, read-only, lacking permissions, or failing validation, and these branches are rarely reflected in appearance.

    The result is scripts that fail frequently, maintenance costs that exceed the benefits, and any redesign potentially bringing the entire workflow to a halt. Outsourcing uncertainty to “try a few more times” is unacceptable in production environments.

    3. Structured Capability Interfaces: Turning a Web Page into a “Menu”

    A more engineering-oriented alternative is for a page to register a set of type-constrained tools for external callers to use. You can think of a web page as a restaurant: in the past, customers could only stare at pictures and guess the dishes; now the menu clearly states the dish name, ingredients, spiciness, and whether it is sold out. Callers do not need to read implementation code; they only need to decide the invocation order based on names, descriptions, and parameter schemas.

    The following is illustrative registration logic (pseudocode, expressing the pattern only):

    1. // Register a capability that can be discovered by external callers
    2. await navigator.modelContext.registerTool({
    3. name: 'add_todo',
    4. description: 'Add a new item to the todo list on the current page',
    5. inputSchema: {
    6. type: 'object',
    7. properties: {
    8. text: { type: 'string', description: 'Todo content' }
    9. },
    10. required: ['text']
    11. },
    12. execute: async ({ text }) => {
    13. const result = await addTodoToPage(text); // Reuse the page's existing business logic
    14. return { success: true, message: `Added: ${text}` };
    15. }
    16. });

    The key to this design is not the syntax but four constraints: names and descriptions should be intent-oriented rather than implementation-oriented; parameters should use machine-validatable schemas; the execute function should reuse the page’s existing internal logic to avoid building a separate bypass; and return values must be structured, clearly indicating success, failure, and reasons. As long as these four points are met, callers can complete tasks by “reading the documentation, sending a request, and checking the result,” instead of relying on guesswork.

    4. Four Engineering Issues You Cannot Avoid in Practice

    1. Capability Granularity and Idempotency

    A tool should correspond to a complete business intent, not a low-level function. Too fine a granularity traps callers in orchestration hell, while too coarse a granularity makes composition difficult. For write operations, you need to design idempotency keys or deduplication strategies to prevent retries from causing duplicate submissions.

    2. Permissions and Least Exposure

    Not all page capabilities should be exposed externally. It is recommended to dynamically register tools by user role, require secondary confirmation or short-lived tokens for sensitive operations, and perform final validation on the server side—interfaces exposed by the front end are always just entry points, not authorization boundaries.

    3. Observability

    Every invocation should produce structured logs: caller identity, parameter summary, duration, result, and error code. Combined with monitoring alerts and distributed tracing, this makes it possible to distinguish two completely different types of problems: the model choosing the wrong tool and a genuine business failure.

    4. Versioning and Compatibility

    Interface descriptions are essentially contracts; they need versioning and a deprecation period. Changes to description text also affect caller decisions and should be included in the review process, treated the same as code.

    5. Impact on How Development Teams Collaborate

    When a system has a machine-readable capability layer, the marginal cost of test automation, integration, and operations automation drops significantly: regression cases can call tools directly instead of dragging controls; one-off data initialization scripts no longer need to simulate clicks; and automation workflows in customer service and operations scenarios are no longer fragile. It should be noted that this mechanism is still in an early stage, with both specifications and implementations evolving. In the short term it will not be “fully adopted,” so treating it as inevitable infrastructure is safer than treating it as a currently available universal solution.

    What is truly being compressed is low-value boilerplate code and repetitive UI operations; the more valuable capabilities shift to three areas: defining clear problems and acceptance criteria, designing stable domain contracts, and making judgments and providing fallbacks on results. In this sense, AI coding tools do not replace developers; they shift the developer’s focus from “producing an implementation” to “defining what is correct.”

    6. An Action Checklist for Teams

    • Inventory business processes that are frequently automated, and prioritize adding structured descriptions for stable, read-only query capabilities among them.
    • Incorporate tool descriptions into the code review and API documentation system, with clear owners and change processes.
    • Add idempotency, authentication, and auditing for write operations before considering exposing them to external callers.
    • Establish failure classification and retry limits on the caller side to avoid amplifying uncertainty into incidents.
    • If elasticity and concurrency pressure are involved, you can rely on general-purpose capabilities from mainstream cloud platforms, such as container services, message queues, and log monitoring, while keeping the architecture neutral and avoiding binding to a single implementation.

    The conclusion is not mysterious: whether AI can take over programming depends on whether a system is willing to describe its capabilities clearly. Whoever builds solid interface contracts first will be the first to gain the automation dividend.