EMNLP Findings2025
Learning API Functionality from In-Context Demonstrations for Tool-based Agents
Bhrij Patel, Ashish Jagmohan, Aditya Vempaty
Abstract
Digital tool-based agents, powered by Large Language Models (LLMs), that invoke external Application Programming Interfaces (APIs) often rely on documentation to understand API functionality. However, such documentation is frequently missing, outdated, privatized, or inconsistent-hindering the development of reliable, general-purpose agents. In this work, we propose a new research direction: learning of API functionality directly from in-context demonstrations. This task is a new paradigm applicable in scenarios without documentation. Using API benchmarks, we collect demonstrations from both expert agents and from self-exploration. To understand what information demonstrations must convey for successful task completion, we extensively study how the number of demonstrations and the use of LLM-generated summaries and evaluations affect the task success rate of the APIbased agent. Our experiments across 3 datasets and 6 models show that learning functionality from in-context demonstrations remains a non-trivial challenge, even for state-of-the-art LLMs. We find that providing explicit function calls and natural language critiques significantly improves the agent's task success rate due to more accurate parameter filling. We analyze failure modes, identify sources of error, and highlight key open challenges for future work in documentation-free, self-improving, API-based agents.
Ask Lune
Ask anything. The answer quotes the paper.
Lune reads all of it and the papers around it, then shows you the passages behind every answer.
Builds on4
- Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni et al.NeurIPS 2020 · 19,162 citations
- Toolformer: Language Models Can Teach Themselves to Use ToolsTimo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu et al.NeurIPS 2023 · 5,989 citations
- 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
- Model-based Reinforcement Learning for Parameterized Action SpacesRenhao Zhang, Haotian Fu, Yilin Miao, George KonidarisICML 2024 · 8 citations
Related papers
- GOAT: A Training Framework for Goal-Oriented Agent with ToolsHyunji Min, Sangwon Jung, Junyoung Sung, Dosung Lee et al.ACL Findings 2026
- Tool Learning in the Wild: Empowering Language Models as Automatic Tool AgentsZhengliang Shi, Shen Gao, Lingyong Yan, Yue Feng et al.WWW 2025 · 59 citations
- ShortcutsBench: A Large-Scale Real-world Benchmark for API-based AgentsHaiyang Shen, Yue Li, Desong Meng, Dongqi Cai et al.ICLR 2025
- ICL-D3IE: In-Context Learning with Diverse Demonstrations Updating for Document Information ExtractionJiabang He, Lei Wang, Yi Hu, Ning Liu et al.ICCV 2023 · 61 citations
- AutoGuide: Automated Generation and Selection of Context-Aware Guidelines for Large Language Model AgentsYao Fu, Dong-Ki Kim, Jaekyeom Kim, Sungryull Sohn et al.NeurIPS 2024 · 80 citations
