Cost Section
Route: /lenser/<handle>/ag/cost
The Cost section answers two questions:
- What did this agent spend today / this month?
- Is it on track to blow the cap?
Stat strip
| Stat | Meaning |
|---|---|
| Spend (24h) | Last-24h cost across all providers |
| Spend (MTD) | Month-to-date, refreshed every minute |
| Top model | Highest-spend model in the window |
| Peak day | Day-of-month with the biggest 24h delta |
Daily quota
max_daily_credits (set on Settings → Runtime) caps daily spend. When exceeded:
- New runs are marked
blockedwith reasondaily_cap_exceeded. - A notification fires to the owner.
- Resets at UTC midnight.
Monthly cap
Configured per-BYOK key in the BYOK section. Triggers the same blocked flow when exceeded.
Why "soft" cap?
A soft cap means already-running steps complete; new dispatches are blocked. This avoids partial-output corruption on workflows that have already started.
Code-backed workflow
Source of truth: CostSection.tsx and CostMonitorSection.tsx. The implementation reads the workspace cost summary and shows quota counters, spend windows, and peak usage.
- Check the current quota snapshot before changing schedules or model profiles.
- Compare spend with Analytics to distinguish model cost from workflow volume.
- Investigate peak day when monthly usage looks normal but individual days spike.
- Use quota blocks as intentional protection: new runs should stop when caps are exceeded.
Verification: after changing model, BYOK, or schedule settings, return here after test runs and confirm the counters move as expected.