ZICQ
中 Log in / Sign up
Newsroom Agentic #Baseten #Deferred Tool Loading #MCP #Agent Inference #KV Cache

Baseten Adds Deferred Tool Loading for Open Models, Cutting Coding-Agent Costs 62.5% in Tests

Avatar of Mr.Xu

By Mr.Xu Compiled & Reviewed by Editorial

Published:

中文阅读 (Chinese) English Version
Co-reading Select any sentence in the article to highlight, annotate, or copy a quote card. Join discussion ↓

Summary:Baseten has added Deferred Tool Loading to DeepSeek, Kimi, and GLM on its Model APIs, with support for Chat Completions and Messages API formats. Instead of injecting every MCP schema into each request, the initial context contains tool names and a search tool, while complete schemas are materialized only when selected. In Baseten's Claude Code tests, coding tasks reduced average cost by 62.5% and wall-clock time by 26.2%; agentic tasks improved by 51.1% and 14.9%, respectively. The initial too


Baseten has added Deferred Tool Loading to DeepSeek, Kimi, and GLM on its Model APIs, with support for Chat Completions and Messages API formats. The feature does not require a different model or a harness rewrite. When many MCP tools are registered but only a few are used, the initial request no longer carries every complete JSON schema. It exposes a compact tool directory first, then materializes full definitions only when the model selects them.

In Baseten's Claude Code tests, coding tasks reduced average cost by 62.5% and wall-clock time by 26.2%. Agentic tasks improved by 51.1% and 14.9%, respectively. The gains do not come from changing the underlying model; they come from removing unused context, shrinking the KV-cache span, and preserving a reusable prefix through tool discovery.

Mechanism: Progressive Disclosure for Tools

Under conventional eager loading, every request carries the system prompt and the complete schema of every registered tool. With Slack, Notion, and Baseten connected as three MCP servers, Baseten measured an addition of roughly 141,000 tokens to each request. A server-side prefix cache can reuse the computed prefix, but those cached vectors still occupy KV-cache memory and must be read during subsequent decoding.

Deferred Tool Loading follows a five-step flow:

  1. The initial request sends tool names, brief descriptions, and a tool_search tool, totaling about 1,300 tokens in the cited setup.
  2. The model calls tool_search when it determines that a particular capability is needed.
  3. The client resolves the request and returns matching tool_reference blocks.
  4. The server renders the full schema at the end of the transcript instead of rewriting the cached system-prompt prefix.
  5. The model reads the selected definition and invokes the actual tool.

This resembles lazy loading in web development. Resources are not removed; they are no longer loaded unconditionally into every request. Once selected, a full schema normally remains part of the conversation and therefore still affects later turns. Deferred loading primarily removes the repeated burden of tools that a task never uses.

Why the KV Cache Benefits

Prefix caching reuses previously computed key-value vectors, but it does not make decoding free. In the dense-attention path used for the reported tests, every newly generated token still reads the KV entries for its current context. If N_ctx denotes cached context length and N_out denotes output length, the attention term grows approximately with N_ctx × N_out. Matrix multiplication, memory bandwidth, and sampling still account for other portions of latency.

In eager mode, approximately 141,000 tokens of tool definitions raise N_ctx for the entire request. Deferred mode begins with roughly 1,300 tokens, producing a much smaller stable prefix. After tool discovery, the selected schema becomes a new suffix at the end of the transcript. This preserves the earlier prefix cache while excluding unused schemas from most decoding steps.

Linear, sparse, or hybrid attention backends have different sensitivity to context length, so their savings will not necessarily match this result. Deferred loading can still reduce transferred bytes, prompt size, and prefix storage, but the dollar impact remains dependent on API pricing, cache billing, and the serving implementation.

