Repository navigation
Cost Accounting
Agents burn money, so spend is a first-class operational control (#36 §14):
every agent run is metered, spend aggregates per run / workflow / repo / day,
and hard $/token caps shed work before it launches.
When an agent run returns, conductor resolves its usage:
-
Runtime-reported — the run's JSON output is scanned for the usage
shapes the supported runtimes emit:
usage: {input_tokens, output_tokens}(Anthropic / claude-code),usage: {prompt_tokens, completion_tokens}(OpenAI-style),tokens: {input, output}(opencode), a top-leveltotal_cost_usd/cost_usdfigure (claude-code), including one level under the commonresult/outputwrapper keys (paseorun --json). - Estimated — anything else is approximated from model + I/O size (chars/4 on prompt and output), priced by the model table, and marked approximate. Estimated figures are a floor, not a claim of precision.
A reported $ figure wins over a computed one; reported tokens are priced by
the model table when no $ figure came along.
-
Run record — the persisted workflow run carries
tokens/cost_usd/approx_cost, updated at each checkpoint. -
Audit — one
agent_usagerow per agent run (repo, kind, agent, step, run id, workflow scope, model, tokens in/out,$, approximate), oneworkflow_costrow per completed/failed workflow run (cost per run), onebudget_shedrow per shed. -
conductor report— a spend section: total$/tokens/runs,$per run, the estimated share, breakdowns by repo, by workflow/kind, and by day, plus the shed count. The agent-quality section (Outcomes) adds cost-per-merged-change, joined from these usage figures on merged engagements.
Estimation prices tokens with a built-in model→$/1M-tokens table (coarse by
design — model pricing drifts). Override it:
pricing:
models:
"claude-opus-*": { input: 15.00, output: 75.00 } # $ per 1M tokens
"my-local-model": { input: 0, output: 0 }
default: { input: 3.00, output: 15.00 } # unmatched modelsPatterns are globs over the model name; the profile's model: (or the model
the runtime itself reported) selects the row.
budget: is a hard cap over a rolling window, at three scopes:
| Scope | Where | Ledger key |
|---|---|---|
| global | policy.budget |
everything |
| profile | agents.<name>.budget |
that agent profile |
| workflow | a trigger-level (or connector-level) policy.budget
|
that trigger (on + variant name) |
policy:
budget: { window: 24h, max_cost_usd: 25 }
runtimes:
paseo:
budget: { window: 1h, max_tokens: 500k } # a budget caps cost on a BACKEND
triggers:
- on: gh.review_requested
policy:
budget: { max_cost_usd: 5 } # window defaults to 24h-
windowdefaults to 24h;max_cost_usdand/ormax_tokens(500k/2mshorthand) must be set — an empty budget is a config error. - Every governing scope must be under cap for a dispatch to launch.
- Scope precedence for the workflow cap follows policy merging (trigger → connector); a global-only budget is charged once, as global.
- The check reserves the dispatch's estimated spend atomically, and the reservation counts against the window until it's settled with the actual usage (or released if the dispatch never runs) — so a team's parallel workers can't all pass an under-cap read and collectively overshoot a hard cap. Once a scope has any spend, a dispatch whose estimate wouldn't fit under the cap sheds up front.
Shed semantics — identical to the agents-per-hour count budget: the
dispatch does not launch, the attempt is recorded (so the backoff/sweep
machinery re-derives PR-kind work once the window frees), a budget_shed
audit row is written, and a notification (escalate) goes out. In a running
workflow an over-cap agent step fails that run with the budget error (its
fail hooks fire); the re-derive happens at the trigger layer.
The spend meter is in-memory with the same semantics as the agents-per-hour window: a daemon restart resets the rolling windows; the durable record is the audit trail.
The plan-level token cap (policy.agent_authored.limits.tokens, #36 §11)
bounds ONE agent-authored plan's size at guard time. budget: meters real
spend across runs over time. They compose; neither replaces the other.
Setup
The model
- Connectors
- Workflows
- Reuse
- Settings-and-Templating
- Packs
- Verbs
- Code-Steps
- Stores
- Runtimes
- Model-Selection
- Model-Discovery
- Steps
- Decide-Steps
- Grouping
- Memory
- Binary-Data
- Agent-Skill
- Policy
- Gates
- Teams
- Outcomes
- Cost-Accounting
- Secrets
- Hosts
- Isolation
- Trust-and-Isolation
Connectors
Operations
- One-Shot
- Callable-Service
- Runs
- Hand-offs
- Notifications
- Migration
- Controllers (legacy name → Runtimes)