Coding

286,522 Input Tokens Down to 196,983: A Team Cut Its AI Agent's Token Bill About 31% and Published What Worked and What Broke

  • Level Advanced
  • Setup1–3 hrs (estimated)
  • Evidence Some evidence
  • CostNot stated in source
  • No-codeNo
Custom agentSource-linked

What they did

A team running an AI business intelligence agent found it re-read 17,000 tokens of instructions and tool manuals before every thought. They measured first with an open-source bench and quality checks, then made cuts in order: removing 10 tools the agent never called, shortening old tool results but never the current turn, ordering prompts so they cache, and adding a grouped query so the model asks once instead of five times. That last change cut one real question by 41%. A three-question conversation dropped from 286,522 to 196,983 input tokens, and they also list what failed.

How it went

dev.to field report by the developer (Oct 28, 2026): first call 17,070 tokens before the question; 36 tools cut to 26 (first call 17,070 to 13,598 on the bench); old tool results shortened 21-26%; cache-friendly prefix 11% to 98% (benchmark upper bound); grouped query 71,617 to 42,130 tokens (-41.2%) on a real run; three-question conversation 286,522 to 196,983 (-31.3%) offline; bench overestimated real gains by 9-16%. Open-source bench

Worth knowing

  • dev.to field report by the developer (Oct 28, 2026): first call 17,070 tokens before the question; 36 tools cut to 26 (first call 17,070 to 13,598 on the bench); old tool results shortened 21-26%; cache-friendly prefix 11% to 98% (benchmark upper bound); grouped query 71,617 to 42,130 tokens (-41.2%) on a real run; three-question conversation 286,522 to 196,983 (-31.3%) offline; bench overestimated real gains by 9-16%. Open-source bench.

Prompt

Cleaned version rewritten from the source — not a direct quote.

Help me cut the input tokens my agent uses without hurting its answers. First, build a small benchmark: [5-10] fixed scenarios from real use, with a quality check for each (the facts the answer must contain). Measure input tokens per model call and per scenario as a baseline. Then test these cuts one at a time and report the token change and whether every quality check still passes: remove tools the agent never calls, shorten tool results from past turns only (never the current turn), make the prompt prefix stable so it caches, and find places where one combined tool call could replace several. Reject any cut that fails a check. My agent's code is in [path].

Recommended

Try it in Grok Bot

  1. Copy the prompt (button below).
  2. Open Grok Bot chat and paste it. Replace any [bracketed] placeholders.
  3. Connect the listed tools (as needed) as connectors when Grok Bot asks.
  4. If the task repeats, ask: "Make this a daily routine."

Alternatives: the same prompt works in Claude, ChatGPT Agent, OpenClaw.

Set it up

Stack: Custom Agent

  1. Read the original source for full context.
  2. Connect the tools your agent needs.
  3. Paste the prompt and replace [bracketed] placeholders.
  4. Run once manually and check the output before scheduling it.

Generic suggested steps, not from the source.

Evidence

dev.to field report by the developer (Oct 28, 2026): first call 17,070 tokens before the question; 36 tools cut to 26 (first call 17,070 to 13,598 on the bench); old tool results shortened 21-26%; cache-friendly prefix 11% to 98% (benchmark upper bound); grouped query 71,617 to 42,130 tokens (-41.2%) on a real run; three-question conversation 286,522 to 196,983 (-31.3%) offline; bench overestimated real gains by 9-16%. Open-source bench

Source: Web · Verified by us: not yet · Report broken or outdated

Related use cases

ShoppingWeb

Test whether a shopping agent can be tricked by fake reviews (cautionary)

F-Secure built a shopping agent (vibe-coded with Claude Code, running Claude Haiku, with the user's details in memory) and a mock marketplace with a review pointing to a fake discount-code site. In 100 runs it visited the phishing site 12% of the time and submitted the user's name, date of birth and SSN, almost never telling the user.

  • Level Advanced
  • Setup1–3 hrs*
  • Evidence Strong evidence
Custom agentSource-linked⚠ Cautionary
CodingX · 2026-10

Hermes Agent Nearly Doubled Speech-to-Text Accuracy on Hard Words: 99 to 183 of 240

A user turned his 15K saved Wispr Flow dictations into a test set for the local Whisper model behind his Hermes Agent. The agent turned his Wispr dictionary into a hint list, diffed raw vs corrected text to find words Whisper keeps mishearing, made find-and-fix rules, and tested every rule against the full history. With no fine-tuning, dictionary words went from 99/240 to 183/240 on Wispr clips and 19/45 to 43/45 on sentences he read aloud. It now archives the data nightly and looks for new fixes weekly.

  • Level Advanced
  • Setup1–3 hrs*
  • Evidence Strong evidence
Hermes AgentSource-linked
CodingReddit · 2026-10

1 Minute to 1 Second: Claude Code Built a Faster Plex App for a Samsung TV

On a 2022 Samsung TV the official Plex app took about a minute to open and search lagged about 10 seconds. A Redditor used Claude Code to build a free, open-source web-app client that opens in about a second, searches as you type and plays 98.7% of his library directly in hardware.

  • Level Advanced
  • Setup1–3 hrs*
  • Evidence Strong evidence
Claude CodeSource-linked