AI
FireFly: A New Pipeline for Training AI Agents on Real API Tools
Researchers introduce FireFly, a method that generates verified training data for tool-calling AI agents by working backward from real API interactions rather than synthesizing artificial tasks.
Training AI agents to use tools and APIs has long faced a fundamental challenge: generating realistic training data with trustworthy labels at scale. Most existing approaches either work with simulated environments that don't reflect how real APIs behave, or create tasks without any way to verify whether the outcomes are correct.
A Flipped Approach to Data Generation#
FireFly addresses this problem by inverting the typical data synthesis pipeline. Instead of generating hypothetical tasks and hoping they can be solved, the researchers let a capable language model explore actual APIs first, then work backward to create the corresponding tasks—ensuring labels are inherently accurate.
The key innovation lies in how FireFly handles the vast complexity of real-world tool ecosystems. With roughly 1,000 tools to navigate, the system builds a semantic graph of tool relationships and intelligently samples sub-graphs to focus exploration on coherent, interconnected workflows. This targeted approach makes the problem tractable while preserving the diversity needed for robust training.
Tackling Real-World Challenges#
A practical obstacle emerges when working with live APIs: environments change over time, potentially invalidating training data. FireFly solves this through a retrieval-augmented simulator that records all exploration interactions as a cache, then replays them during model training and evaluation. This design enables fully offline training—removing the dependency on live API access and ensuring reproducible results.
Scale and Performance#
The pipeline generated 5,144 verified training tasks across 240 different servers and 993 distinct tools. When a 4-billion-parameter model was trained using GRPO (a reinforcement learning technique) on this FireFly dataset, it matched the performance of Claude Sonnet 4.6 on held-out test cases and demonstrated gains across multiple established benchmarks including Tau2-Bench, MCPMark, and MCP-Atlas.
The work represents a significant step forward for creating training data that grounds AI agents in genuine API interactions while maintaining the scale and quality needed for production deployment.

