Evaluating LLMs on Sequential API Call Through Automated Test Generation

Yuheng Huang, Jiayang Song, Da Song, Zhenlan Ji, Wenhan Wang +2 more
7/13/2025
cs.SEcs.AIcs.CL

No confident code implementation found for this paper. 5 possible matches can be shown below.

Abstract

By integrating tools from external APIs, Large Language Models (LLMs) have expanded their promising capabilities in a diverse spectrum of complex real-world tasks. However, testing, evaluation, and analysis of LLM tool use remain in their early stages. Most existing benchmarks rely on manually collected test cases, many of which cannot be automatically checked for semantic correctness and instead depend on static methods such as string matching. Additionally, these benchmarks often overlook the complex interactions that occur between sequential API calls, which are common in real-world applications. To fill the gap, in this paper, we introduce StateGen, an automated framework designed to generate diverse coding tasks involving sequential API interactions. StateGen combines state-machine-based API constraint solving and validation, energy-based sampling, and control-flow injection to generate executable programs. These programs are then translated into human-like natural language task descriptions through a collaboration of two LLM agents. Utilizing StateGen, we construct StateEval, a benchmark encompassing 120 verified test cases spanning across three representative scenarios: Session Service, Tensor Operation, and ElevenLabs MCP. Experimental results confirm that StateGen can effectively generate challenging and realistic API-oriented tasks, highlighting areas for improvement in current LLMs incorporating APIs.We make our framework and benchmark publicly available to support future research.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 5 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{huang2025evaluating,
  title  = {Evaluating LLMs on Sequential API Call Through Automated Test Generation},
  author = {Yuheng Huang and Jiayang Song and Da Song and Zhenlan Ji and Wenhan Wang and Shuai Wang and Lei Ma},
  year   = {2025},
  eprint = {2507.09481},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.09481v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.09481.svg)](https://codeofpaper.com/paper/2507.09481)

Discussion