NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Multi-Agent Approach for REST API Testing with Semantic Graphs and LLM-Driven Inputs

Myeongsoo Kim, Tyler Stennett, Saurabh Sinha, Alessandro Orso · DOI

Abstract

As modern web services increasingly rely on REST APIs, their thorough testing has become crucial. Furthermore, the advent of REST API documentation languages, such as the OpenAPI Specification, has led to the emergence of many black-box REST API testing tools. However, these tools often focus on individual test elements in isolation (e.g., APIs, parameters, values), resulting in lower coverage and less effectiveness in fault detection. To address these limitations, we present AutoRestTest, the first black-box tool to adopt a dependency-embedded multi-agent approach for REST API testing that integrates multi-agent reinforcement learning (MARL) with a semantic property dependency graph (SPDG) and Large Language Models (LLMs). Our approach treats REST API testing as a separable problem, where four agents — API, dependency, parameter, and value agents — collaborate to optimize API exploration. LLMs handle domain-specific value generation, the SPDG model simplifies the search space for dependencies using a similarity score between API operations, and MARL dynamically optimizes the agents' behavior. Our evaluation of AutoRestTest on 12 real-world REST services shows that it outperforms the four leading black-box REST API testing tools, including those assisted by RESTGPT, in terms of code coverage, operation coverage, and fault detection. Notably, AutoRestTest is the only tool able to trigger an internal server error in the Spotify service.

Introduction

The core challenge in REST API testing is the complex web of inter-dependencies between endpoints. To test a specific operation, such as /orders, a tester must first provide valid inputs derived from previous calls, such as a user_id from a /register endpoint. Existing automated tools often struggle with these sequences because they treat parameters in isolation, leading to a high frequency of "400 Bad Request" errors and shallow code exploration. AutoRestTest addresses this by framing API testing as a coordinated multi-agent problem.

The AutoRestTest Framework

AutoRestTest decomposes the testing process into four specialized roles, each managed by a reinforcement learning agent within a Multi-Agent Reinforcement Learning (MARL) architecture.

The AutoRestTest system architecture, illustrating the interaction between the SPDG, specialized agents, and the request generator.

Specialized Agents

  1. Operation Agent: Prioritizes which API endpoint to explore next based on previous success or failure rates.
  2. Dependency Agent: Manages the Semantic Property Dependency Graph (SPDG). It uses word embeddings to calculate similarity between input and output names (e.g., mapping user_id to id), effectively narrowing the search space for valid API sequences.
  3. Parameter Agent: Optimizes the combinations of optional and required parameters to maximize exploration depth.
  4. Value Agent: Acts as the data specialist, deciding whether to reuse previous successful values, generate random data, or leverage a Large Language Model (GPT-3.5 Turbo) for complex, domain-specific inputs.

Coordination via MARL

The system utilizes Value Decomposition Q-learning (VDN) to ensure agents work toward a collective goal. While individual agents receive rewards for successful requests (200 OK), the Operation agent receives a significant bonus for triggering a 500 Internal Server Error, aligning the "team" toward finding critical bugs.

Evaluation and Results

The researchers evaluated AutoRestTest against 12 real-world REST services, including high-traffic APIs like Spotify, FDIC, and OhSome. The tool was compared against four leading baselines: RESTler, EvoMaster, MoRest, and ARAT-RL.

Fault Detection and Coverage

AutoRestTest achieved an average of 58.3% method coverage, outperforming the next best tool by 16 percentage points. In terms of fault detection, the tool identified 42 unique internal server errors, significantly more than its competitors.

Comparison of unique internal server errors detected by AutoRestTest and other state-of-the-art tools across three major services.

One of the most notable results was the testing of the Spotify API. AutoRestTest was the only tool capable of triggering an internal server error in the service. It achieved this by using the LLM to generate a valid 22-character Spotify ID and correctly passing that ID through a sequence of dependent calls identified by the SPDG.

Conclusion

AutoRestTest demonstrates that treating REST API testing as a separable, multi-agent problem significantly improves both coverage and bug detection. By combining the semantic reasoning of SPDGs, the generative power of LLMs, and the optimization capabilities of MARL, the framework overcomes the "isolated testing" limitations of previous tools. Future work will focus on fine-tuning smaller, specialized LLMs to reduce operational costs while maintaining high testing efficacy.

Summary updated

Abstract

As modern web services increasingly rely on REST APIs, their thorough testing has become crucial. Furthermore, the advent of REST API documentation languages, such as the OpenAPI Specification, has led to the emergence of many black-box REST API testing tools. However, these tools often focus on individual test elements in isolation (e.g., APIs, parameters, values), resulting in lower coverage and less effectiveness in fault detection. To address these limitations, we present AutoRestTest, the first black-box tool to adopt a dependency-embedded multi-agent approach for REST API testing that integrates multi-agent reinforcement learning (MARL) with a semantic property dependency graph (SPDG) and Large Language Models (LLMs). Our approach treats REST API testing as a separable problem, where four agents -- API, dependency, parameter, and value agents -- collaborate to optimize API exploration. LLMs handle domain-specific value generation, the SPDG model simplifies the search space for dependencies using a similarity score between API operations, and MARL dynamically optimizes the agents' behavior. Our evaluation of AutoRestTest on 12 real-world REST services shows that it outperforms the four leading black-box REST API testing tools, including those assisted by RESTGPT (which generates realistic test inputs using LLMs), in terms of code coverage, operation coverage, and fault detection. Notably, AutoRestTest is the only tool able to trigger an internal server error in the Spotify service. Our ablation study illustrates that each component of AutoRestTest -- the SPDG, the LLM, and the agent-learning mechanism -- contributes to its overall effectiveness.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
FDIC, OhSome, and Spotify (total)AutoRestTestoperations exercised25 operations+14 vs baselineApi Testing · split: test · repetitions=10 · time-budget=1 hour · specifications=enhanced RESTGPT
Source quote
L311: Total │ 25 │ 11 │ 10 │ 10 │ 9
12 evaluated REST APIs (total)AutoRestTestservice failures triggered (500 response codes)42 500 response codes+9 vs baselineApi Testing · split: test · repetitions=10 · time-budget=1 hour · deduplication=by server response message per operation
Source quote
L342: Total │ 42 │ 33 │ 20 │ 20 │ 14
Reported baseline / comparator measurements (2)
BenchmarkMethodMetricScoreProtocol / Evidence
FDIC, OhSome, and Spotify (total)ARAT-RL baselineoperations exercised11 operationsApi Testing · split: test · repetitions=10 · time-budget=1 hour · specifications=enhanced RESTGPT
Source quote
L311: Total │ 25 │ 11 │ 10 │ 10 │ 9
12 evaluated REST APIs (total)ARAT-RL baselineservice failures triggered (500 response codes)33 500 response codesApi Testing · split: test · repetitions=10 · time-budget=1 hour · deduplication=by server response message per operation
Source quote
L342: Total │ 42 │ 33 │ 20 │ 20 │ 14
BibTeX
@misc{kim2024multi,
  author = {Myeongsoo Kim and Tyler Stennett and Saurabh Sinha and Alessandro Orso},
  title = {{A Multi-Agent Approach for REST API Testing with Semantic Graphs and LLM-Driven Inputs}},
  year = {2024},
  eprint = {2411.07098},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.07098},
}
Figure