Manuscript Offprint

arXiv:2610.21267

TRACER: Trajectory-Aware Tool Retrieval for LLM Agents

Tanish Kher, Sarvesh DK, Abedelkadir Asi, Sparsha Chennarayapatna Sundaresh, Dezhi Hong

Abstract

Modern agents select tools from registries, but exposing entire registries incurs high token costs and can impair selection as they grow. We present TRACER, a retrieval front-end that indexes observed tool-call sequences in a trie and ranks continuations using a learned blend of empirical and contextual priors. On a mixed retail-and-telecom τ2\tau^{2} environment, TRACER improves GPT-5.4's tool-selection accuracy by 4.7 points while reducing input tokens per step by 80%, exposing just 5 of 128 tools. In autonomous full-turn execution, it matches GPT-5.4's full-registry task success with 61% fewer input tokens per step. Across six environments and four models, TRACER improves tool-selection accuracy over full-registry selection in 21 of 24 model-environment pairs, with average gains of 6 to 10 points; the three exceptions trail by at most 2.2. We analyze failures in both regimes to identify directions for future work.

1 Introduction

Modern language-model agents use tool calling to resolve user requests (Schick et al., 2023; Yao et al., 2023), often executing multi-turn sequences of function calls over registries of internal services and external APIs (Barres et al., 2025). Systems such as Claude Cowork (Anthropic, 2026), Copilot Cowork (Microsoft, 2026), and Codex (OpenAI, 2025) illustrate the growing use of tool-mediated interaction in agentic workflows (Xu et al., 2026). A central challenge is selecting and invoking the right tool from a potentially large registry. Exposing many tool schemas simultaneously increases context and token costs, while long, detailed inputs can make relevant information harder to use reliably (Sakizli, 2026; Liu et al., 2024a). To manage this overhead, recent approaches retrieve or load tools on demand (Fei et al., 2025; Anthropic, 2025),

Figure

Figure 1: Selection accuracy at a fixed budget of retrieving top-k(= 5) tools (mixed τ2\tau^{2} Large, 128 tools, GPT-5.4).

often using tool descriptions to identify candidates. However, description-based retrieval can confuse semantically similar tools, and retrieval errors can propagate to downstream execution. As registries grow, tool selection and schema management therefore remain important sources of inefficiency and unreliability despite progress in tool retrieval and tool-use training (Liu et al., 2026; Gillespie and Perry, 2026; Qin et al., 2024; Patil et al., 2024; Gan and Sun, 2025).

The core gap is that each step is treated as independent search, when tool retrieval is really sequential prediction: which call comes next, given those already made. Within a single turn, a τ2\tau^{2} retail request is resolved in a logical order: identify the customer, pull their account, open the order in question, then act on it. The calls already made therefore constrain the next one.

Built on this intuition, we propose TRACER (Trie Retrieval Across Contextual Edges, Reweighted), a state-conditioned front-end that offers a small, accurate candidate set at every step and still leaves the final choice to the model (Figure 6, Appendix A.8). It rests on three ideas. Full-prefix conditioning: execution history is a trie over observed tool-call sequences, the agent's prefix within a turn is a node, and the tools seen after it are its candidates, so ear-

*Work done during an internship at Microsoft. Correspondence to: tkher@berkeley.edu.

lier calls separate next steps that the last call alone leaves equally plausible. Transition-specific usage memory: each edge stores the conversations that transition was taken in, telling apart candidates whose descriptions do not. State-dependent weighting: history and semantics are not equally informative, so a learned per-step blend sets how much each should count at any step. Where a registry’s calls concentrate in generic utility tools that no single state predicts, TRACER+G unions a small global set into every candidate set.

On a mixed τ2\tau^{2} environment spanning retail and telecom domains, TRACER paired with GPT-5.4 outperforms the standalone frontier GPT-5.4 model by 4.7 points in tool-selection accuracy, 57.2% to 61.9%, all while cutting prompt tokens per step by 80% (Figure 1). Running a full turn on its own selections, TRACER matches full-registry task success, 58.3% against 58.2%, despite presenting only 23% of the tools at any time and cutting per-step tokens by 61%. Similar results largely hold across five other environments, four models, and budgets k from 3 to 30 (§5).

References (64)