Skip to content

Design & implement cost/token budgets #121

@AlexChesser

Description

@AlexChesser

Summary

Design per-step and per-run token limits, cost caps, and budget-aware execution. This is NOT IN SPEC and requires spec authoring.

Parent issue: #105 — Tier 3, Priority #10

Why

In production, runaway costs from long context or retry loops are a real operational risk. A budget: field per step or per pipeline would enable cost-aware model selection and prevent blowouts. This is especially critical once iterative loops (#116) and retry (#108) are implemented.

Design Decisions Needed

  • Budget unit — tokens? Dollars? Both?
  • Granularity — per-step, per-pipeline, per-run, or all three?
  • YAML syntax — budget: block with max_tokens:, max_cost:?
  • Behavior when budget exceeded — abort? switch to cheaper model? warn and continue?
  • How to track token usage across steps (runner must report usage)
  • Interaction with model cascading (multi-provider routing) — auto-downgrade when budget is low?
  • How budget state is exposed in template variables (e.g. {{ budget.remaining_tokens }})

Spec Work Required

New spec section needed for budget/cost control.

Acceptance Criteria

  • Spec section authored
  • Budget limits can be declared at pipeline and/or step level
  • Token/cost tracking per step
  • Configurable behavior when budget is exceeded
  • Budget state visible in turn log

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions