← 返回 Skills 市场
chloepark85

Agent Budget Controller

作者 Chloe Park · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
221
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install agent-budget-controller
功能描述
Control LLM API spending per agent. Set daily/weekly/monthly limits with real-time tracking and alerts.
使用说明 (SKILL.md)

Agent Budget Controller

💰 Stop LLM cost overruns before they happen

Track, limit, and alert on LLM API costs per agent with daily/weekly/monthly budgets.

What It Does

  • Set budget limits — Global or per-agent, daily/weekly/monthly
  • Track usage — Automatic cost calculation for 10+ LLM models
  • Alert on thresholds — 70% warning, 90% critical, 100% blocked
  • Generate reports — Usage summaries and cost breakdowns
  • Zero dependencies — Pure Python stdlib, local-only

Quick Start

# Initialize
budget init

# Set limits
budget set --daily 3.00 --weekly 15.00 --monthly 50.00
budget set --agent ubik-pm --daily 1.00

# Log usage (manual - see Integration below)
budget log --agent ubik-pm --model "claude-sonnet-4-5" \
  --input-tokens 5000 --output-tokens 1500

# Check status
budget status
budget status --agent ubik-pm

# Check limits (exit code)
budget check  # exit 0=ok, 1=exceeded

Commands

Command Purpose
init Initialize budget tracking
set Set budget limits
log Log API usage
status Show current usage vs limits
check Check if limits exceeded (exit code)
report Generate detailed period report
agents List agents with limits or activity
pricing Show/update model pricing
history Show recent usage history

Supported Models

Built-in pricing for:

  • OpenAI: gpt-4o, gpt-4o-mini, o1, o1-mini
  • Anthropic: claude-sonnet-4-5, claude-opus-4, claude-haiku-3.5
  • Google: gemini-2.5-flash, gemini-2.5-pro, gemini-2.0-flash

Custom models:

budget pricing --update --model my-model \
  --input-price 1.50 --output-price 5.00

Integration

OpenClaw Heartbeat

Add to HEARTBEAT.md:

## Budget Monitoring

Every 4 hours:
1. Check budget status: `budget status`
2. If any agent >90%, notify Director
3. If any exceeded, escalate immediately

Pre-call Hook (Future)

# In agent wrapper script
budget check --agent $AGENT_NAME || {
  echo "❌ Budget exceeded for $AGENT_NAME"
  exit 1
}

# Call LLM API...
# Log after call
budget log --agent $AGENT_NAME \
  --model "$MODEL" \
  --input-tokens $INPUT_TOKENS \
  --output-tokens $OUTPUT_TOKENS

Cron (Daily Report)

# Send daily report to Telegram
0 9 * * * budget report --period day | \
  openclaw msg --channel telegram --target @director

Alert Levels

Usage Level Symbol Action
\x3C70% OK Continue
70-89% Warning ⚠️ Monitor
90-99% Critical 🔴 Alert Director
≥100% Exceeded 🚫 Block calls

Data Storage

~/.openclaw/budget/
├── config.json       # Budget limits
├── pricing.json      # Model pricing (optional override)
└── usage.jsonl       # Append-only usage log

Privacy: All data stored locally. No network calls.

Examples

See EXAMPLE.md for complete usage scenarios.

Testing

cd ~/ubik-collective/systems/ubik-pm/skills/agent-budget-controller
python3 tests/test_budget.py

Security

  • ✅ Zero external dependencies
  • ✅ No network calls
  • ✅ Local-only data storage
  • ✅ Pure Python stdlib

Safe for ClawHub distribution.

License

MIT-0 (public domain equivalent)

安全使用建议
This skill appears to implement a local per-agent budget tracker as advertised, but check two things before installing: 1) Manifest vs docs: SKILL.md lists 'uv' as a required binary while INSTALL.md treats 'uv' as an optional installer tool. You only need python3 to run the CLI; 'uv' shouldn't be mandated at runtime. If you don't use 'uv', you can run scripts directly with python3. 2) Data egress in examples: Several examples/cron lines show piping budget reports to external message channels (Telegram, email, OpenClaw message send). The skill itself stores data locally, but those integration examples will transmit usage/cost data outside your machine. Only enable such integrations if you trust the destination and tooling. 3) Enforcement expectations: The docs are inconsistent about 'blocking' at 100% — the code and README indicate budget.check returns an exit code but does not automatically prevent LLM calls; you must wrap agent invocation (pre-call hook) to enforce blocks. If you need automatic enforcement, implement a wrapper that calls `budget check` and aborts when exit code != 0. 4) Quick checks to run locally before trusting it: inspect scripts/budget.py for subprocess or network usage, run the included tests (python3 tests/test_budget.py), and verify the files are written only under ~/.openclaw/budget/. If you want stricter privacy, avoid setting up cron/heartbeat lines that forward reports off-host. Given these inconsistencies (manifest requirement for 'uv' and the presence of external-report examples plus mismatched enforcement claims), treat the skill as suspicious until you confirm the installer/CI/integration steps you plan to use and audit the CLI script for any unexpected network calls.
功能分析
Type: OpenClaw Skill Name: agent-budget-controller Version: 1.0.0 The agent-budget-controller bundle is a legitimate utility designed to track and limit LLM API expenditures. The code is well-structured, uses only the Python standard library, and performs all operations locally (storing data in ~/.openclaw/budget/). There is no evidence of network activity, data exfiltration, or malicious execution patterns. The documentation (SKILL.md, README.md) accurately reflects the code's functionality, and the security claims regarding zero dependencies and local-only storage are verified by the source files (lib/tracker.py, lib/config.py, and scripts/budget.py).
能力评估
Purpose & Capability
The name, description, and included Python libraries (config/pricing/tracker/reporter) match the stated purpose of per-agent budget tracking. However the skill manifest declares the 'uv' binary as required while the codebase and README treat 'uv' as an optional installer helper; marking 'uv' as required is disproportionate. The package includes a pyproject.toml and CLI scripts (so an install is possible) which is consistent, but the 'zero dependencies' claim is slightly overstated because it still relies on a Python runtime and optional packaging tooling.
Instruction Scope
The SKILL.md and examples are mostly local-only, but several examples and cron/heartbeat integrations explicitly pipe reports to external channels (e.g., openclaw msg / Telegram, email, GitHub Actions). That directs potentially sensitive usage/cost data to external endpoints via the user's message tooling. Additionally the documentation contains a mixed message about enforcement: some places say 100% = 'blocked', but other sections and 'known limitations' state the tool only returns an exit code and does not automatically block calls — so callers must implement wrapper enforcement. These are functional and privacy-relevant inconsistencies that a deployer should understand before enabling automated flows.
Install Mechanism
This is an instruction-first skill with source files included (no remote downloads). There is no install spec in the manifest, and all files are local. The only oddity is the manifest metadata declaring 'uv' as a required binary; 'uv' appears only as an optional installer helper in INSTALL.md. No network-based installers or obscure URLs are used — install risk is low if you run the code locally.
Credentials
The skill requests no environment variables or credentials and stores data under a dedicated path (~/.openclaw/budget). That is proportionate for a local budget tracker. The only privacy concern is that examples show sending reports externally via separate tooling (openclaw message send / telegram / email), but those actions are performed by external commands the user configures, not the skill itself.
Persistence & Privilege
always:false and no special privileges are requested. The skill writes only to its own directory (~/.openclaw/budget/) and does not modify other skills or global agent settings. It does not request persistent elevated presence.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-budget-controller
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-budget-controller 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: zero-dependency LLM cost tracking with per-agent limits and alerts
元数据
Slug agent-budget-controller
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Agent Budget Controller 是什么?

Control LLM API spending per agent. Set daily/weekly/monthly limits with real-time tracking and alerts. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 221 次。

如何安装 Agent Budget Controller?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-budget-controller」即可一键安装,无需额外配置。

Agent Budget Controller 是免费的吗?

是的,Agent Budget Controller 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agent Budget Controller 支持哪些平台?

Agent Budget Controller 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agent Budget Controller?

由 Chloe Park(@chloepark85)开发并维护,当前版本 v1.0.0。

💬 留言讨论