Cloud Agent Cost

Run-Level Cost Logs Engineering Teams Can Export to Their Own BI Stack

Owning per-run cost records lets teams govern agent spend across vendors.

· 8 min read
Cover illustration for “Run-Level Cost Logs Engineering Teams Can Export to Their Own BI Stack”
Cloud Agent Pricing · November 9, 2026 · 8 min read · 1,815 words

For engineering teams to track agent cost attribution for each run, logs must link each task’s model usage and USD cost to the engineer and team responsible and the engineering output. Those logs must bring data from different vendors into the team’s own BI stack. Owning that record makes agent spend governable even when vendors bill in different units and usage grows faster than headcount.

Why agent billing breaks the cost models engineering teams already use

One engineer has one monthly fee, known at contract time, so headcount provides a useful basis for forecasting. Coding agents break that relationship because they bill on tokens, credits, ACUs, or compute units. Those units are not interchangeable across vendors. A team using several agents therefore has no shared way to compare usage, even when each vendor dashboard gets its own usage right.

GitHub Copilot switched to AI Credits on June 1, 2026, so CI-heavy teams could no longer use their earlier cost estimates. Codex moved to token-based billing in April 2026, so teams could no longer estimate costs per message. Neither change requires the engineering organization to add a user. The same roster can produce a different bill because the commercial unit, rather than the workforce, has changed.

Usage intensity creates a separate source of volatility. A 2026 arXiv study found that agentic coding tasks used 1,000 times as many tokens as code chat. One engineer running background agents can consequently generate more spend than a group using autocomplete. Context accumulation amplifies that gap within individual sessions, as history, retrieved documents, and tool outputs expand a few thousand tokens into tens of thousands within a few exchanges. Headcount cannot explain this pattern of consumption. Budgets for conventional software track who has access, while agent bills increasingly track how much work happens through that access.

What must run-level logs capture to track each engineer’s agent costs?

Claude Code exposes detailed usage through claude_code.cost.usage in USD and claude_code.token.usage, split into input, output, cacheRead, and cacheCreation. Each includes model and query_source attributes, with the latter distinguishing main, subagent, and auxiliary usage. These fields help explain what generated a charge. Setting OTEL_METRICS_INCLUDE_REPOSITORY=true in v2.1.269+ also adds repository name, owner, provider, and URL automatically. Repository attribution therefore need not depend entirely on a team’s own instrumentation, although a repository is not itself an engineer, cost center, or engineering task.

Other vendors expose different slices of the bill. Cursor’s team analytics page emphasizes adoption and accepted code, while its Admin API provides per-member billing-cycle spend and per-request usage events. Per-member spend limits through that API are an Enterprise feature only. Codex provides per-user and workspace-level daily aggregates. OpenAI’s Insights view shows credits and active users by use case, while the Codex analytics API and dashboard organize data by surface and model. These views answer different questions at different resolutions.

The shared gap is the link between consumption and responsibility. Vendor admin views cover their own agent’s usage beyond the seat allowance at list prices. They do not cross tool boundaries or attribute charges to the engineering task or pull request that generated them. To explain the charge, a log needs the model name, token accounting by type, and the computed USD cost. It also needs engineer attribution, a repository or cost center, and the trigger source, such as a Slack mention, Linear ticket, GitHub issue, or cron, to explain responsibility.

The team’s instrumentation must supply whichever attribution fields the vendor leaves out. An agent trajectory ID groups the spans for one task, and tool names, argument sizes, and retry count help explain why that task cost so much. Did the charge come from the work the agent was meant to do, retries, or a tool interaction that kept growing? Without a trajectory ID, a BI query sees fragments of activity but cannot reconstruct the full cost of the task.

Why cost per commit is more actionable than cost per token

Token totals show how much was used, but they cannot show whether that usage led to engineering output the team could use. Cost per commit or cost per PR links the bill to the work delivered. That changes the question from how much an agent consumed to what the team obtained for the expense. Task complexity still affects the comparison. A dashboard showing rising cost per commit for work of similar complexity gives engineering a reason to investigate model selection, prompt scoping, or subagent configuration.

AI cost per PR includes model token costs, agent platform fees, developer prompting time, review time, verification compute, and expected defect cost. Most teams see only the first two terms. Run-level billing data provides a foundation for this calculation. A cheaper model can cost more in the end if failed attempts lead to retries and cleanup work by people that the token dashboard never records.

Terminal-Bench 4.0 illustrates why task outcomes belong beside cost. Its data shows wide differences in cost per task between Claude Code with Opus 5.5 and Codex with GPT-6.1 Sol, but only a modest gap in the share of tasks solved. Choose the output unit before building the export pipeline, whether that unit is a commit, PR, or deployed feature. The trajectory ID should link to that output as well as identify a session or conversation.

Three layers that move run-level data from agent to BI tool

Diagram: Three Layers for Moving Agent Cost Data to Your BI Stack. Visualizes: Visualize a three-layer architecture showing how run-level agent cost data travels from vendor to BI tool.

