Manage costs and budgets
This guide shows you how to monitor and control agent spending.
How costs are tracked
Section titled “How costs are tracked”Every agent run records:
- Input tokens — tokens sent to the model
- Output tokens — tokens received from the model
- Estimated cost — computed in cents based on the model’s pricing
Costs are tracked in AgentRunLog and aggregated by the CostTracker service.
View costs
Section titled “View costs”Per-agent
Section titled “Per-agent”Navigate to Analytics and select an agent to see:
- Total spend this month
- Token usage breakdown (input vs output)
- Cost trend over time
- Per-run cost history
Per-workspace
Section titled “Per-workspace”The workspace detail view shows aggregated costs across all agents in the workspace.
Dashboard
Section titled “Dashboard”The global dashboard shows a cross-workspace cost summary.
Set budgets
Section titled “Set budgets”Set a monthly budget per agent in the agent configuration:
- Navigate to Agents
- Select an agent
- Set Monthly budget (in cents)
- Save
When an agent’s cumulative monthly spend exceeds its budget:
BudgetThresholdCrosseddomain event fires- A desktop notification is sent
- The agent is blocked from dispatching until the next month
Budgets are enforced by BudgetEnforcementService, which checks cumulative spend before each dispatch.
Budget policies
Section titled “Budget policies”Budget policies can be set at different scopes:
- Per-agent: individual agent caps
- Per-workspace: workspace-wide caps (future)
- Global: app-wide caps (future)
Cost optimization
Section titled “Cost optimization”Choose the right effort level
Section titled “Choose the right effort level”Higher effort means more tokens and higher cost:
- Low: cheapest, good for simple tasks
- Medium: balanced
- High: most expensive, reserve for complex tasks
Use the right model
Section titled “Use the right model”Larger models cost more. Use smaller models for routine tasks:
- Code formatting → low effort + small model
- Bug fixes → medium effort + mid-tier model
- Architecture decisions → high effort + top-tier model
Review run logs
Section titled “Review run logs”Check AgentRunLog for runs with unusually high token counts. These may indicate:
- Overly verbose prompts
- Context that should be compacted
- Tasks that should be broken into smaller pieces
Compact conversations
Section titled “Compact conversations”Long conversations accumulate context, increasing token usage. Compaction summarizes the history to reduce the context window.