我建立了一个MCP服务器,以便我的AI代理能够跟踪自己的开支
📄 中文摘要
大多数代理框架缺乏成本意识,代理在调用LLM后并不知道自己消耗了多少钱。为了避免超出预算,开发了一种轻量级的跟踪器,可以在每次LLM调用后进行调用,并设置硬性上限。构建了三个层次的系统:BudgetGuard(后调用跟踪)、AgentWatchdog(运行时电路断路器)和MCP服务器。通过简单的安装命令和配置,可以轻松集成到Claude Desktop中。自二月份以来,该系统已在实际使用中运行,帮助用户有效管理开支。
📄 English Summary
I Built an MCP Server So My AI Agent Can Track Its Own Spending
Most agent frameworks lack cost awareness, meaning that agents do not recognize the expenses incurred after calling an LLM. To prevent overspending, a lightweight tracker was developed that can be called after each LLM call, with a hard cap to stop spending before exceeding the budget. The system consists of three layers: BudgetGuard (post-call tracking), AgentWatchdog (runtime circuit breaker), and an MCP Server. Installation is straightforward with a simple command and configuration for integration into Claude Desktop. Since February, this system has been in practical use, assisting users in effectively managing their expenses.
Powered by Cloudflare Workers + Payload CMS + Claude 3.5
数据源: OpenAI, Google AI, DeepMind, AWS ML Blog, HuggingFace 等