Wink Pings

90 Tools, 241.7 KB of Definitions: Every Agent Call Pays for Tools It Doesn't Use

Redis's Context Gateway uses search_tools and run_tool for on-demand tool discovery. Avi Chawla tested it with 90 synthetic tools, and input tokens dropped from 90,941 to 28,606. The token savings are real, but the caching layer has other costs to account for.

Agents often stuff hundreds of KB of tool definitions into the prompt when calling a model. The problem isn't that the model doesn't know the tools; it's that it has to reread them every time.

Avi Chawla worked with Redis on a test: 90 synthetic tools covering support, CRM, and billing. The direct path sends 241.7 KB of tool definitions on every model call. Redis Iris's Context Gateway first gives the model only two tools, totaling 1.1 KB, and then searches on demand. Over a complete run, input tokens dropped from 90,941 to 28,606, a reduction of about 70%.

This number includes tool discovery and tool results, not just savings on the initial definitions.

Context Gateway is one of six Redis Iris capabilities. It maintains a catalog that stores definitions from connected tool servers. In search mode, the agent initially sees only two tools:

  • search_tools: finds matching tool definitions, letting the model choose a tool and construct arguments.
  • run_tool: routes the selected operation to the backend server and returns the result.

For a support ticket question, it only fetches ticket-related tools and does not load definitions for refunds, invoices, or subscription changes. If the next step needs billing data, the agent searches again.

In the test, Avi compared using the same model, the same question, and the same backend data. The video below shows the actual process:

Saving tokens sounds like a financial issue, but it is first a context-window issue. Repeated tool definitions take up space, push out genuinely useful context, and slow down every turn of the agent loop.

But don't rush to delete the entire tool catalog. Avi added in the tweet: after the catalog disappears from the prompt, the remaining tokens are still sent every turn. Context Gateway solves on-demand loading of tool definitions, not all repeated input.

He previously wrote an article specifically breaking down four types of caching in the LLM stack that are often conflated:

  • KV cache stores attention tensors within a single request.
  • Prefix caching keeps these tensors on the server, indexed by a hash chain of token IDs.
  • Prompt caching is the cloud providers' billing version of prefix hits. Anthropic's write price is 1.25× base input, and its read price is 0.1×. OpenAI uses the same two multipliers on current models.
  • Semantic cache stores already-generated answer strings, keyed by cosine similarity of embeddings.

The first three are exact matching; a miss only affects cost and latency. The fourth is fuzzy matching; a hit can directly give you a wrong answer, complete with a normal 200 status code.

Avi gave an example in the article: How do I reset my password? and How can I reset my password? have a similarity of 0.961; this is a true paraphrase, so they can share an answer. But Is the API rate limited? and Is the API not rate limited? have a similarity of 0.952; one negation apart, the answers are opposite. Refund policy for annual plans and Refund policy for monthly plans have a similarity of 0.887; one business value apart, the answers are also different.

These three scores are too close together, making it hard for a threshold to preserve both hit rate and correctness. A commenter in the replies mentioned that semantic caching most easily fails on time sensitivity: if the same question's answer changes four hours later, embeddings can't tell the difference, so time-sensitive content now goes through a hard TTL layer before the similarity check.

Back to the Redis tool. Context Gateway is positioned as an MCP endpoint that brings in tools from any MCP server and Redis data. It is suited to agents with many tools, large tool definitions, and repeated stuffing into the prompt on every call. The value is direct: load fewer useless definitions, pay for fewer input tokens, and take up less context.

Before using it, measure three things: how many tokens tool definitions occupy in one agent turn, how much of the prefix is stable across repeated calls, and whether you really need semantic caching. Context Gateway and prefix caching can help with the first two questions; for the third, you first need to see whether your business can tolerate fuzzy hits.

More details are in the Redis Iris documentation: https://fandf.co/4A4YXn8

Avi's caching article: https://x.com/i/article/2093210840468189184

Original tweet: https://x.com/DailyDoseOfDS_/status/2127311145224769988

发布时间: 2026-11-30 19:32