Skip to content

feat(run): configurable token budget limit #128

@LarsCowe

Description

@LarsCowe

Problem

No way to cap total token spend for a Ralph session. MAX_CALLS_PER_HOUR limits API calls per hour but not cumulative cost.

Proposal

New config option MAX_TOTAL_TOKENS=0 in .ralphrc (0 = unlimited):

  1. Track cumulative tokens across all loop iterations
  2. When cumulative tokens exceed the budget, gracefully exit (same flow as rate limit)
  3. Display remaining budget in the dashboard

Depends on #127 (token tracking).

Files

  • ralph/ralph_loop.shcan_make_call() (line 769)
  • ralph/templates/ralphrc.template

Priority

14/16 — Medium impact, 2 hours effort

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestralph-loopRalph autonomous loop improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions