Beyond Browsing: API -Based Web Agents (2025)

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 web agents use browsers as an interface to facilitate humans in performing daily tasks such as online shopping, online planning, trip planning, and other work-related tasks @xcite @xcite @xcite @xcite . existing web agents typically operate within the space of graphical user interfaces (gui) @xcite @xcite , using action spaces that simulate human-like keyboard and mouse operations, such as clicking and typing. to observe webpages, common approaches include using accessibility trees, a simplified version of the html dom tree, as input to text-based models @xcite , or multi-modal, screenshotbased models @xcite @xcite . however, regardless of the interaction method with websites, there is no getting around the fact that these sites were originally designed for humans, and may not be the ideal interface for machines. notably, there is another interface designed specifically for machine interaction with the web: application programming interfaces (apis) @xcite . apis allow machines to communicate directly with backends of web services @xcite , sending and receiving data in machine-friendly formats such as json or xml @xcite @xcite . nonetheless, whether ai agents can effectively use apis to tackle real-world online tasks, and the conditions under which this is possible, remain unstudied. in this work, we explore methods for tackling tasks normally framed as webnavigation tasks with an expanded action space to interact with apis. to do so, we develop new api-based agents that directly interact with web services via api calls. this method bypasses the need to interact with web guis. however, not all websites have extensive api support, in which case web browsing actions may still be required. to overcome this limitation, we propose a hybrid approach that combines api-based agents with browsing agents, as depicted in figure 1 . rather than choosing between api calling and web browsing at the task level, our hybrid agent is capable of dynamically interleaving both actions. we found that agents benefit from the flexibility of this hybrid model. when apis are available and well-documented, the agent can directly interact with the web services. for websites with limited api support, the agent seamlessly in-figure 1 : the browsing agent performs tasks through browsing only, utilizing the accessibility tree to interact with webpages, achieving an average performance of 14.8% on webarena. without reliance on web browsing, the api-based agent performs tasks by making api calls and generating code without relying on web browsing, achieving an average accuracy of 29.2%. dynamically interleaving web browsing and api calling, the hybrid agent executes either api calls or browsing actions, or combining both, achieving performance of 38.9%. we evaluated our api-based and hybrid agents on webarena, a benchmark for real-world web tasks @xcite , and the results are shown in figure 1 . our experiments revealed three key findings: (1) the api-based agent outperforms the browsing agent on webarena by around 15% on average. (2) the api-based agent yields a higher success rate on websites with good api support (e.g., gitlab) compared to those with limited api support (e.g., reddit). this result underscores the importance of developing comprehensive api support for more accurate and efficient web task automation in the future. (3) the hybrid agent outperforms solely browsing and solely api-based agents, further improving accuracy by 10% compared to the api-based agent. by dynamically interleaving approaches, the hybrid agent is able to provide more consistent and reliable outcomes. in sum, our results suggest that allowing agents to interact with apis, interfaces designed specifically for machines is often preferable or at least complementary to direct interaction with graphical interfaces designed for humans. in this paper, we focus on webarena tasks, which simulate real-world scenarios to evaluate an agent's ability to complete diverse web-based activities. foot_0 webarena tasks include interacting with platforms like gitlab (to manage projects and repositories), reddit (to browse and post content), e-commerce websites (for shopping), and mapping services (for trip planning) @xcite . task success is evaluated in three ways: (1) if the task requires producing specific outputs, agents' responses are checked for correctness; (2) for tasks involving changes to a website's state (e.g., adding items to shopping carts), success is verified by whether the state has changed as expected, such as ensuring the correct items have been added to the cart; and (3) if the task involves navigation, success is determined by whether the agent reaches the correct url displaying the desired content. ## from web browsing to api calling in contrast, api calling allows machines to directly communicate with web services, reducing operational complexity. in this section, we explore an api-based approach when performing web tasks. ## hybrid browsing+api calling agents we have proposed api-based methods for handling web tasks, but the question arises: given the benefits of api calling, should we discard browsing altogether? the most obvious bottleneck is that not all websites offer good api support. some platforms offer limited or poorly documented apis (e.g. no api for shopping on amazon foot_7 ), forcing agents to rely on browsing to complete tasks. to deal with these situations, we propose a hybrid methods that integrates both browsing and api calling, and developed a hybrid agent capable of dynamically interleaving api calls and web browsing based on task requirements and the available resources. specifically, for each task, the agent is given the fixed step budget within which it has to finish the task. in each step of a task, the agent could either (1) communicate with humans in natural language to ask for clarification, or 2) generate and executes python code which could include performing api calling, or 3) performs web browsing actions. the hybrid agent could choose freely among these options, depending on the agent's confidence in which method is the best for each step. ideally, for websites with good api support, the hybrid agent can utilize well-documented apis to perform tasks more efficiently than it could through only browsing; for websites with limited api support or poor documentation, the hybrid agent could rely more on browsing. we find that enabling it to interleave api calling and web browsing boosts task performance (see section 6). ## conclusion in this paper, we propose new web agents that use apis instead of traditional browsers. we find that api-based agents outperform browsing agents, especially on websites with good api support. thus we further propose hybrid agents capable of interleaving api calling and browsing that empirically outperforms agents that only use one of the two interfaces.