A Frugal white paper
The Cost Graph. The context coding agents need to cut cloud spend.
A coding agent can read a repository, inspect a query, and write a fix. It can't tell from the code alone whether that query runs ten times a day or ten million. This paper explains what a Cost Graph is, how it connects cloud costs to the code and usage behind them, and how Frugal uses it to point agents at changes worth making.
-
What a Cost Graph contains. Components, resources, costs, call sites, and known cost traps, and how they connect to each other.
-
How agents put it to work. Attribution, optimization, and prevention from one shared map, delivered through Frugal's MCP server.
-
What it takes to build one. The four signals behind RDS cost, and a client scan that found over $600,000 in annual savings for about $100.
A Frugal white paper
The Cost Graph
The context coding agents need to cut cloud spend
Mike Weider, CEO
Get the white paper
11 pages. Free. Instant PDF download.
$600K+
in annual savings identified in a single client scan.
Frugal client scan, 2026
~$100
total cost of that scan: 983 agentic calls, 25,368 tool calls, and 100M+ tokens.
Frugal client scan, 2026
1.1%
of the bill came from the AI call that looked most expensive in code. Three other call sites made up about 90%.
Frugal illustrative application exercise
Why a Cost Graph
Coding agents can generate fixes. Choosing the right one takes cost context.
You can connect a coding agent to Cost Explorer, logs, metrics, and a repository, and it may eventually piece together an answer. It will also spend much of its effort searching across those systems and reconciling data that was never organized around an engineering decision. Raw provider and observability data can flood the agent's context window before it finds the signal.
A Cost Graph does that preparation ahead of time. It correlates billing data, production usage, observability signals, and source code into relationships the agent can query, so it starts from what costs money, why, and where the change belongs. Each later query uses far fewer tokens, because the analysis is already done.
What's inside
A reusable map from the bill to the code
A Cost Graph lets you start from either end: ask which component spends the most, or start from a growing charge and find the component and code path behind it.
What the graph contains
- Applications and components, each tied to a repository path and an owner
- Resources such as storage buckets, databases, serverless functions, log patterns, custom metrics, and AI models
- Costs from AWS, GCP, Azure, Datadog, Anthropic, and OpenAI, by service, line item, and time
- Call sites: the functions that drive measured calls, tokens, errors, and latency
- Cost traps and fixes, with expected savings and a ready-to-apply code patch
How it is connected
- A component uses a resource
- A cost is attributed to a component and resource
- A call site belongs to a component and invokes a model, database, or bucket
- A cost change is attributed to the services and components that moved
- A fix addresses a cost trap and applies to specific components and resources
- 01
Attribution
Breaks costs down to the code level.
- 02
Optimization
Lets coding agents focus on what actually drives spend.
- 03
Prevention
Gives engineers cost advice as they write new code.
From the paper
One call site, $12,400 a month.
In Mike's walkthrough, an engineer asks their coding agent to reduce AI spend. Through Frugal's MCP server, the agent finds the highest spending component, then the call sites inside it and the numbers behind them. The first call site's caching works fine. It simply runs so often that it dominates the bill. Fixing the second call site's cache rate would be easier, but it can't deliver the same impact.
Call sites · last 30 days
| Call site | Cost | Calls | Input tokens / call | Output tokens / call | Prompt cache hit |
|---|---|---|---|---|---|
recommendations/generate.py:84 | $12,400 | 1.6M | 1,950 | 140 | 91% |
recommendations/explain.py:31 | $1,100 | 48,000 | 4,200 | 310 | 8% |
Cost Graph vs. data warehouse
A step deeper than the cost data warehouse
Many FinOps teams already have a cost data warehouse that brings billing, allocation, and usage data together. That's a valuable foundation. A Cost Graph connects that spend to the software driving it.
| Compared on | Cost data warehouse | Cost Graph |
|---|---|---|
| Purpose | Bring cost data together to understand spend | Connect spend to the software and usage that drive it |
| Typical data | Billing, allocation, and usage | Billing and usage connected to components, call sites, and source code |
| Questions answered | What are we spending, where, and how is it changing? | Which code drives this cost, at what volume, and what could we change? |
Before the agent writes code
Three questions every cost change should answer
Where is the money going? Rank services and call sites by observed cost, not by how expensive they look in source code.
What is driving it? Separate request volume from bytes, duration, tokens, and other billing dimensions so the fix addresses the real cause.
Is the change worth making? Put estimated savings next to the latency, reliability, freshness, and engineering work the change requires.
Sometimes the third answer is "leave it alone." Time spent on a low-cost path is time taken from a change that would move the bill.
Written for the teams who decide what to change
FinOps teams.Trace a growing charge to the components and call sites behind it, prioritize by cost impact, and work with the engineers who own the code.
Engineers and their coding agents.Investigate expensive call sites, understand the usage driving them, and check the cost of existing services before adding more spend.
Get the Cost Graph white paper.
11 pages on giving coding agents the cost context they need, from what goes into the graph to how Frugal builds and uses it.
Download the White PaperWant to see where cost lives in your own code? Book a code-level cloud waste audit