Engineering Trade-offs

  • Discovery has a cost: The model must search before it can use a tool. Tasks requiring many distinct tools may pay for extra model-tool round trips, discovery mistakes, and retries. Baseten reports that eager loading was more efficient on Toolathlon-GYM, where tasks averaged 68 tool calls; DeepSWE and MCP-Atlas were also slightly slower with deferred loading.
  • Directory quality determines recall: Tool names and descriptions must distinguish overlapping MCP functions. Ambiguous metadata can cause incorrect selection, missed tools, or repeated searches, turning the tool catalog into a retrieval index that requires active maintenance.
  • Cost is deferred, not eliminated: A selected schema still occupies the suffix context and normally remains in subsequent turns. The benefit comes from avoiding unused tools and avoiding repeated transmission of large schema blocks.
  • Client and gateway must cooperate: This capability requires coordinated client, gateway, and inference-service support. Baseten notes that Claude Code and Codex can disable the mechanism when connected to third-party open-model providers. Implementations must verify client flags, API formats, and handling of tool_search and tool_reference blocks.
  • Discovery must not expand authorization: Loading fewer schemas initially reduces exposure, but it does not reduce tool permissions. Selected tools still need least-privilege scopes, user confirmation, timeouts, and complete audit logs.

Vendor Benchmark Results and Boundaries

Baseten used GLM 5.3 and sampled 55 tasks from eight benchmarks, comparing configurations with deferred loading enabled and disabled. Coding tasks ran headlessly in Claude Code with Slack, Notion, and Baseten MCP servers registered. Agentic tasks used the tools already included in each benchmark, without additional MCP servers.

| Scenario | Average cost change | Average wall-clock change | | --- | ---: | ---: | | Coding tasks | 62.5% lower | 26.2% lower | | Agentic tasks | 51.1% lower | 14.9% lower |

The results indicate that the main benefit is not fewer output tokens. It is the removal of repeated tool schemas, the shorter attention span, and lower cumulative input across multi-turn tasks. Tool-dense workloads may approach break-even or become slower because of the discovery process.

These figures are vendor-reported. The article does not disclose absolute dollar cost, end-to-end or time-to-first-token distributions, task success and correctness changes, confidence intervals, variance, GPU and serving configurations, cache-hit rates, or the complete composition of the eight benchmarks. Keeping the model and harness fixed helps isolate the feature's effect, but production workloads still require independent testing with real MCP servers, prompts, and traffic.

Deployment Guidance

  1. Inventory schema size and usage: Rank tools by schema tokens × request count × unused ratio, then optimize large but rarely invoked MCP integrations first.
  2. Separate short and long-chain workloads: Eager loading may remain simpler for one-shot tasks that use one or two small tools. Deferred loading is more attractive for long-running agents with many tools and low selection density. Use a hybrid policy where the API permits it.
  3. Improve tool metadata: Give every tool a unique name, explicit purpose, parameter summary, and examples where useful, reducing ambiguity in discovery.
  4. Run protocol-matched A/B tests: Fix the model snapshot, harness version, MCP implementation, system prompt, sampling settings, and cache state. Track success rate, total tokens, tool calls, TTFT, TPOT, P95 latency, and total cost.
  5. Add discovery guardrails: Limit discoverable tools per turn, maximum schema size, and search retries. Keep human approval or policy-engine checks for high-risk tools.
  6. Maintain a fallback path: Start with low-risk internal workflows, then expand to long-chain coding and business processes after confirming that client, gateway, and model versions agree on the wire format.

Deferred Tool Loading does not make a model smarter. It ensures that an agent carries only the tool definitions it actually needs. For coding agents whose MCP ecosystems keep expanding, this progressive disclosure can materially reduce context, cache, and serving costs. Whether it is beneficial, however, depends on tool-call density, discovery latency, and end-to-end task quality.


Source: Baseten Blog (2026-11-19)

— END —

Tags: #Baseten #Deferred Tool Loading #MCP #Agent Inference #KV Cache

Editorial & Fact-Checking Note: This article is compiled from primary research, official release documentation, and source papers by the ZICQ Newsroom pipeline with automated entity verification and human editorial review. If you notice any technical inaccuracy, please submit a correction via our corrections policy or email our editorial desk directly.

What's your take on this story?
Explore & Submit Works

Community Comments

Loading live comments and annotations…