guide
guide8 min read

How Do You Track and Cap Snowflake Cortex Agent Credits That Warehouse Spend Doesn't Show?

Where Cortex Agent and AI credits are billed, which views show them, and which controls actually enforce a limit

Cortex Agent spend is missing from warehouse dashboards because it is metered as AI credits, not virtual warehouse credits. The FinOps Foundation's data cloud platforms guide says Cortex serverless credits "are billed independently of virtual warehouse credits". Snowflake's AI cost management and governance docs list 12 primary usage views for total AI cost, including CORTEX_AGENT_USAGE_HISTORY. To cap spend, you need per-user quotas, because they are the only AI cost control Snowflake describes as having built-in enforcement.

Key Takeaways

  • •Cortex Agent and other AI credits are billed apart from virtual warehouse credits, so a warehouse-only cost report undercounts AI spend.
  • •CORTEX_AGENT_USAGE_HISTORY records one row per agent call, with user, agent, token and credit columns, and it can lag by up to 1 hour.
  • •Resource budgets and shared resource budgets alert and can call stored procedures. Per-user quotas are the control with built-in enforcement.
  • •An agent request can also create warehouse cost through its custom tools, so track both the AI credit views and warehouse metering and join them by user or tag.
  • •Budget actions can take up to 8 hours to apply, or up to 2 hours with the latency-optimized option, so treat budgets as a brake and not a hard stop.

Why agent credits don't appear in warehouse spend

Most teams built their cost reporting around one question: which warehouse burned the credits? That works when every dollar is compute attached to a warehouse. A Cortex Agent breaks the model. The agent's orchestration is charged by tokens, and the tools it calls are charged on their own meters. A report built on warehouse metering sees none of that, so finance asks why the invoice grew while every warehouse looks flat.

Snowflake's Cortex Agents documentation describes the split. Orchestration is charged on tokens used. Cortex Analyst is charged per token. Cortex Search depends on index size and how long the index persists. Custom tools run on a warehouse, so they add warehouse credits that depend on size and runtime. One agent request can therefore land on three or four different meters.

That mixed billing is why the first fix is organizational, not technical. Someone has to own the combined number. If the AI credits sit with the platform team and the warehouse credits sit with the data engineering team, nobody sees the cost of a single agent request end to end. Decide who owns the combined view before you build any alert.

Step 1: Find the AI credits in the usage views

Start with the account usage views that Snowflake names as the primary sources for total AI cost. The AI cost management docs list views for agents, AI functions, Cortex Analyst, Cortex Search, Cortex Code, CoWork and the AI gateway, among others. They also warn that the Cortex Search daily view includes embeddings, which you must exclude from combined totals or you will double count.

For agents, the view is CORTEX_AGENT_USAGE_HISTORY. Per Snowflake's view reference, each row is one call to a Cortex Agent and carries the user, request ID, agent name, tokens and token credits. The view can lag by up to 1 hour. Requests from Snowflake CoWork are excluded and appear in SNOWFLAKE_COWORK_USAGE_HISTORY, so a complete report needs both.

Keep a second, broader net. The FinOps Foundation guide recommends that initial cost setups include METERING_HISTORY filtered by SERVICE_TYPE, so Cortex usage appears next to compute and storage. Snowflake's METERING_HISTORY reference lists AI_SERVICES as the type covering Cortex AI Functions and Cortex Analyst, and the view returns hourly credit usage for the last 365 days. Use it as the reconciliation check against the per-feature views.

Step 2: Attribute credits to users, agents and teams

A total is not an answer. The questions that come up in practice are "who ran this agent" and "which team owns it". The agent usage view carries user and agent columns, plus tags, so you can group credits by agent and by user without parsing query text. Start with a simple daily rollup: credits per agent, credits per user, and the top ten requests by token credits.

Tags are what make this durable. Snowflake's shared resource budgets group AI features by tagged users, for example a team or cost center. If you tag users by cost center now, the same tags feed your reporting and your budgets later. Retrofitting tags after the first surprise bill is slower, because you have to explain history that was never labeled.

Then add the warehouse side. Custom tools on an agent run SQL, and that SQL uses warehouse credits that the agent view only reports in a metadata field. Per the view reference, the SQL query credit fields in that metadata can lag by up to 8 hours and stay NULL until the pipeline catches up. Do not alert on those fields in near real time. Join the agent request to warehouse metering in a daily batch.

