TL;DR: LLM costs rise when retries, tool calls, agent loops, and larger context windows compound inside production workflows, and Braintrust argues that trace-level observability is what reveals the spans driving spend rather than hiding them inside aggregate dashboards. The practical shift is to pair cost attribution with prompt experimentation, model comparison, and eval-backed release control so teams can cut spend without degrading output quality.
At a glance
What this is: This is a guide to how AI observability exposes LLM cost at the trace and span level, with the key finding that aggregate dashboards hide the workflow steps that actually drive spend.
Why it matters: It matters because IAM-adjacent AI programmes increasingly manage agentic workflows, tool calls, and sensitive data paths where cost, control, and governance all hinge on understanding runtime behaviour.
By the numbers:
- 19x per request
- Prompt optimization can often reduce input token cost by 20 to 40 percent without requiring a model change.
👉 Read Braintrust's guide to lowering LLM cost with AI observability
Context
AI observability is the practice of tracing prompts, model calls, tool calls, and retries so teams can see where cost and behaviour originate. In LLM programmes, the governance gap is rarely the model alone, but the workflow around it, where context growth, agent loops, and retries quietly inflate spend and complexity.
For identity and access teams, this topic matters because agentic AI systems increasingly act through tool use, delegated permissions, and service credentials. When the runtime path is opaque, teams cannot tell whether the costly step is also the risky one, especially where non-human identities, secrets, or privileged integrations are involved.
Braintrust positions the problem as a visibility issue rather than a simple billing problem, and that starting point is typical for mature AI operations. Most teams first discover the issue in finance, then realise the real control problem sits in execution traces and release decisions.
Key questions
Q: How should teams reduce LLM costs without breaking production quality?
A: Start with request-level tracing so you know which prompts, models, retrieval steps, or tool calls drive cost. Then test cheaper alternatives on real production traces and require evaluation gates before release. That combination reduces spend while preserving quality, rather than simply shifting cost into retries or manual review.
Q: Why do agentic AI workflows make cost governance harder?
A: Agentic workflows multiply calls across retrieval, tools, retries, and intermediate reasoning, so the final answer cost is much higher than a single model request suggests. They also blur responsibility across spans, which makes it harder to see which step created waste or introduced risk. That is why trace-level visibility is necessary for both spend control and operational discipline.
Q: What do security teams get wrong about AI cost control?
A: They often treat cost as a finance-only issue and overlook the identity layer that drives usage. Without attribution, shadow AI discovery, and policy enforcement at the request path, teams can reduce waste in one area while leaving the real source of token growth untouched.
Q: How can organisations govern AI systems that use tools and secrets?
A: Treat the AI workflow as a non-human identity with delegated access. Define which service accounts, tokens, and API keys it may use, limit that access to the smallest possible scope, and review the runtime paths that consume those credentials. If the workflow can call tools, it needs identity governance as much as any other privileged system.
Technical breakdown
Why aggregate dashboards hide LLM cost drivers
Aggregate dashboards compress many workflow behaviours into a single spend number. That hides the difference between a cheap single-pass prompt and a costly agentic workflow that chains retrieval, tool execution, retries, and long context windows. The important mechanism is not just token count, but how tokens accumulate across nested spans. Once a retry resends the full prompt or an agent loop repeats a tool call, the visible bill becomes a lagging indicator rather than a control signal.
Practical implication: teams need span-level attribution before they can target the workflow step that is actually inflating spend.
How trace-level observability exposes expensive spans
Trace-level observability breaks a request into spans, each with its own token usage, estimated cost, and latency. That makes it possible to see whether a retrieval step, classifier, summariser, or function call dominates the workflow. Cost-scaled timelines are useful because they visually amplify expensive spans, which helps engineers spot context bloat or runaway tool use without manual log analysis. The architectural benefit is that cost becomes attached to execution, not inferred after the fact.
Practical implication: identify the most expensive span first, then change that step instead of reworking the whole workflow.
Why eval-backed release control is part of cost governance
Cost reduction is only safe when changes are validated against quality. A shorter prompt or cheaper model may lower spend, but it can also remove instructions that protect edge cases, schema handling, or task accuracy. Eval-backed release control closes that gap by turning production traces into reusable test cases and using them to compare prompt or model variants under the same conditions. That is a governance pattern, not just an optimisation pattern, because it ties spend reduction to measurable output quality.
Practical implication: gate lower-cost changes on eval results so savings do not silently degrade the production experience.
NHI Mgmt Group analysis
Observability debt is now a governance problem for AI operations. When teams can only see aggregate spend, they lose the ability to distinguish routine usage from pathological execution paths. In practice, that means cost, quality, and control drift together. For AI programmes that rely on delegated tools and service credentials, the lack of trace-level visibility also obscures where non-human identity activity is creating risk.
Prompt and model tuning are control decisions, not just engineering optimisations. Reducing token usage changes the behaviour of production systems, so those changes need evidence, not intuition. Braintrust's framing aligns with NIST AI Risk Management Framework thinking because the programme must measure before it changes. Practitioners should treat cheaper execution paths as governed changes, not local performance tweaks.
Trace-level cost attribution creates a new named control concept: cost-path governance. This means the organisation can identify which workflow path is allowed to consume what level of compute and where exceptions are justified. That concept matters because expensive paths often correlate with complex retrieval, external tool use, and privileged automation. For teams running agentic AI, cost-path governance becomes part of access governance for the system itself.
The real risk is not high LLM spend, but unobserved spend that masks weak runtime discipline. When retries, context expansion, and tool fan-out are invisible, the organisation cannot tell whether AI behaviour is stable or simply expensive. That makes AI adoption harder to scale safely. Practitioners should build observability into release gates before broader automation expands the blast radius.
Identity becomes relevant whenever AI systems act through tools and secrets. The moment an AI workflow calls external systems, its execution path depends on credentials, permissions, and service identities. That links observability to IAM and NHI governance directly. Teams should measure AI runtime behaviour with the same seriousness they apply to privileged access and secret sprawl.
What this signals
Cost-path governance is becoming a practical control pattern for AI programmes. If an organisation cannot see which span consumed the budget, it cannot govern which workflow path is acceptable. That makes observability a prerequisite for scaling agentic AI safely, especially where delegated tools and credentials sit behind the model.
As AI systems gain more runtime autonomy, their execution patterns begin to resemble machine identities with budget impact attached. That is why teams should align observability with identity controls, using lifecycle discipline for credentials and workload identities alongside eval-based release gates.
The next governance step is to connect trace data to policy. Where tool use, retries, and context growth are measurable, teams can define acceptable execution envelopes and detect when AI behaviour moves outside them. That is the bridge between performance monitoring and security governance.
For practitioners
- Instrument trace-level cost attribution Capture token usage, estimated cost, and latency on every span so expensive retrieval steps, retries, and agent loops are visible in context.
- Review the highest-cost workflow spans first Start optimisation with the span that dominates the trace, then decide whether to shorten context, tighten retrieval, or replace the model used for that step.
- Use evals to gate cheaper prompts and models Convert production traces into repeatable eval cases and block release if the lower-cost variant reduces quality below the agreed threshold.
- Map AI tool use to delegated identity controls Where agentic workflows call external tools, verify which service accounts, API keys, and permissions the workflow consumes and whether those identities are least privilege.
Key takeaways
- LLM cost usually grows in the workflow, not in the single model call that first appears on the invoice.
- Trace-level observability exposes the spans, retries, and tool calls that aggregate dashboards hide.
- Cost reduction is safest when every cheaper prompt or model change is validated through evals before release.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 address the attack and risk surface, while NIST AI RMF, NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST AI RMF | MEASURE | Trace-level cost visibility is a measurement and governance issue for AI systems. |
| OWASP Agentic AI Top 10 | Agent loops, tool use, and identity abuse are core risks in agentic AI workflows. | |
| NIST CSF 2.0 | DE.CM-8 | Observability maps to continuous monitoring of system activity and anomalies. |
| NIST SP 800-53 Rev 5 | AU-6 | Cost traces are audit evidence for reviewing what happened inside AI workflows. |
Apply agentic AI guidance to constrain tool use, retries, and delegated actions in production.
Key terms
- Trace-level Visibility: Trace-level visibility means recording the sequence of steps that led to an AI outcome, not just the final response. It is essential in multi-step systems because it shows which retrieval, prompt, or tool event introduced the failure and whether the action was authorised.
- Cost-Path Governance: Cost-path governance is the discipline of defining which AI execution paths are allowed to consume which levels of compute and under what conditions. It treats spend as a controllable runtime property, linking optimisation decisions to policy, release control, and quality evidence.
- Eval-Backed Release Control: Eval-backed release control uses repeatable test cases and scoring to verify that a prompt, model, or workflow change is safe before it reaches production. It turns optimisation into a governed change process, so lower cost does not come at the expense of output quality or task reliability.
- Agentic workflow: An agentic workflow is a sequence of tasks executed by an AI agent with some level of tool access and decision authority. In security terms, the workflow matters because it can span multiple systems, identities, and permissions, which makes attribution and revocation harder than with ordinary automation.
What's in the full article
Braintrust's full article covers the operational detail this post intentionally leaves for the source:
- Inline cost tracking examples showing how every span rolls up into a full trace cost.
- Prompt experimentation workflows for comparing token usage, cost, and quality side by side.
- Model comparison and eval-backed release control for selecting the cheapest acceptable model.
- Practical trace and timeline views that highlight expensive retrieval, retry, and tool-call patterns.
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, and secrets management. It helps practitioners connect identity controls to the broader governance decisions that shape modern automation.
Published by the NHIMG editorial team on August 21, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org