Paper commentary
LIBRA: Programmatic Induction of Executable Tool Libraries
LIBRA builds a tool library that retrieves prerequisite tools alongside the goal tool
- Problem Dense retrievers rank each tool independently by request similarity, so prerequisite tools the request never names get missed. A user's request rarely mentions authentication or state setup, so the needed upstream tools fall far down the ranking.
- Method LIBRA is a framework that turns a flat tool catalog into an executable library before any user query arrives. An LLM drafts a contract for each tool, and LIBRA keeps only the composition relations that pass a sandbox counterfactual test.
- Results On the three benchmarks, LIBRA raises one-shot Recall over the same dense retriever by 7.9 percentage points on average. Its NDCG gain averages 3.7 percentage points.

Figure 1 : Overview of LIBRA.Stage 1:Before user queries arrive, an LLM proposes an executable contract of each tool. LIBRA tests each candidate composition in the target runtime. Successful compositions are retained to construct the executable tool library, while unsuccessful ones are removed. For example, although card and trans_id share the same integer type, a payment card identifier cannot be used as a transaction identifier. Stage 2:Given the request “Find Alice in my contact and I will make the transfer,” dense retrieval returns Venmo.Search_users. LIBRA performs one-hop propagation and recovers its prerequisite toolVenmo.Login.
Original paper · CC BY 4.0 · Zekai Li, Zhenke Liu, Yonghao Li, Junhan Liu, Xulong Xiao, Jiapeng Zhang · LIBRA: Programmatic Induction of Executable Tool Libraries · Original paper figure · Extracted the figure area from page 3 of the original PDF.Why per-tool ranking misses prerequisites
Agents only see the small candidate set a retriever returns, so the ranking decides which tools they can reach. Most retrievers rank each tool independently, so a tool's score ignores the other tools a workflow needs. A user states the desired outcome and leaves out authentication, identifier lookup, state initialization, and format conversion.
A retriever can therefore find the goal tool while omitting the upstream tools whose outputs or state execution requires.
In the AppWorld example, phone.update_alarm sits at Dense rank 1 for a request to move an alarm. The phone.login it depends on sits at rank 28, because its authentication prerequisite is implicit in the request. Semantic similarity gives no sign that the login has to run first, since it doesn't resemble the request. Provider and consumer embeddings needn't be similar, because the two tools implement distinct operations.
Dense retrieval behaves as intended here, since it finds the consumer, and the missing signal is which prerequisite runs first.
In BFCL, the tail tool sits at Dense rank 3, while its state-creating prerequisite touch sits at rank 16. On SciToolEval the gap is largest, with GetNPR2 at rank 1 and the format converter SELFIEStoSMILES at rank 169. The authors sort gold tool occurrences outside the top K into one recovered outcome and four failure causes. Recovery reaches 18.3 percent on AppWorld, 33.5 percent on BFCL, and 58.8 percent on SciToolEval.
Dependency-aware methods rely on hierarchies, metadata, trained models, or historical trajectories, which a new catalog may lack. Metadata-inferred relations can look plausible yet fail at runtime, which is why relations must be tested in the target environment. The paper therefore asks how to build knowledge of tool composition before user queries or usage histories exist.
Testing tool compositions before queries arrive
LIBRA builds its library ahead of user queries, so the composition knowledge exists before any request arrives. The authors separate a plain tool catalog, which holds callable interfaces and public metadata, from an executable tool library. The executable library adds a per tool contract and the composition relations that held at runtime.
The authors expect a relation that survives execution to be more trustworthy than one read off metadata, because a relation can look plausible yet fail in the target runtime. LIBRA needs no dependency annotations, tool use trajectories, or task specific training to get there.
An LLM reads each tool's public description, signature, and input and output schema, then writes a contract for that tool. The contract lists candidate calls, the reusable values each call can produce, and the observable success and failure outcomes. Each candidate parameter can take a proposed literal, a value from an earlier call, or nothing when it is optional.
LIBRA runs the candidate calls in isolated sandbox states, so one contract's runs don't disturb another's. When a result matches neither outcome specification, the LLM sees the execution feedback and revises the contract. Each tool gets one initial generation call and at most two revision calls, so the number of LLM calls grows linearly with the catalog size.
A relation is kept only after a counterfactual test, since a single success check can't separate real dependencies from schema compatible pairs. LIBRA runs the provider tool first, extracts a declared output, and feeds that value to a compatible input of the consumer. If the consumer call succeeds, LIBRA reruns it from the same saved state with a literal or a omitted input instead.
If the observed value succeeds while the control fails, LIBRA keeps an input-provenance relation, because the upstream value is necessary. For environment state, LIBRA invokes the consumer before and after the provider, and keeps the state dependency only when the consumer fails first and succeeds afterward.
Values and states from successful calls are reused in later invocations, which lets LIBRA find multi-hop compositions.
The counterfactual test behind each relation
A schema match alone doesn't tell LIBRA that a tool really depends on another tool, so each candidate relation faces a counterfactual test. LIBRA first executes the provider tp and extracts an output that the contract declares. It then supplies that value to a compatible input of the consumer tc. This second call replaces the input with an independently constructed literal, or omits it when the input is optional.
The control is what matters here, because it separates genuine dependencies from merely schema compatible pairs.
Under this rule, the upstream value is necessary for the consumer invocation to succeed under the fixed sandbox state. LIBRA invokes the consumer with identical arguments before and after executing the candidate provider. A state dependency is retained only when the consumer fails before the provider runs and succeeds afterward.
If both invocations succeed, the pair doesn't become an input-provenance relation, and LIBRA keeps it only as a compatibility relation. That compatibility relation also requires the provider output and consumer input to be semantically aligned. Successful observed values and states are reused in later invocations, which lets LIBRA discover multi-hop compositions.
The retained relations form the edges of the retrieval graph for each benchmark, and only those edges support propagation at query time. A relation that passes this test holds only under the tested contract and sandbox state.
Promoting prerequisites at query time
At query time, the dense retriever scores every tool against the request using only the tool's original metadata. Executable contracts never become retrieval documents, so they stay out of the embedding step. The dense score is normalized as one plus the cosine similarity, divided by two, and the top Ks tools become consumer seeds.
Starting from each seeded consumer, LIBRA follows incoming edges one hop back to the providers that feed it. When a single provider wins both criteria, it is kept only once.
A provider's score starts from its own dense relevance and is averaged with the relevance of each distinct seeded consumer connected to it. Each consumer contributes to a given provider only once, even when several of its inputs select that provider. The averaging keeps a tool from rising only because it has many graph neighbors. The provider then takes the larger of its original score and this average, so propagation never lowers its rank.
Tools outside the retrieval graph keep their original dense scores. LIBRA selects the top Kc tools under the propagated scores as the candidate set. The evaluation uses K equal to 15 for AppWorld and BFCL, and K equal to 10 for SciToolEval. On AppWorld, LIBRA raises Recall from 28.7 for QTS to 40.7 at the same cutoff. Its NDCG on AppWorld moves from 32.8 for QTS to 39.1.
One-shot gains over the same dense backbone
QTS is the fair control here, because it uses the same embedding model without the induced retrieval graph. Averaged over the three benchmarks, LIBRA improves one-shot Recall by 7.9 percentage points and NDCG by 3.7 percentage points. The evaluation runs at K=15 for AppWorld and BFCL and K=10 for SciToolEval, with no query-time reranking.
On AppWorld, LIBRA raises Recall from 28.7 for QTS to 40.7, and NDCG from 32.8 to 39.1. The authors tie this largest gain to AppWorld tasks that require 8.18 tools on average. TGR-Adapt keeps the top AppWorld NDCG at 39.9, compared to 39.1 for LIBRA. LIBRA still retrieves more of the required tools there, because its Recall is the higher of the two.

