Abstract
Web browsers are a portal to the internet, where much of human activity is undertaken. Thus, there has been significant research work in AI agents that interact with the internet through web browsing. However, there is also another interface designed specifically for machine interaction with online content: application programming interfaces (APIs). In this paper we ask – what if we were to take tasks traditionally tackled by Browsing Agents, and give AI agents access to APIs? To do so, we propose two varieties of agents: (1) an API-calling agent that attempts to perform online tasks through APIs only, similar to traditional coding agents, and (2) a Hybrid Agent that can interact with online data through both web browsing and APIs. In experiments on WebArena, a widely-used and realistic benchmark for web navigation tasks, we find that API-Based Agents outperform web Browsing Agents. Hybrid Agents out-perform both others nearly uniformly across tasks, resulting in a more than 24.0% absolute improvement over web browsing alone, achieving a success rate of 38.9%, the SOTA performance among task-agnostic agents. These results strongly suggest that when APIs are available, they present an attractive alternative to relying on web browsing alone.
Introduction
The prevailing paradigm for web agents involves teaching Large Language Models (LLMs) to navigate the internet as humans do—by interpreting accessibility trees or screenshots and simulating GUI interactions like clicking and scrolling. However, websites are optimized for human perception, not machine logic. This "human-centric" interface often introduces unnecessary operational complexity for AI agents. For instance, a simple data retrieval task might require multiple pages of scrolling and clicking, exhausting an agent's step budget. This research explores a machine-native alternative: interacting with web services directly via Application Programming Interfaces (APIs).
Agent Architectures and Methodology
We introduce two novel agent frameworks to contrast with traditional browsing-only agents:
- API-Based Agent: This agent functions similarly to a coding assistant. It generates Python code using the
requestslibrary to interact with backend APIs, bypassing the graphical user interface (GUI) entirely. - Hybrid Agent: This model combines both capabilities, dynamically deciding whether to use an API call or a browsing action (e.g., clicking a button) at each step of the task.
To handle the vast number of potential API endpoints without exceeding the LLM's context window, we implemented a Two-Stage Documentation Retrieval system. The agent first reviews a high-level summary of available APIs and then retrieves detailed documentation only for the specific endpoints it identifies as relevant to the task.
Experimental Results
The agents were evaluated on WebArena, a benchmark simulating real-world environments including GitLab, OpenStreetMap, Reddit, and e-commerce platforms.
The results demonstrate a significant performance leap. While the traditional browsing-only agent achieved a 14.8% success rate, the API-only agent reached 29.2%. The Hybrid Agent set a new state-of-the-art (SOTA) for task-agnostic agents with a 38.9% success rate—a 24.1% absolute improvement over browsing alone.
On the GitLab tasks—where API support is robust—the API-based agent achieved 43.9% accuracy compared to just 12.8% for the browsing agent. Even more impressively, the Hybrid Agent outperformed both "pure" versions nearly everywhere, proving that the flexibility to interleave browsing and API calls is the most robust strategy.
Efficiency via Abstraction
The primary advantage of APIs is their ability to collapse multi-step UI interactions into single, programmatic requests. This abstraction prevents agents from getting lost in the "operational noise" of a website's frontend.
As illustrated in the execution traces, a task requiring 15 steps of scrolling and clicking in a browser can often be resolved with just a few lines of Python code. However, APIs are not a silver bullet; some specific frontend features may lack backend API support. The Hybrid Agent's success stems from its ability to use APIs for efficiency while falling back to browsing for tasks that require GUI interaction.
Conclusion and Future Work
Our findings suggest that the human-centric web is a significant bottleneck for AI capability. Moving forward, the focus should shift toward making web services more machine-readable. A key challenge remains API availability and documentation. Future research will explore Automatic Web API Mining (AWM) to allow agents to autonomously discover and document APIs by inspecting network traffic, potentially scaling this approach to the broader web without manual intervention.
Summary updated