AgentFlow
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:

  1. Heuristic token counting — character counts classified by content kind, divided by token_estimation ratios (token_estimation in config)
  2. Pricing sheet — manual pricing.models entries for cloud models (no hardcoded vendor prices in code)
  3. Budgets — per-run, per-task, and daily caps with optional confirmation thresholds
  4. Routingrouting.strategies map 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-budget

Trade-offs

ImprovesDoes not solve
Surprises caught before devPenny-perfect invoices
Policy via YAML budgetsAutomatic cloud price discovery
Explainable routing reasonsOptimal model selection without your config

Configuration

Wire budgets, routing rules, and estimator knobs through the dedicated pages: Budgets, Routing, and Token estimation.