feat(budget): implement CostTracker service for per-session and per-plan spending tracking #10142

Open
opened 2026-04-17 03:56:29 +00:00 by HAL9000 · 0 comments
Owner

Background

Cost visibility and control are critical for production deployments of CleverAgents. The CostTracker service provides real-time tracking of token usage and estimated costs per session and per plan, enabling budget enforcement and cost reporting features that prevent runaway spending.

Acceptance Criteria

  • CostTracker service implemented with per-session and per-plan cost accumulation
  • Token usage tracked per LLM call (input tokens, output tokens, cached tokens)
  • Cost estimation based on provider pricing tables (configurable)
  • CostTracker accessible from PlanExecutor and CLI output
  • Test coverage >= 97%

Metadata

  • Commit Message: feat(budget): implement CostTracker service for per-session and per-plan spending tracking
  • Branch: feature/v3.6.0/cost-tracker-service
  • Milestone: v3.6.0
  • Ref: #5178 EPIC: Cost & Session Budget Enforcement — Spending Limits & Safety Profiles (v3.6.0)

Subtasks

  • Define CostTracker service interface and data models
  • Implement token usage accumulation per LLM call
  • Implement cost estimation with provider pricing tables
  • Integrate CostTracker into PlanExecutor LLM call path
  • Write unit tests for cost accumulation and estimation

Definition of Done

  • Implementation complete and all acceptance criteria met
  • Tests written and passing (coverage >= 97%)
  • PR reviewed and merged
  • Parent epic updated

Automated by CleverAgents Bot
Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor

## Background Cost visibility and control are critical for production deployments of CleverAgents. The CostTracker service provides real-time tracking of token usage and estimated costs per session and per plan, enabling budget enforcement and cost reporting features that prevent runaway spending. ## Acceptance Criteria - [ ] `CostTracker` service implemented with per-session and per-plan cost accumulation - [ ] Token usage tracked per LLM call (input tokens, output tokens, cached tokens) - [ ] Cost estimation based on provider pricing tables (configurable) - [ ] `CostTracker` accessible from `PlanExecutor` and CLI output - [ ] Test coverage >= 97% ## Metadata - **Commit Message**: `feat(budget): implement CostTracker service for per-session and per-plan spending tracking` - **Branch**: `feature/v3.6.0/cost-tracker-service` - **Milestone**: v3.6.0 - **Ref**: #5178 EPIC: Cost & Session Budget Enforcement — Spending Limits & Safety Profiles (v3.6.0) ## Subtasks - [ ] Define `CostTracker` service interface and data models - [ ] Implement token usage accumulation per LLM call - [ ] Implement cost estimation with provider pricing tables - [ ] Integrate `CostTracker` into `PlanExecutor` LLM call path - [ ] Write unit tests for cost accumulation and estimation ## Definition of Done - Implementation complete and all acceptance criteria met - Tests written and passing (coverage >= 97%) - PR reviewed and merged - Parent epic updated --- **Automated by CleverAgents Bot** Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10142
No description provided.