How to manage AI costs and maximize the value of enterprise AI investments
AI is now a resource every company has to manage, much like compute or energy. The difference is how quickly it has arrived. Coding agents have spread across engineering teams in a matter of months, and many enterprise AI cost graphs now look like hockey sticks. CFOs want to know what they're spending and what they're getting for it. Engineering leaders want to maximize developer productivity while keeping AI costs sustainable. CISOs want to understand what data agents can access, what actions they can take and what security risks they introduce.
At Databricks, we've experienced these challenges firsthand. With more than 12,000 employees, we initially focused on increasing AI adoption. As adoption accelerated, so did spending, but some of our heaviest AI users were also among our most productive engineers. Simply restricting consumption would work against the productivity gains we were trying to achieve.
We take a data-driven approach to AI governance: using data on AI usage, costs, performance and agent behavior to inform decisions on budgets, model selection, agent configurations and security policies. As we shared in our webinar, Govern AI Spend at Scale: A Data-Driven Approach to AI Governance, these lessons helped shape Databricks Unity Gateway, an enterprise AI gateway and control plane that centralizes access, cost management, observability, intelligent routing and policy enforcement across models, agents, MCP servers and skills, including those hosted outside Databricks.
When teams independently adopt models and agent harnesses, usage and spending data become fragmented across providers. Enterprises need a governed system of record to understand who is using AI, what it costs and how agents interact with enterprise resources.
Unity Gateway provides centralized observability across connected AI services, with out-of-the-box dashboards for tracking usage, performance and cost across users, models, providers and agent harnesses.
AI usage dashboards can tell you where your budget is going, but agent traces reveal what's driving those costs. Unity Gateway captures requests, responses and tool calls in a unified trace table. Organizations can apply attribute-based access control (ABAC) policies to protect sensitive information within traces and use Genie to uncover inefficiencies such as uncached context, failed tool calls and expensive frontier models handling routine tasks.
At Databricks, we used this approach to identify seven MCP server bugs responsible for an estimated $499,000 in annual token costs and 12,000 hours of annual engineering wait time, fixing them in approximately one hour.
These experiences helped inspire Unity Gateway Insights, which uses Genie to automate this analysis. Enterprises can generate reports that show what their teams are working on, rank sources of token waste, and recommend ways to reduce costs, from fixing recurring MCP errors to routing routine tasks to more efficient models and turning repetitive workflows into shared skills.
At Databricks, sharing AI usage data across engineering teams initially helped drive adoption. Teams could learn from their most active AI users and adopt successful practices. As adoption grew, we began surfacing real-time spending directly in developers' terminals to help them develop intuition about the costs of different models, agent configurations and tasks.
Developers using the Unity Gateway CLI can run ug usage to track consumption against monthly budgets and daily spending limits, helping them make more informed decisions about their AI usage. The CLI also enables enterprises to centrally configure and distribute approved models, MCP servers, skills and settings across supported coding agents, bringing governance directly into developers' existing workflows.
Just as enterprises give teams responsibility for their operating budgets, they should do the same for AI. Developers have an incentive to manage their budgets responsibly, but they also need control over how autonomous agents spend on their behalf.
With Omnigent, Databricks' open source meta-harness, developers can set spending limits on individual tasks or sub-agents. For example, a developer can start an agent on a task, set a $10 budget and step away. If the agent reaches that limit, it s and notifies the developer, who can decide whether additional spending is justified.
AI budgets should reflect differences in workloads, responsibilities and the value teams derive from AI. A uniform spending limit across an engineering organization may not account for these differences. With Unity Gateway budgets, administrators can track and control AI spending across Databricks-hosted and supported external model providers, establish shared and per-user budgets, configure alerts at multiple spending thresholds and enforce spending limits.
As we found in the Databricks AI Index, a new flagship proprietary or open-weight model has launched roughly every week since May 2026. Keeping up with this pace of innovation requires enterprises to continuously evaluate models, agent harnesses and reasoning settings based on cost per successful task, rather than token prices alone.
At Databricks, we built an internal coding-agent benchmark using real pull requests from our engineering teams. We found that even without switching models, lowering reasoning effort and using more lightweight agent harnesses could reduce costs by approximately 50% while maintaining comparable quality. These findings informed changes to our default agent configurations. The Unity Gateway CLI also enables enterprises to centrally configure and distribute approved models, MCP servers, skills and settings across supported coding agents.
But no single configuration is optimal for every task. Unity Gateway Smart Routing helps automate model selection based on task complexity and model capabilities. In our internal evaluations, Smart Routing reduced average task costs by more than 30% while achieving quality comparable to that of the most expensive model in the evaluated working set. With Omnigent, enterprises can extend this approach to routing across agent harnesses.
Agent traces can also inform security decisions. At Databricks, trace analysis uncovered unexpected behaviors, such as agents down packages from untrusted repositories, helping our security team identify where additional controls were needed.
Traditional allow or deny policies do not always account for what an agent has done earlier in a session. For example, an agent that has accessed sensitive customer data containing personally identifiable information (PII) may need to be prevented from publishing information externally, while an agent working exclusively with public data could be permitted to perform the same action.
Contextual policies in Omnigent enable enforcement decisions based on agent session state, while Unity Gateway's AI guardrails and runtime policies provide centralized controls over AI interactions. Together, these capabilities support more granular governance of agent behavior.
Watch Govern AI Spend at Scale: A Data-Driven Approach to AI Governance on demand with Databricks co-founder and CTO Matei Zaharia and AI Product Director Kasey Uhlenhuth.
Explore more lessons from Databricks' internal AI adoption in Managing AI coding costs at scale. Connect your models and coding agents to Databricks Unity Gateway to centralize AI observability, manage spending and optimize AI consumption across your organization.
Data-driven AI governance is an approach to managing AI usage, costs, performance and security based on data about how models and agents actually operate. Rather than relying solely on fixed spending limits and static security policies, enterprises can use usage metrics and agent traces to inform budget allocation, model selection, agent configurations and policy enforcement. Databricks Unity Gateway enables this approach through a unified enterprise AI control plane.
Enterprises can manage AI spend at scale by centralizing AI usage and cost tracking across model providers, establishing granular budgets and spending policies, and giving users real-time visibility into their consumption. Databricks Unity Gateway provides centralized cost attribution, real-time budgets, spending alerts and enforcement across Databricks-hosted and supported external model providers.
Enterprises should optimize for cost per successful task rather than cost per token alone. Benchmarking models, agent harnesses and reasoning settings on real-world tasks can help identify more efficient configurations. Databricks Unity Gateway Smart Routing automates model selection based on task requirements, while the Unity Gateway CLI gives developers visibility into their own spending.
AI agent traces capture requests, responses and tool calls, helping enterprises identify sources of unnecessary spending such as uncached context, failed MCP tool calls and inefficient model selection. Databricks Unity Gateway captures agent traces in a unified trace table, while Unity Gateway Insights generates reports that identify and rank sources of token waste and recommend opportunities for cost savings.
Enterprises can prevent runaway AI agent costs by combining centralized spending limits with real-time spending visibility and granular task-level budgets. Databricks Unity Gateway enables administrators to establish budgets and enforce spending policies, while Omnigent allows developers to set spending limits on individual tasks or sub-agents and approve additional spending before work continues.
Subscribe to our blog and get the latest posts delivered to your inbox.