Table 2 : One-shot retrieval results without query time reranking. Dataset@K denotes the evaluation cutoff. Values are percentages. The best result in each column is highlighted, and the second best is underlined.
Original paper · CC BY 4.0On BFCL, LIBRA's NDCG of 78.4 matches Ego-Trip and sits above the 76.2 of QTS. On SciToolEval, LIBRA reaches a Recall of 91.1, compared to 89.7 for SciToolKG. Since QTS uses the same embedding model, the gap reflects the induced graph rather than a different embedding.
Agentic retrieval across three LLMs
The agentic experiment asks whether the same library still helps when an agent searches over several rounds. Each method was plugged into ToolReAGt and run for ten retrieval iterations. The agent LLMs were Gemma-4-12B, Nemotron-9B and Qwen3.5-9B, and each setting used three random seeds. The library itself stays query independent, so the agent never rebuilds it during the search.

Figure 2 : Agentic retrieval after 10 iterations. Each panel reports Recall and NDCG for one agent LLM and benchmark. Points show the mean over three random seeds, and error bars show standard error. LIBRA attains the highest Recall in8of the9settings and the highest NDCG on SciToolEval and BFCL for all three agent LLMs.
Original paper · CC BY 4.0Averaged over benchmarks, LLMs and seeds, LIBRA improves Recall by 4.5 percentage points over QTS. The same average raises NDCG by 2.9 percentage points over QTS, which uses the same dense backend without the library. On SciToolEval the gains are 1.3 and 1.8 points, and on BFCL they are 3.6 and 2.3 points. It also achieves the highest NDCG for every agent LLM on SciToolEval and BFCL.
The authors read this as the library staying useful across iterations, with no change to the ReAct policy and no agent training. They don't train the agent LLM, and the library doesn't depend on the agent's reformulated queries.
Where dependency recovery still falls short
Figure 3 shows three cases where a low-ranked provider was promoted into the top K. The AppWorld case has phone.update_alarm at Dense rank 1, while its authentication prerequisite phone.login sits at rank 28. The BFCL case has tail at Dense rank 3, and its state-creating prerequisite touch sits at rank 16. The SciToolEval case has GetNPR2 at rank 1, while the format converter SELFIEStoSMILES is ranked 169.
These three cases cover authentication, environment state, and data format conversion. LIBRA moves each provider into the top K in all three cases, because it follows the retained relation.

