Lune

ICML2024Top-tier venue

AnyTool: Self-Reflective, Hierarchical Agents for Large-Scale API Calls

Yu Du, Fangyun Wei, Hongyang Zhang

Abstract

We introduce AnyTool, a large language model agent designed to revolutionize the utilization of a vast array of tools in addressing user queries. We utilize over 16,000 APIs from Rapid API, operating under the assumption that a subset of these APIs could potentially resolve the queries. AnyTool primarily incorporates three elements: an API retriever with a hierarchical structure, a solver aimed at resolving user queries using a selected set of API candidates, and a self-reflection mechanism, which re-activates AnyTool if the initial solution proves impracticable. AnyTool is powered by the function calling feature of GPT-4, eliminating the need for training external modules. We also revisit the evaluation protocol introduced by previous works and identify a limitation in this protocol that leads to an artificially high pass rate. By revising the evaluation protocol to better reflect practical application scenarios, we introduce an additional benchmark, termed AnyToolBench. Experiments across various datasets demonstrate the superiority of our AnyTool over strong baselines such as ToolLLM and a GPT-4 variant tailored for tool utilization. For instance, AnyTool outperforms ToolLLM by +35.4% in terms of average pass rate on ToolBench. Code will be available at https://github.com/dyabel/AnyTool .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

26 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Direct Preference Optimization: Your Language Model is Secretly a Reward Model cites Language Models are Few-Shot Learners
  • Direct Preference Optimization: Your Language Model is Secretly a Reward Model cites Training language models to follow instructions with human feedback
  • Divide-Then-Aggregate: An Efficient Tool Learning Method via Parallel Tool Invocation cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • Divide-Then-Aggregate: An Efficient Tool Learning Method via Parallel Tool Invocation cites Toolformer: Language Models Can Teach Themselves to Use Tools
  • Divide-Then-Aggregate: An Efficient Tool Learning Method via Parallel Tool Invocation cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Chain-of-Thought Prompting Elicits Reasoning in Large Language Models cites Training language models to follow instructions with human feedback
  • Prompt Injection Attack to Tool Selection in LLM Agents cites Training language models to follow instructions with human feedback
  • Training language models to follow instructions with human feedback cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers26

  1. A Survey of Large Language Model-Based Search AgentsYunjia Xi, Jianghao Lin, Yongzhao Xiao, Zheli Zhou et al.ACL 2026 · 1,216 citations
  2. Prompt Injection Attack to Tool Selection in LLM AgentsJiawen Shi, Zenghui Yuan, Guiyao Tie, Pan Zhou et al.NDSS 2026 · 181 citations
  3. Benchmarking LLM Tool-Use in the WildPeijie Yu, Wei Liu, Yifan Yang, Jinjian Li et al.ICLR 2026 · 20 citations
  4. Divide-Then-Aggregate: An Efficient Tool Learning Method via Parallel Tool InvocationDongsheng Zhu, Weixian Shi, Zhengliang Shi, Zhaochun Ren et al.ACL 2025 · 16 citations
  5. LLaMP: Large Language Model Made Powerful for High-fidelity Materials Knowledge RetrievalYuan Chiang, Elvis Hsieh, Chia-Hong Chou, Janosh RiebesellEMNLP 2025 · 7 citations

Builds on10

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  3. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  4. Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning et al.NeurIPS 2023 · 10,924 citations
  5. Toolformer: Language Models Can Teach Themselves to Use ToolsTimo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu et al.NeurIPS 2023 · 5,989 citations

Related papers

  1. StableToolBench: Towards Stable Large-Scale Benchmarking on Tool Learning of Large Language ModelsZhicheng Guo, Sijie Cheng, Hao Wang, Shihao Liang et al.ACL Findings 2024 · 22 citations
  2. ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIsYujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu et al.ICLR 2024 · 1,469 citations
  3. CToolEval: A Chinese Benchmark for LLM-Powered Agent Evaluation in Real-World API InteractionsZishan Guo, Yufei Huang, Deyi XiongACL Findings 2024 · 7 citations
  4. ShortcutsBench: A Large-Scale Real-world Benchmark for API-based AgentsHaiyang Shen, Yue Li, Desong Meng, Dongqi Cai et al.ICLR 2025
  5. GOAT: A Training Framework for Goal-Oriented Agent with ToolsHyunji Min, Sangwon Jung, Junyoung Sung, Dosung Lee et al.ACL Findings 2026
Dusk over the sea between two cliffs drawn in fine vertical lines