Cost Model: Execution vs. Entity Production Cost
Cost is a first-class output of the platform, and its model is deliberately simple and centralized: the core computes every dollar, from consumption the workflow reports, using current registry pricing — and everything else is aggregation.
Cost is core-owned and computed at ingestion
Workflows report consumption only — token counts for agents, unit quantities for services — never dollars. When a step is logged, the core computes its cost_usd:
- Agent step: resolve the agent's model identity from the frozen
workflow_config_snapshot, look up that model's current pricing in the registry, and apply(input_tokens/1M × input_price) + (output_tokens/1M × output_price). - Service step: resolve the service from the registry and apply
(input + output) / per_unit × base_cost, where the developer reported consumption in the service's declared unit. - Internal step: zero — no billable consumption.
Two design points fall out of this. Pricing is looked up live at ingestion, not from the snapshot — so a price change applies going forward without rewriting history, and pricing lives in one authoritative place. And because the core computes cost, a workflow can't misreport it; the platform trusts consumption counts, not dollar figures.
Aggregation: from step to execution to entity
Every workflow_execution_log row carries its own cost_usd, and all higher-level figures are derived at query time — there's no running-total column to drift:
- Execution cost = the sum of
cost_usdacross an execution's log rows. - Entity production cost = the sum across all workspaces and all executions for one entity instance. This is a plugin-level aggregate (the plugin joins through its own tables), because only the plugin knows which executions belong to which entity.
Why this makes reporting trustworthy
The financial source of truth is the execution log, and nothing else. Plugin-level deletion or archival of a workspace never touches those log rows, so it never distorts reporting — a direct consequence of core workspaces never being deleted. Cost analytics, then, aren't a separate ledger that can disagree with reality; they're a straight aggregation over the immutable, core-owned record of what every step actually consumed. (Some genuinely external costs, like object storage, sit outside this model — the platform prices what it orchestrates, not your whole infrastructure bill.)