Concepts
Cost-aware workflows
Estimate tokens and cost before execution; enforce budgets and routing.
Cost-aware workflows
Problem
Agent runs can consume tokens in ways that are hard to predict from a plain task description. Teams still need forecasts before execution, budget ceilings that fail closed, and routing that prefers cheaper execution paths when the task does not justify a heavy model.
AgentFlow approach
AgentFlow addresses that with four concrete mechanisms that stay under your config:
- Heuristic token counting — character counts classified by content kind, divided by
token_estimationratios (token_estimationin config) - Pricing sheet — manual
pricing.modelsentries for cloud models (no hardcoded vendor prices in code) - Budgets — per-run, per-task, and daily caps with optional confirmation thresholds
- Routing —
routing.strategiesmap step classes to local versus cloud-fast versus cloud-heavy agents
Typical CLI entry points:
agentflow estimate billing-v2 --task task-003 --dry-run
agentflow work "develop billing-v2" --estimate-only
agentflow work "develop billing-v2" --budget 0.50 --allow-over-budgetTrade-offs
| Improves | Does not solve |
|---|---|
Surprises caught before dev | Penny-perfect invoices |
| Policy via YAML budgets | Automatic cloud price discovery |
| Explainable routing reasons | Optimal model selection without your config |
Configuration
Wire budgets, routing rules, and estimator knobs through the dedicated pages: Budgets, Routing, and Token estimation.