Skip to content

[v1.1] Budget limits and cost controls #27

@frankbria

Description

@frankbria

Problem

Users have no way to limit E2B spending, leading to potential surprise costs for long-running or many parallel tasks.

Proposed Solution

Session Budget Limits

# Limit single session
parallel-cc sandbox-run --repo . --prompt "Task" --budget 0.50

# Limit is in USD
# Session terminates if limit reached

Global Budget Limits

# Set global monthly limit
parallel-cc config set budget.monthly-limit 10.00

# Set per-session default
parallel-cc config set budget.per-session 1.00

Notifications

  • Warning at 50% of budget
  • Warning at 80% of budget
  • Hard stop at 100%

Cost Tracking

  • Track actual costs per session
  • Daily/weekly/monthly reports
  • Cost breakdown by task type

Database Schema

ALTER TABLE sessions ADD COLUMN budget_limit REAL;
ALTER TABLE sessions ADD COLUMN cost_estimate REAL;
ALTER TABLE sessions ADD COLUMN actual_cost REAL;

CREATE TABLE budget_tracking (
  id TEXT PRIMARY KEY,
  period TEXT, -- 'daily', 'weekly', 'monthly'
  period_start TEXT,
  budget_limit REAL,
  spent REAL,
  created_at TEXT
);

Files to Modify

  • src/cli.ts - Add budget flags
  • src/e2b/sandbox-manager.ts - Monitor and enforce limits
  • src/db.ts - Budget tracking tables

Acceptance Criteria

  • Per-session budget limits work
  • Global budget limits configurable
  • Cost tracking persisted to database
  • Warnings issued at configurable thresholds
  • parallel-cc budget-status shows current spending

Dependencies

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions