arXiv:2611.05445cs.SENov 2026

Manuscript Offprint

arXiv:2611.05445

LIBRA: Programmatic Induction of Executable Tool Libraries

Zekai Li, Zhenke Liu, Yonghao Li, Junhan Liu, Xulong Xiao, Jiapeng Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large language model agents increasingly retrieve tools from large catalogs, yet most retrievers rank each tool independently by request similarity. For multi tool tasks, this recovers the goal matching tool while omitting prerequisite tools required by the workflow. We introduce LIBRA, a framework for Library Induction by Runtime Assembly that turns a flat tool catalog into an executable tool library. An LLM proposes per tool contracts of candidate invocations, reusable outputs and state changes, and success conditions; LIBRA then tests these compositions in a sandbox and retains the relations supported at runtime. Constructed before user queries, the library requires no dependency annotations, tool use trajectories, or task specific training, and supports both one-shot and agentic retrieval. On AppWorld, BFCL, and SciToolEval, LIBRA improves one-shot Recall and NDCG over the same dense retriever by 7.9 and 3.7 percentage points on average. Within ToolReAGt, it yields corresponding gains of 4.5 and 2.9 points after ten retrieval iterations.

1 Introduction

Large language models (LLMs) increasingly act as agents that accomplish tasks by calling external tools and APIs (Wang et al., 2025; Chen et al., 2026). As tool catalogs grow, exposing every available tool to the LLM becomes costly and unreliable: the catalog may exceed the context window, while irrelevant tools increase inference cost and degrade tool selection. Practical systems therefore retrieve a small candidate set for each user request (Zheng et al., 2024; Braunschweiler et al., 2025).

Most tool retrievers, however, represent and rank tools independently. This abstraction is insufficient for tasks that require multiple tools to execute in sequence. A user typically states the desired outcome rather than the complete operational

procedure, leaving prerequisites such as authentication, identifier lookup, state initialization, and format conversion absent from the request. Consequently, a retriever may identify the tool that directly matches the stated goal while omitting upstream tools whose outputs or state are required for execution. Semantic relevance alone therefore does not guarantee a retrieval set that contains the prerequisite tools required by a valid workflow.

Existing dependency aware approaches obtain tool relations from supplied hierarchies, metadata based inference, trained dependency models, or historical tool use trajectories (Zheng et al., 2024; Liu et al., 2024; Gao et al., 2025; Patel et al., 2026; Chen et al., 2026). Although these approaches can improve retrieval, they do not fully address a new executable catalog for which dependency annotations, tool-use demonstrations, and usage trajectories are unavailable. As summarized in Table 1, methods that learn tool structure either depend on existing tool use trajectories or training, or accept metadata inferred relations without testing whether the tools actually compose. This distinction matters because a relation can appear plausible from tool metadata yet fail in the target runtime. We therefore investigate the following question: How can we construct reusable knowledge of tool composition before user queries or usage histories become available?

We propose LIBRA, a framework for Library Induction by Runtime Assembly.¹ We distinguish a tool catalog, which contains callable interfaces and public metadata, from an executable tool library, which augments the catalog with per tool executable contracts and runtime supported composition relations. Each contract specifies candidate invocations, reusable outputs and state changes, and observable success conditions. LIBRA executes type compatible compositions in a sandbox and

  • Equal contribution.

¹Code will be released upon acceptance.

Table 1: Comparison of methods for learning tool dependencies. Prior methods either depend on existing tool use trajectories or training, or retain metadata inferred relations without runtime validation. LIBRA performs trajectory free, training free dependency induction and validates candidate tool compositions through execution in the target environment.

MethodTrajectory freeTraining freeExecution validation
ToolNet (Liu et al., 2024)✕✓✕
TGR (Gao et al., 2025)✓✕✕
GTool (Chen et al., 2026)✕✕✕
Ego-Trip (Bansal et al., 2025)✓✓✕
LIBRA✓✓✓

can retain input provenance relations, compatibility relations, and state dependencies supported by constructing counterfactual tests. Each test checks not merely that a composition succeeds, but that it fails without the candidate dependency; this yields relations that are more precise than metadata inferred structure (Appendix B). The resulting query independent library augments tool retrieval with reusable composition knowledge, but does not generate or execute task specific plans. We therefore evaluate its ability to recover tools required under each benchmark's evaluation protocol.

The executable tool library is constructed ahead of user queries and requires neither existing tool use trajectories nor task specific training. At retrieval time, a dense base retriever identifies semantically relevant seed tools, while the library promotes their prerequisite tools, which need not be mentioned in the request. Because the library is query independent, the same artifact can augment both one-shot retrievers and agentic retrievers that search iteratively. LIBRA thus learns how tools compose once and exposes that knowledge to subsequent retrieval workflows.

We evaluate LIBRA on AppWorld, BFCL, and SciToolEval against lexical, dense, representation augmented, graph based, and agentic retrieval baselines. Relative to the same dense retriever, LIBRA improves one-shot Recall and NDCG by 7.9 and 3.7 percentage points on average across the three benchmarks. When integrated into ToolReAGt, LIBRA improves Recall and NDCG by 4.5 and 2.9 percentage points, averaged across three benchmarks, three agent LLMs, and three random seeds. These results demonstrate that an execution supported tool library provides reusable retrieval guidance beyond semantic similarity alone.

Our contributions are as follows:

  • We introduce LIBRA, which uses LLM pro-posed executable contracts and a counterfactual sandbox execution test, retaining a relation only when the provider value succeeds while an independently constructed control fails, to construct a reusable tool library of runtime supported composition relations without dependency annotations, existing tool use trajectories, or task specific training.

  • We demonstrate that the induced tool library improves both one-shot and agentic retrieval across three tool use benchmarks and three agent LLMs.

  • We present case studies of prerequisite tools that LIBRA recovers despite their low semantic similarity to the request, together with a breakdown of the remaining causes of failed dependency recovery.