Skip to content

feat(llc/budget): token-based budget mode β€” track agent budgets in token counts alongside dollar amountsΒ #8997

Closed

Description

@mrveiss

Summary

8πŸ‘ Paperclip #1756, 13πŸ‘ Paperclip #339. The LLC budget system tracks costs in cents (budget.py). Users running agents on subscription plans (Claude Max, ChatGPT Plus) or free-tier models cannot express budgets in dollar terms β€” they need token-count budgets instead.

What Users Want

  • Budget mode selector per agent: tokens or dollars
  • When in token mode: monthly token allowance, hard stop at limit
  • Token consumption displayed in agent activity log alongside cost
  • Projected token burn rate shown in budget dashboard
  • Shadow cost tracking (estimate dollar equivalent even for subscription agents)

AutoBot Fit

autobot-backend/llc/models/budget.py + autobot-backend/llc/services/ budget enforcement. Add budget_mode enum (cents | tokens) and token_limit field to the budget model. The watchdog scheduler (llc/scheduler/) already fires on cost overrun β€” extend to token overrun. Frontend: BudgetPolicies.vue.

Acceptance Criteria

  • Agent budget can be set in tokens or cents (not both)
  • Token consumption tracked per heartbeat run
  • Hard stop fires when token budget exceeded (same as dollar hard stop)
  • Budget dashboard shows token mode agents with token progress bar
  • Shadow cost estimate shown for token-mode agents

Activity

  1. self-assigned this
    on Jun 4, 2026
  2. github-actions commented on Jun 11, 2026

    @github-actions
    Contributor

    PR #9998 (merged to Dev_new_gui) references this issue with a close keyword.

    feat(llc/budget): token-based budget mode with shadow cost tracking (#8997)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  3. mrveiss commented on Jun 11, 2026

    @mrveiss
    OwnerAuthor

    Closed β€” merged to Dev_new_gui via PR #9998 (squash commit e6e3cff71).

    Acceptance criteria:

    • βœ… Budget in tokens OR cents: budget_mode + token_limit (schema pre-existed via migration 20260604_036; this PR added enforcement) β€” cross-mode 400 validation on PATCH
    • βœ… Token consumption per heartbeat run: ingest already carried tokens_in/tokens_out; accumulation enforced
    • βœ… Hard stop on token exhaustion: BudgetExhausted on ingest + watchdog β‰₯100% hard-stop/β‰₯80% soft-notify (token ratio), identical semantics to dollar mode; tokens-mode-without-limit falls back to dollar enforcement consistently across service + watchdog
    • βœ… Dashboard token progress bar + mode badge (CostDashboard.vue β€” pre-existing, verified wired)
    • βœ… Shadow cost: USD accumulates in both modes; shadow_cost_usd in hard-stop payload, ~$X.XX in UI

    36/36 budget tests; independent review APPROVE β€” M1 (stale tracker cache after PATCH β†’ now invalidated) and M2 (watchdog/service disagreement on tokens-without-limit) fixed in-PR.

    Discovery (pre-existing, noted by reviewer): directory-scoped pytest llc/tests/ breaks api tests via test_health_probe.py sys.modules stubbing β€” same family as #9995.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions