Microsoft Research和UC Berkeley的一组研究人员拥有发布 TokenEconomizer,一个用于编码agents的开源成本控制器。 TokenEconomizer是一个在寄存器中从过去会话中吸取教训的插件,用于在以后的会话中切除废物。 它与Claude Code,Codex,GitHub Copilot CLI和Pi合作。 它不接触模型重量或agent代码。 在277个SWE-Bench任务中,在5个agent模式设置中将平均成本降低18.4%至30.9%。
TL;数据
- 软件包:一个标准图书馆Python软件包和agent插件,有3个可切换机制。
- 运行在:任何运行Claude Code,Codex,Copilot CLI或Pi的机器都带有Python 3.10+. 没有GPU和自己的API密钥。
- 性能:18.4%至30.9%,平均SWE-Bench成本较低,所有30个存储器设置单元成本较低。
- 最佳:Claude Code和Opus 4.8的费用降低30.9%(与RTK结合时降低33.2%)。
最糟的是:ReposVul审计只节省6.4%至9.3%;Pass@1在Opus 4.8上降低了1.0分。
为什么编码 agents 浪费符号?.
每个 agent 转动重告系统提示,每个装入的工具计划以及全部历史。 研究团队对60个SWE-Bench任务进行了剖析,它们使用Claude Code与Opus 4.8. 他们发现了三个重复出现的废物来源:
- 重复发现:一旦在目前的任务之前完成5项任务,30%的工具呼叫重复了先前的动作。
- 未使用的工具:每转弯23个工具计划装载。 16个从未被调用,3个覆盖98%的通话。
- 失败循环:10次失败运行是17%的任务,但占总支出的32%。
他们还测试了3个固定的开源策略:RTK,Serena和Aider的RepoMap. 到处都是便宜货 Django和SymPy的融资全部削减成本。
TokenEconomizer是怎样工作的?
TokenEconomizer是将agent视为黑匣子的外部控制器。 它保持每个寄存器的状态,由完成的痕迹所建。 在每项任务之前,它通过提示,工具设置和事件流设定3个政策。
1. 微型技能
LLM提议者将痕量文摘变成1行的事实,如工作测试指令。 每个事实都携带了regex探测器,这些探测器在没有模型呼叫的情况下检查后来的痕迹。 3 个未重叠编辑文件的任务确认后,事实会输入提示。 其需求率也必须保持在或高于0.4。 一个矛盾就等于5个确认,所以错误的事实很快就会消失。
2. 工具修补
贝壳,读,写和编辑工具总是保留。 其他工具在连续3个未使用的任务后被蒙上面具,或者当LLM法官标记它们无关紧要时。 完整目录每5个任务返回一次重新审计。 在带有Claude Code的Django上,任务2的第一个请求从43,351降为16,295个即时信使。
3. 失败干预
控制器学习一个转弯预算:是成功运行长度的90%的1.25倍。 廉价规则检查标记重复失败或密集错误。 LLM法官然后决定agent是否卡住,在0.7置信度或更高。 一个卡住的agent得到1个方向方向,如果循环重现则停止。
SWE -Bench结果显示什么?
资料来源:arXiv 2610.22732,表1. 费用包括所有控制员的电话。 每设三种子。
5个设置中有4个改进了通过@1。 较低的推理努力节省了成本,但将Pass@1减少了1.8至10.3分。 仅RTK在30个寄存器设置单元格中的12个为融资成本,15个为RepoMap.
储蓄逐渐积累。 大部分的储存库起初成本较高,但第六项任务都比较便宜。 单在Claude Code上,工具推跑节省了13.2%至17.7%,微技能11.8%至14.3%,循环护卫5.4%至7.1%。
成果也在SWE-Bench之外举行。 在Web-Bench上,成本下降16.0%至21.2%,在CredData上,成本下降16.5%至19.6%。 ReposVul只看到6.4%到9.3%,因为较短的运行时间需要去除的时间较少。
如何与其他节纸工具相比?
成本行:TokenEconomizer纸张。 许可证和声称:每个项目的存储器或文件。
如何安装 TokenEconomizer?
该插件需要4agents和Python 3.10或更新的之一。 在Claude Code上,克隆repo,将其添加为市场,然后运行claude插件安装sordereconomizer@tokeneconomizer. 所学数据留在 ~/.tokeneconomizer 中。 工具搜索和循环保护默认启动。 微技能默认关闭,因为提议者新增模型调用。
关键外卖
- TokenEconomizer 削减 SWE-Bench 成本为18.4%至30.9%,agent不变。
- 在所有30个仓库设置单元中,价格较低;RTK和RepoMap没有。
- 工具推拉是最大的单杠杆,为13.2%至17.7%。
- Pass@1在5个设置中上升了4个,在Opus 4.8上跌了1.0点。
- 是Apache 2.0,安装在Claude Code,Codex,Copilot CLI和Pi上。
请检查access-date=中的日期值 (帮助) 页面存档备份,存于互联网档案馆页面存档备份,存于互联网档案馆 GitHub Repo and Project Page. 并加入我们的通讯。 等等你在电报里吗现在你也可以加入我们的电报。
需要和我们合作推广您的 GitHub Repo OR Hugging Face Page OR Product Release OR Webinar 等吗?联系我们
Asif Razzaq是Marktechpost AI Media Inc.的首席执行官。 作为一个有远见的企业家和工程师,阿西夫致力于利用人工智能的潜力促进社会福祉。 他最近的努力是人工智能媒体平台的发布,该平台以深入报道机器学习和深层学习新闻而著称,这些新闻在技术上既可靠又为广大观众所容易理解。 该平台每月有超过200万次观看,表明其受观众欢迎。
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
A team of researchers from Microsoft Research and UC Berkeley have released TokenEconomizer, an open-source cost controller for coding agents. TokenEconomizer is a plugin that learns from past sessions in a repository to cut waste in later ones. It works with Claude Code, Codex, GitHub Copilot CLI and Pi. It does not touch model weights or agent code. On 277 SWE-Bench tasks, it lowered mean cost by 18.4% to 30.9% across 5 agent-model settings.
TL;DR
- Package: A standard-library Python package and agent plugins, with 3 switchable mechanisms.
- Runs on: Any machine running Claude Code, Codex, Copilot CLI or Pi with Python 3.10+. No GPU and no API key of its own.
- Performance: 18.4% to 30.9% lower mean SWE-Bench cost, and cheaper in all 30 repository-setting cells.
- Best: 30.9% lower cost on Claude Code with Opus 4.8 (33.2% when combined with RTK).
- Worst: Only 6.4% to 9.3% savings on ReposVul audits; Pass@1 drops 1.0 point on Opus 4.8.
Why do coding agents waste tokens?
Every agent turn re-bills the system prompt, every loaded tool schema and the full history. The research team profiled 60 SWE-Bench tasks across 6 repositories using Claude Code with Opus 4.8. They found 3 recurring sources of waste:
- Repeated discovery: once 5 tasks precede the current one, 30% of tool calls repeat an earlier action.
- Unused tools: 23 tool schemas load every turn. 16 are never called, and 3 cover 98% of calls.
- Failure loops: 10 failed runs were 17% of tasks but 32% of total spend.
They also tested 3 fixed open-source strategies: RTK, Serena and Aider’s RepoMap. None was cheaper everywhere. All 3 cut cost on Django and raised it on SymPy.
How does TokenEconomizer work?
TokenEconomizer is an external controller that treats the agent as a black box. It keeps a state per repository, built from completed traces. Before each task, it sets 3 policies through the prompt, the tool settings and the event stream.
1. Micro-skills
An LLM proposer turns trace digests into 1-line facts, such as the working test command. Each fact carries regex detectors that check later traces without a model call. A fact enters the prompt after 3 confirmations on tasks with non-overlapping edited files. Its need rate must also stay at or above 0.4. One contradiction counts as 5 confirmations, so wrong facts retire quickly.
2. Tool pruning
Shell, read, write and edit tools are always kept. Other tools are masked after 3 consecutive unused tasks, or when an LLM judge marks them irrelevant. The full catalog returns every 5 tasks for a re-audit. On Django with Claude Code, the first request on task 2 fell from 43,351 to 16,295 prompt tokens.
3. Failure-loop intervention
The controller learns a turn budget: 1.25 times the 90th percentile of successful run lengths. Cheap rule checks flag repeated failures or dense errors. An LLM judge then decides if the agent is stuck, at 0.7 confidence or higher. A stuck agent gets 1 redirect, then a stop if the loop recurs.
What do the SWE-Bench results show?
Source: arXiv 2610.22732, Table 1. Costs include all controller calls. 3 seeds per setting.
Pass@1 improved in 4 of 5 settings. Lower reasoning effort saved cost but cut Pass@1 by 1.8 to 10.3 points. RTK alone raised cost in 12 of 30 repository-setting cells, and RepoMap in 15.
Savings build over time. Most repositories cost more at first, but all were cheaper by the sixth task. Alone on Claude Code, tool pruning saved 13.2% to 17.7%, micro-skills 11.8% to 14.3%, and the loop guard 5.4% to 7.1%.
Results also held outside SWE-Bench. Costs fell 16.0% to 21.2% on Web-Bench and 16.5% to 19.6% on CredData. ReposVul saw only 6.4% to 9.3%, because shorter runs leave less to remove.
How does it compare with other token-saving tools?
Cost rows: TokenEconomizer paper. Licenses and claims: each project’s repository or docs.
How do you install TokenEconomizer?
The plugin needs one of the 4 agents and Python 3.10 or newer. On Claude Code, clone the repo, add it as a marketplace, then run claude plugin install tokeneconomizer@tokeneconomizer. Learned data stays local in ~/.tokeneconomizer. Tool pruning and the loop guard are on by default. Micro-skills are off by default, because the proposer adds model calls.
Key Takeaways
- TokenEconomizer cuts SWE-Bench cost 18.4% to 30.9% with an unchanged agent.
- It was cheaper in all 30 repository-setting cells; RTK and RepoMap were not.
- Tool pruning is the biggest single lever, at 13.2% to 17.7%.
- Pass@1 rose in 4 of 5 settings and fell 1.0 point on Opus 4.8.
- It is Apache 2.0 and installs on Claude Code, Codex, Copilot CLI and Pi.
Check out the Paper, GitHub Repo and Project Page. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
Asif Razzaq is the CEO of Marktechpost AI Media Inc.. As a visionary entrepreneur and engineer, Asif is committed to harnessing the potential of Artificial Intelligence for social good. His most recent endeavor is the launch of an Artificial Intelligence Media Platform, Marktechpost, which stands out for its in-depth coverage of machine learning and deep learning news that is both technically sound and easily understandable by a wide audience. The platform boasts of over 2 million monthly views, illustrating its popularity among audiences.
Auto-fetched and translated by AI Atlas. All rights belong to the original author.