Step 3: Set budgets that alert

Budgets are the first control most teams reach for, and they are the right first control, as long as you know what they do. Snowflake's budgets documentation says a budget sends a daily alert when spending is forecast to exceed its limit. It notifies by email, a cloud queue or a webhook. The budget itself only alerts, although it can call a stored procedure at a threshold.

For agents, the AI cost docs describe resource budgets: a monthly credit limit on a tagged Cortex Agent object, with thresholds set as percentages of the limit. Shared resource budgets cover AI features across tagged users. Use a resource budget per production agent, and a shared budget per team. Set a warning threshold well below the limit, because of the lag described next.

Latency is the catch. The same AI cost page says budget actions can take up to 8 hours to apply, or up to 2 hours with the latency-optimized option. The budgets page adds that setting the refresh interval to one hour increases the compute cost of the budget by a factor of 12. A runaway agent loop can spend a lot in 8 hours, so a budget is a brake you apply early, not a wall.

Step 4: Cap spend with per-user quotas

When you need a limit that holds, use quotas. Snowflake's docs state: "Quotas are the only AI cost control with built-in enforcement." They are per-user credit limits that block usage without a custom stored procedure, and evaluation happens within minutes. That makes them the right control for exploratory users and for service identities that call agents.

Read the arithmetic carefully. Per the same page, a 100-credit quota across 10 users permits up to 1,000 credits in total, because limits are per user and never pooled. A quota protects against one user or one script going wild. It does not cap a team. For a team ceiling, pair quotas with a shared resource budget.

There is one more limit to know, and it is not a cost limit. The Cortex Agents docs set a rate limit of 1,000 requests per minute per account, with a 500-request burst, shared by all agents. Exceeding it returns HTTP 429. A rate limit slows a loop but does not stop it, so it is no substitute for a credit cap.

Step 5: Wire the signals into your agent tooling

The last step is making the numbers reachable where engineers work. A cost view that lives in one console gets checked after the invoice. A cost question asked from the terminal gets answered while the change is still open. Any MCP client can reach this, and the MCP specification defines tools as the way a server exposes functions a model can call.

This is where the Data Workers Cost Agent fits. It is an MCP server, so an engineer can ask "How much are we spending on Snowflake this month?" from Claude Code or Cursor, and the agent reads the AI usage views alongside warehouse metering instead of stopping at the warehouse. The open-source edition is read-only by default, so it reports and recommends. It does not change a quota or a budget.

At the Pro tier, writes go through approval workflows with an audit trail, so a proposed quota change has a named approver. We keep the autonomy dial per domain. Many teams leave AI spend at report-only and let the agent draft the change for a human to approve. Detection is the easy part. The delay between noticing and acting is where the money goes.

A short weekly review that catches drift

Controls set once go stale. New agents appear, models change and usage shifts. A ten-minute weekly review keeps the setup honest. Check the top agents by credits, any agent with no tag or owner, any user near their quota, and the gap between the AI views and METERING_HISTORY. A growing gap usually means a feature is billed somewhere you are not looking.

  • •Rank agents by credits this week against last week and flag any that doubled.
  • •List agents or users with no cost-center tag.
  • •Check which users hit or approached a per-user quota.
  • •Reconcile the sum of the per-feature views with METERING_HISTORY for AI_SERVICES.
  • •Confirm each budget notification still reaches a person who will act.

Frequently Asked Questions

Why don't Cortex Agent credits show up in WAREHOUSE_METERING_HISTORY?

Because they are billed as AI credits against token and feature meters, not as warehouse compute. Query CORTEX_AGENT_USAGE_HISTORY for agent calls and METERING_HISTORY filtered to AI_SERVICES for the broader AI picture. Only the SQL that a custom tool runs lands on a warehouse, and that part does appear in warehouse metering.

Which control actually stops an agent from overspending?

Per-user quotas. Snowflake describes them as the only AI cost control with built-in enforcement, and they are evaluated within minutes. Budgets alert and can call a stored procedure, but their actions can take up to 8 hours to apply, or up to 2 hours with the latency-optimized option.

How current is the usage data?

The agent usage view can lag by up to 1 hour, and the SQL query credit fields inside its metadata can lag by up to 8 hours. METERING_HISTORY is generally up to 180 minutes behind. Build daily reports and early-warning thresholds around those delays, not around real-time expectations.