Skip to content

feat(eval): add run-wide token and cost budgets #6595

Open

Description

@chrisknvidia

Problem

Evaluation callers such as SkillEvaluator need to bound total model usage across tasks, agents, repeats and retries. Per-call output limits, per-agent turn/time limits and dispatch walltime do not bound aggregate tokens or USD spent by a concurrent evaluation.

At Gym main 5678f14c, the collector has dispatch time limits, recovery tracks retry and walltime budgets, and repeat planning estimates an experiment before execution. I could not find a supported evaluation-wide token/USD admission budget.

Proposal

Add optional run-wide usage accounting and controls that stop starting additional work when the configured budget is exhausted. Define:

  • Which agent, judge and auxiliary model calls count, including failed attempts and retries.
  • Concurrent admission and accounting for work already running.
  • USD pricing provenance and treatment of unknown or incomplete usage; missing measurements must not silently become zero.
  • Persistence across resume, so restarting does not reset consumed budget.
  • Whether the limit is an estimated admission limit or a strict enforcement guarantee, including treatment of in-flight work.

Keep evaluation-level admission in the evaluation control layer, coordinate measurement/enforcement with the model server, and reuse existing typed outcomes and stop/cleanup mechanisms where supported.

Acceptance criteria

  • Unset budgets preserve current behavior; zero and invalid budgets have explicit behavior.
  • Sequential and concurrent runs stop admitting work according to the documented policy.
  • Accounting covers selected call categories, retries and in-flight reservations without double-counting.
  • Resume preserves consumption and run identity.
  • Reports retain completed results and distinguish budget exhaustion, not-started work and failures, including measurement gaps and pricing provenance.
  • Integration coverage exercises concurrency, retries, missing usage, resume and cancellation.

Related work and duplicate check

Searched open and closed issues and PRs for budget, max_cost, max_agent_tokens, spending, cost cap and token cap; no equivalent run-wide token/USD admission request found. This is a feature proposal based on source review, not an implemented or runtime-validated capability.

Activity

  1. added
    community-request
    on Nov 21, 2026
  2. roy-tong commented on Nov 21, 2026

    @roy-tong

    Per-call limits do not compose. A run with two hundred calls each under the cap can still blow the aggregate budget by an order of magnitude. The useful primitive is a budget object owned by the run, checked before each call and settled after, so retries and nested tool calls count against the same ceiling. It also helps to expose remaining budget to the policy so it can degrade gracefully, shorter outputs or a cheaper model, instead of hard-failing at the end of a long eval, which is the most expensive possible outcome.

  3. added
    waiting-on-maintainers
    on Nov 23, 2026
  4. roy-tong commented on Dec 1, 2026

    @roy-tong

    The gap is that every existing budget is scoped to a call or an agent turn, while the thing you need to bound is the evaluation run. I'd add a run-scoped budget object with max_total_tokens, max_total_usd, max_attempts, and a reserve/commit/release protocol: reserve before dispatch, commit on completion, release on failure. The check that matters is a concurrent run that exceeds the token budget mid-flight; it must stop dispatching new work, drain in-flight work, and report the partial result with budget_exhausted rather than silently truncating. Do you want the budget to include judge/eval model calls, or only the policy under test?

  5. removed
    community-request
    on Dec 1, 2026
  6. added
    waiting-on-maintainers
    and removed
    waiting-on-maintainers
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Rolloutwaiting-on-maintainers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions