Skip to content

Export cost and governance data (on-demand snapshot; streaming as follow-up) #145

Description

@tishachawla-jg

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)

  • Pull run-records + governance events over a time range in CSV and JSON.
  • Scoped by read auth and tenant; no cross-tenant export.
  • Admin "Export" button + SDK/CLI helper.
  • Documented.

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions