-
Notifications
You must be signed in to change notification settings - Fork 0
Implement per-call cost tracking and usage logging #7
Copy link
Copy link
Closed
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:medium1-3 days of work1-3 days of workspec:budgetDESIGN_SPEC Section 10 - Cost & Budget ManagementDESIGN_SPEC Section 10 - Cost & Budget Managementspec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:featureNew feature implementationNew feature implementation
Milestone
Description
Context
Track every LLM API call for cost management and observability per spec 10.2. This is essential for budget enforcement, usage analytics, and understanding agent economics.
Acceptance Criteria
- Every LLM call is tracked with: agent_id, task_id, provider, model, input_tokens, output_tokens, cost_usd, timestamp
- Cost calculated from pricing configuration (per-model token pricing)
- Aggregation queries by agent, department, and time period
- Async logging that does not block LLM call responses
- In-memory storage for now (SQLite persistence planned for M5)
- Unit tests for cost calculation accuracy
- Unit tests for aggregation queries
- Thread-safe logging for concurrent agent execution
Dependencies
- Depends on Implement provider adapter layer (direct API or via LiteLLM) #5 (provider adapter layer implementation)
Design Spec Reference
Section 10.2 — Cost Tracking and Budget Management
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:medium1-3 days of work1-3 days of workspec:budgetDESIGN_SPEC Section 10 - Cost & Budget ManagementDESIGN_SPEC Section 10 - Cost & Budget Managementspec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:featureNew feature implementationNew feature implementation