Layer 1 uses native vendor APIs when one agent dominates and daily, per-seat chargeback is sufficient. Claude Code’s Enterprise Analytics API and Cursor’s Admin API have documented endpoints for each user and session. Access depends on the plan. Claude Code’s Team plan exports CSV, while the full Analytics API is available only to claude.ai Enterprise organizations. This layer offers a straightforward route into reporting without first building cross-tool instrumentation.

That simplicity comes with a firm boundary. Native exports stop at the vendor’s tool and provide no trajectory-level granularity for reconstructing tasks across agents. Both APIs return list-price estimates rather than post-discount invoice amounts, so teams must reconcile them against invoices separately. A session record is not a substitute for a task record. Layer 1 fits organizations whose immediate question is who used the dominant tool, rather than what a multi-agent engineering task cost from start to finish.

Layer 2 uses OpenTelemetry to collect and export traces, metrics, and logs through a standard that works across vendors, providing a foundation for real-time, cross-tool reporting. Claude Code emits OpenTelemetry metrics natively, while other agents require an instrumentation wrapper or gateway. The common record must retain the attribution fields already described, especially the trajectory ID and cost center. Otherwise, a shared backend would centralize the data without making it comparable at the task level.

The backend introduces its own operating expense. Grafana Cloud, Datadog, and self-hosted options have different monthly costs, which belong in the logging program’s total cost. Layer 3 changes where attribution originates by using a cloud agent platform with built-in run-level accounting. Platforms that execute agents in isolated, sandboxed environments can emit attribution data at the VM level, recording cost, duration, model, and trigger source without instrumenting each agent separately. Here, the execution boundary also defines the cost boundary, reducing ambiguity about which usage belongs to which run.

Why sandboxed environments make cost logs trustworthy

An execution boundary gives the trajectory ID a concrete referent. In a shared or unsandboxed environment, an agent can accumulate context from previous runs, retry against stale state, or inherit credentials that place calls on another team’s bill. Each condition weakens attribution before export even begins. A warehouse cannot repair that ambiguity merely by joining more tables. The accuracy of the cost record therefore depends partly on how the work was isolated and which fields were collected.

Isolation also provides levers for controlling the work. An isolated VM with scoped credentials has a network and credential scope fixed at launch, limiting the access available to the agent. That scope is distinct from a monetary cap. Codex runs tasks in parallel, isolated sandboxes and launched with internet access disabled. It later made internet access opt-in, still off by default, illustrating the deliberate trade-off between a constrained environment and the connectivity an agent may need to complete a task.

Claude Code’s GitHub Actions integration runs on a GitHub-hosted or self-hosted runner and connects to PRs through an @claude mention. GitHub provisions a fresh virtual machine for each job and decommissions it when the job finishes. That guarantee applies specifically to the hosted runner. Sandbox platforms also offer controls for the infrastructure, with per-run filesystem isolation, warm-start sessions that keep state without sharing it, and on-premises options for teams with sensitive security needs.

External text in an issue or alert can attempt prompt injection, and the instruction that steered the agent may not appear in the cost log. Cost telemetry is not a complete security record. Teams should use external content only as data, avoid following it as instructions, and redact secrets before they export logs.

Connecting run logs to the dashboards finance and engineering already trust

Attribution begins in the workflow that starts the run. Integrations with Slack, Linear, GitHub, and GitLab connect agent activity to the systems where engineering work already happens. A Slack @agent mention, Linear ticket assignment, or GitHub issue label can supply the cost center and trigger source attached to every span. The initiating event anchors the later cost query. A Linear team, GitHub organization, or Slack channel can then connect consumption to the finance system’s existing allocation model.

The export destination can be a standard data warehouse. Run-level logs land in Snowflake, BigQuery, or Redshift, where a dbt model or equivalent normalizes token costs to USD at list price and joins records on trajectory ID to produce cost-per-PR rows. For teams running several harnesses, that normalization belongs at ingestion, before the cross-tool join. Credits, ACUs, and tokens charged at different rates must be put on the same monetary basis before they can be added up. Dashboard-specific conversions would allow reports to disagree silently.

Looker, Metabase, or Grafana can surface the resulting per-team, per-harness, and per-model breakdowns. No separate agent dashboard is required for this purpose. Finance can see last month’s spend, which cost centers were responsible, and whether spend is rising or falling, while keeping list-price usage estimates separate from reconciled invoice amounts. Engineering can compare cost per PR by harness and model. Those comparisons support decisions such as routing exploratory tasks to a cheaper model and production PRs to a higher-accuracy one, with outcomes informing the choice.

The operational payoff is a closed loop between control and reporting. Teams can set per-team or per-model spend caps upstream in the agent gateway or platform layer, then use BI reports to verify that those caps held. Chargeback follows the same cost-center field used throughout the pipeline. Owning the logs means owning the conversation with finance, including which work created the expense, which team authorized it, and whether the output justified it.

More in Cloud Agent Pricing