token-budget-tracking

Track token consumption and enforce per-agent budget limits in multi-agent workflows.

364|53|Updated May 9, 2026
One-click install
npx skills add https://github.com/cosmicstack-labs/mercury-agent-skills --skill token-budget-tracking
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-budget-tracking
Source: https://github.com/cosmicstack-labs/mercury-agent-skills/tree/main/categories/ai-ml/token-budget-tracking
Command: npx skills add https://github.com/cosmicstack-labs/mercury-agent-skills --skill token-budget-tracking

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents runaway costs in production multi-agent LLM systems by tracking token usage, attributing spend, and enforcing budget limits before overages occur.

Core Features & Use Cases

  • Real-time token accounting with attribution: tracks prompt vs completion tokens and aggregates usage by agent and task to identify what’s costly.
  • Budget enforcement and reservation: applies per-agent and global (daily/weekly) token ceilings, blocking requests that would exceed limits.
  • Token optimization and proactive cost controls: compresses context, summarizes older history, and selects more cost-effective model tiers based on available budget.
  • Budget dashboards and alerting rules: generates current burn status, cost estimates, and threshold-based alerts (spikes, runaway detection, forecast notifications).
  • Use case: in an agent workflow that loops through research and code steps, allocate daily budgets per agent, detect a spike from one agent-task pair, compress context automatically, and switch to cheaper models for low-difficulty steps.

Quick Start

Ask your AI system to instrument token tracking, define per-agent and daily budgets, enable alerts at 80% spend, and run a budget-optimized request flow that compresses context when usage is near the limit.

Frequently Asked Questions about token-budget-tracking

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I track and control LLM token spend in multi-agent workflows?

Token tracking in multi-agent systems works by attributing prompt and completion tokens per agent and task, aggregating usage against daily or weekly ceilings, and blocking requests that would exceed limits before overages occur.

How do I enforce per-agent token budgets to prevent runaway LLM costs?

Enforce per-agent token budgets by applying reservation checks before requests, setting global daily and weekly ceilings, and blocking any agent-task pair from executing if its token usage would exceed allocated limits.

Can I automatically compress context and switch models when token usage nears the limit?

Yes, proactive cost controls automatically summarize older history, compress context, and select more cost-effective model tiers for low-difficulty steps when available budget is low or threshold alerts trigger.

How do I set up alerts for LLM cost spikes and runaway token consumption?

Set up alerts by defining threshold-based rules at 80% spend, configuring spike detection and runaway pattern monitoring per agent-task pair, and generating forecast notifications for projected cost overages.

What is token attribution and when do I need it for production agent loops?

Token attribution aggregates prompt and completion usage by specific agent and task to identify what is costly. You need it in recurring agent loops to detect spikes, allocate daily budgets, and optimize context compression.