Figure 3 : We projected tool embeddings separately for each benchmark using t-SNE, with background colors indicating different clusters. In each example, Dense retrieval ranks the consumer (blue) within the topK but misses its provider (orange): (a) phone.update_alarm (#1) depends on phone.login (#28); (b) tail (#3) depends on touch (#16); and (c) GetNPR2 (#1) depends on SELFIEStoSMILES (#169). LIBRA follows the retained relation and recovers the provider. For SciToolEval and AppWorld, we observed runtime dependencies connecting tools across different clusters.
Original paper · CC BY 4.0The missing signal is the dependency that says which prerequisite must run first. The authors score each dense miss into one of five outcomes: recovered or one of four failure causes. Table 3 shows that the failure mix differs across the three benchmarks. On SciToolEval, LIBRA recovers 58.8% of the dense misses, the highest rate of the three benchmarks.
Almost every remaining SciToolEval miss has no edge in the retrieval graph.
On BFCL the picture changes, and failures occur later in the recovery pipeline. Only 2.7% of BFCL dense misses lack an outgoing graph edge. For 30.4% of BFCL misses, no connected consumer is retrieved as a seed. Another 21.4% are promoted but remain below the cutoff, and 12.1% lose among competing providers.
The authors explain the missing edges on AppWorld through ahead-of-time construction. Construction cannot execute a prerequisite that needs a query-specific input, such as phone.search_contacts. Without a phone_number output, LIBRA can't retain the input provenance relation to phone.send_text_message. A retained edge is also useless when its consumer is never seeded, as with create_file at Dense rank 387.
Provider selection can drop a valid provider when a competing provider scores higher on both input criteria.
Where LIBRA's approach stops
The counterfactual test controls the precision of retained relations, not the coverage of relations proposed in the first place. Because ahead-of-time construction can't observe the query-specific environment, some prerequisites never get exercised during construction. Their relations stay absent before any test applies, so the library can't recover them.
The authors say this gap depends on the benchmark, and it dominates on AppWorld. On BFCL, the same gap is negligible according to Table 3.
LIBRA needs a benchmark whose tools can actually run in an isolable, resettable runtime. Construction also carries an upfront execution cost, which amortizes across queries. A runtime-validated relation holds only under the tested contract and sandbox state.
A retained relation can't help retrieval when its consumer isn't retrieved as a seed. The experiments cover three benchmarks and three agent LLMs. Contract generation uses one model, DeepSeek-v4-Flash, for all of them.
Paper info
- Authors
- Zekai Li, Zhenke Liu, Yonghao Li, Junhan Liu, Xulong Xiao, Jiapeng Zhang
- Venue
- arXiv · Preprint
- First published
- 2026-11-3
- Added
- 2026-11-6
- Updated
- 2026-11-3
- Version
- v1
- arXiv
- 2611.05445
- Category
- cs.SE · cs.AI · cs.IR
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
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.
Quote from the paper
Zekai Li, Zhenke Liu, Yonghao Li, Junhan Liu, Xulong Xiao, Jiapeng Zhang (2026). LIBRA: Programmatic Induction of Executable Tool Libraries. arXiv:2611.05445v1. https://arxiv.org/abs/2611.05445v1
BibTeX
@misc{li2026libra,
title = {{LIBRA: Programmatic Induction of Executable Tool Libraries}},
author = {Zekai Li and Zhenke Liu and Yonghao Li and Junhan Liu and Xulong Xiao and Jiapeng Zhang},
year = {2026},
eprint = {2611.05445},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.05445v1}
}