Note: Tracked here on tokenops for visibility. The feature is implemented mostly in the control plane (that's where the data and routes live: theagentplane/control-plane), with a thin SDK/CLI helper in tokenops. Transferred from theagentplane/control-plane#17.
Summary
Let users get their data out of the control plane for FinOps / chargeback reporting and audit / compliance. The plane's SQLite holds it all (run-records, spend, governance events), but today there's no way to pull it into a spreadsheet, a cost tool, or an archive. Two modes; v1 is the on-demand snapshot.
What to export
- Run-records — cost per run, agent, and segment over a time window. This is the FinOps view (who spent what).
- Governance events — the audit trail: halts, MUTATE/INJECT decisions, which policy fired and why. This is the compliance view.
- Not the raw ledger accumulators (
ledger_spent by budget/segment) — they're aggregate and low-value raw; the run-level breakdown above is what people actually want.
Modes
v1 — on-demand snapshot (pull)
- A
GET /v1/export route on the control plane returning run-records and/or governance events, filtered by time range, run, agent, segment.
- Formats: CSV (finance/spreadsheets) and JSON / JSONL (pipelines).
- Surfaces: an Admin UI "Export" button and a thin SDK/CLI helper in tokenops on top of the route.
Follow-up — continuous / streaming (push)
- Push ledger/governance events to an external sink (webhook, S3, OpenTelemetry, a FinOps tool) as they happen. Bigger scope; separate issue once v1 lands.
Open decisions (comment before building)
- Which fields/columns matter most for the FinOps CSV (cost, tokens, cached, model, agent, segment, timestamps)?
- Auth/scope: export should require
read scope and respect tenant ownership (ties to theagentplane/control-plane#6 and theagentplane/control-plane#16) — a caller must not export another tenant's spend.
- Pagination / size limits and streaming the response for large exports.
Acceptance (v1)
Related
theagentplane/control-plane#6 (ownership-scoped authorization — export must respect it), theagentplane/control-plane#16 (roles: who may export), #141 (cost attribution feeds what's exportable).
Summary
Let users get their data out of the control plane for FinOps / chargeback reporting and audit / compliance. The plane's SQLite holds it all (run-records, spend, governance events), but today there's no way to pull it into a spreadsheet, a cost tool, or an archive. Two modes; v1 is the on-demand snapshot.
What to export
ledger_spentby budget/segment) — they're aggregate and low-value raw; the run-level breakdown above is what people actually want.Modes
v1 — on-demand snapshot (pull)
GET /v1/exportroute on the control plane returning run-records and/or governance events, filtered by time range, run, agent, segment.Follow-up — continuous / streaming (push)
Open decisions (comment before building)
readscope and respect tenant ownership (ties totheagentplane/control-plane#6andtheagentplane/control-plane#16) — a caller must not export another tenant's spend.Acceptance (v1)
readauth and tenant; no cross-tenant export.Related
theagentplane/control-plane#6(ownership-scoped authorization — export must respect it),theagentplane/control-plane#16(roles: who may export), #141 (cost attribution feeds what's exportable).