Manuscript Offprint

arXiv:2608.23078

AgentWeave: Routing Before Reasoning for Efficient Function Calling in Tool-Rich Language Models

Saurav Singla, Aarav Singla, Advik Gupta, Parnika Gupta

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

Abstract

Large language models increasingly operate over large collections of tools, functions, APIs, and specialized agents. As the candidate action space grows, a function-calling model must process more schemas, consume more prompt tokens, and distinguish among increasingly similar or irrelevant alternatives. We study a complementary systems strategy: reduce the candidate set before language-model inference while leaving the downstream model unchanged. We introduce AgentWeave, a deterministic pre-inference routing layer that constructs a bounded model-visible action space using eligibility, requirement, capability, and routing signals. We evaluate AgentWeave with a frozen BFCL-derived routing-pressure protocol using the public MadeAgents/Hammer2.1-1.5b model. On 48 fresh BFCL V4 multiple-function tasks, AgentWeave achieves 6/48 (12.5%) native BFCL successes, whereas all-tools, deterministic random top-8, and semantic top-8 baselines each achieve 0/48. The paired success difference is +12.5 percentage points with a 10,000-resample paired bootstrap 95% confidence interval of +4.17 to +22.92 points and exact McNemar p=0.03125. Relative to all-tools exposure, AgentWeave presents 70.18% fewer tools, uses 61.70% fewer input tokens, and exhibits 50.95% lower mean local-model latency. The result is deliberately narrow: this is a BFCL-derived routing-pressure study rather than an official full BFCL leaderboard score, and absolute task success remains low. The evidence nevertheless shows that candidate-space construction can materially affect a fixed model's function-calling behavior and motivates evaluating routing as a distinct stage before model reasoning.

1. Introduction

Function calling has become a central interface between language models and external computation. Modern systems use model-generated calls to search services, databases, software libraries, enterprise APIs, web actions, and domain-specific tools. Toolformer [1], ReAct [2], Gorilla [3], API-Bank [4], ToolLLM [5], Hammer [6], ToolACE [7], and the Berkeley Function Calling Leaderboard (BFCL) [8] demonstrate the breadth of this research direction. Yet most evaluation pipelines still treat the candidate tool catalog as a fixed input to the model. This is convenient for benchmarking, but it obscures a systems variable that becomes important as catalogs grow: which functions should the model see at all?

The underlying hypothesis of this paper is simple. Function calling can be decomposed into candidate-space construction followed by language-model reasoning. An application may first remove tools that are unavailable because of role, tenant, policy, deployment, or capability constraints. A task-aware router can then reduce the remaining catalog further. The language model subsequently chooses among a smaller set. This decomposition does not require fine-tuning the downstream model and can therefore be evaluated using controlled same-model comparisons.

• formalize pre-inference tool routing as a distinct stage in function calling;

• describe AgentWeave as a deterministic, model-independent routing layer;

• present a frozen 48-task BFCL-derived replication with matched baselines;

• quantify native success, candidate retention, token use, and latency; and

• state explicit evidence boundaries, limitations, and reproducibility controls.