APIGen-MT: Agentic Pipeline for Multi-Turn Data Generation via Simulated Agent-Human Interplay

Akshara Prabhakar, Zuxin Liu, Ming Zhu, Jianguo Zhang, Tulika Manoj Awalgaonkar, Shiyu Wang, Zhiwei Liu, Haolin Chen, Thai Quoc Hoang, Juan Carlos Niebles, Shelby Heinecke, Weiran Yao, Huan Wang, Silvio Savarese, Caiming Xiong · DOI

TL;DR

This paper introduces APIGen-MT, a novel two-phase framework for generating high-quality, multi-turn conversational data for training AI agents. By first creating detailed task blueprints and then simulating human-agent interactions, APIGen-MT produces realistic and verifiable data that significantly improves agent performance on challenging benchmarks, even for smaller models.

What Problem Does This Paper Address?

Training effective AI agents for complex, multi-turn interactions is crucial for real-world applications, but it's hampered by a scarcity of high-quality training data. Existing datasets are often limited in scope, lack realistic human-agent dynamics, or are prohibitively expensive to create manually. Advanced LLMs still struggle with multi-turn interactions, especially when complex function calls, long-term dependencies, or missing information are involved. This paper aims to solve this by providing a scalable and effective method for generating diverse and verifiable multi-turn agent data.

Methods

APIGen-MT employs a two-phase framework:

  1. Phase 1: Task Configuration and Groundtruth Generation: This phase focuses on creating a detailed "blueprint" for each task. It involves:
  2. Context Preparation: Gathering relevant APIs, domain rules, and data.
  3. LLM-based Data Generator: An LLM proposes initial task configurations, including user instructions, groundtruth actions, and expected outputs.
  4. Format & Execution Checker: Automated validation of action structure and executability in a simulated environment.
  5. Review Committee: A committee of LLMs semantically evaluates the tasks for coherence and sensibility.
  6. Feedback Generation and Refinement: An iterative loop where feedback from validation and review is used to improve task generation.
  7. Reverse Task Recombination: A technique to build complex, multi-step tasks by combining independently validated simpler tasks.
  8. Phase 2: Human-Agent-Environment Interaction Trajectory Collection: This phase uses the validated blueprints to generate realistic multi-turn conversations.
  9. Simulated Human-Agent Interplay: An LLM-based simulated human interacts with a test agent (e.g., GPT-4o) in an executable environment. The simulated human incrementally reveals information, mimicking real user behavior.
  10. Trajectory Collection: The simulation produces complete interaction trajectories (dialogue, actions, environment feedback). These trajectories are validated against the groundtruth from Phase 1.
  11. Stabilized Simulated Human: A Best-of-N sampling strategy and a self-critique mechanism are used to ensure the simulated human's responses remain stable and aligned with the task.

Datasets

  • T-bench: Used as a testbed for implementing and evaluating the APIGen-MT framework. It provides realistic domains (retail, airline), executable APIs, and specific policies.
  • BFCL v3: A benchmark used for evaluating agent capabilities, specifically function-calling.
  • APIGen-MT-5k: The paper introduces and open-sources 5,000 synthetic data trajectories generated by their framework.
  • xLAM-2-fc-r models: The authors also open-source their trained models.

Key Insights and Ideas

  • Decoupling Task Blueprint from Interaction: Separating the generation of a verified task structure (blueprint) from the simulation of conversational dynamics is key to achieving both correctness and naturalness in the generated data.
  • Agentic Feedback Loops for Quality: Using LLM committees and iterative refinement loops in Phase 1 significantly improves the quality and verifiability of the generated task blueprints.
  • Simulated Interplay for Realism: The simulated human-agent interaction in Phase 2, especially with stabilization techniques, effectively captures realistic multi-turn dynamics.
  • Smaller Models Can Compete: The data generated by APIGen-MT enables smaller models (e.g., xLAM-2-8b-fc-r) to achieve performance comparable to or exceeding much larger proprietary models, highlighting data efficiency.
  • Consistency is Crucial: The generated data leads to models that exhibit superior consistency across multiple trials, a critical property for real-world deployment.

Key Results

  • BFCL v3 Performance: xLAM-2-70b-fc-r and xLAM-2-32b-fc-r achieved the top two positions on the BFCL v3 leaderboard, outperforming proprietary models. Even smaller xLAM-2 models showed remarkable multi-turn accuracy.
  • T-bench Performance: xLAM-2-70b-fc-r achieved a 56.2% success rate on T-bench, outperforming Llama 3.1 70B Instruct and approaching Claude 3.5 Sonnet. Smaller xLAM-2 variants also surpassed larger baselines.
  • Consistency: The models trained on APIGen-MT data showed higher pass^k curves (probability of all k trials succeeding) on T-bench, indicating greater reliability and consistency.
  • Efficiency: The approach allows smaller models to achieve strong performance, demonstrating efficient knowledge transfer.

Limitations and Future Work

  • Human User Simulation Stochasticity: While improved, some stochasticity in human behavior remains. More deterministic simulation or refined filtering could further stabilize the process.
  • Discarded Failed Trajectories: The current approach discards failed trajectories in Phase 2. Future work could leverage these failures as contrastive signals for model training.
  • Computational Overhead of Validation: The multi-stage validation process, while effective, incurs computational overhead. More efficient validation or adaptive sampling strategies could be explored.
  • Extending to New Domains: Extending the APIGen-MT approach to additional domains is a promising direction.
  • Self-Improvement: Incorporating self-improvement mechanisms into the agent training process is suggested for future work.

Summary updated

BibTeX
@misc{prabhakar2025apigen,
  author = {Akshara Prabhakar and Zuxin Liu and Ming Zhu and Jianguo Zhang and Tulika Manoj Awalgaonkar and Shiyu Wang and Zhiwei Liu and Haolin Chen and Thai Quoc Hoang and Juan Carlos Niebles and Shelby Heinecke and Weiran Yao and Huan Wang and Silvio Savarese and Caiming Xiong},
  title = {{APIGen-MT: Agentic Pipeline for Multi-Turn Data Generation via Simulated Agent-Human Interplay}},
  year = {2025},
  eprint = {2504.03601},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.03601},
}
Figure