How Uber Scaled AI Agents 7x While Cutting Costs 52%
Uber details how they scaled AI agent adoption 7x and reduced per-session costs 52% through a four-layer agent architecture, a six-factor cost equation, benchmark-driven model routing, token optimization via caching and CLI tools, a massive context graph for code navigation, and real-time cost dashboards detecting 16 waste patterns.
Introduction
AI tools are now embedded in every stage of Uber's software development. Over 70% of pull requests are attributed to local or cloud agents. Engineers have built more than 3,600 agent skills across the SDLC, executing over 30,000 skill runs daily. At AI Engineer 2026, Uber shared its software factory vision and the managed agents handling code review, CI self-healing, end-to-end PR completion via visual validation, on-call alert triage, bug debugging, and code maintenance tasks with human review or escalation.
From February to August 2026, weekly active users across all agent products grew 7x and weekly agent requests grew 9.4x, while total AI spend stabilized after April. To isolate optimization gains from model upgrades, Uber held one model constant from February to July, achieving a 34% reduction in cost per 1,000 model requests and a 52% reduction in cost per session versus the June peak.
Software Factory Architecture and Cost Equation
Four Layers of Agent Usage
Uber categorizes AI usage into four layers, from most specialized to most general. Higher layers give Uber more control over cost, quality, and model selection.
Cost Equation
At any layer, an agent session's cost decomposes into six multiplicative terms. The first two terms represent adoption and engagement, which Uber wants to grow. The middle three terms offer optimization leverage: extra work agents do beyond the engineer's explicit request, such as faster planning, fewer unnecessary turns or errors, and input token optimization.
Measurement Framework
Uber tracks a comprehensive set of weekly and monthly metrics to support short- and long-term forecasting and planning.
Optimization Levers
Optimizing Price per Token
Benchmark-Driven Model Selection
For every managed agent, model selection follows four steps: build benchmarks from the agent's real work; run the agent on a test framework that serves any model via a single interface; switch to any Pareto-optimal model and continuously retune as the frontier shifts every few weeks. Uber uses uReview for AI code review on all PRs, benchmarked on real PRs with known bugs categorized as easy, medium, hard. They evaluate precision, recall, F1, cost per review, latency, timeouts, and noise. Switching models improved F1 while drastically lowering cost per PR. An internal Uber SWE Benchmark runs frontier and open-weight models on thousands of real PRs from the monorepo to guide model selection for all SDLC-managed agents.
Default Model Selection
In interactive interfaces, token unit cost is fixed, but token allocation across models can be managed strategically. Two defaults dominate: initial session model and sub-agent model. The sub-agent default is the highest-impact lever and growing in importance as multi-agent orchestration becomes more effective. Sub-agents execute well-scoped tasks that rarely need frontier reasoning, so they default to weaker but more cost-effective models with manual override. The primary model handles task decomposition and evaluation.
Optimizing Tokens per Request
Default Settings
All interactive run frameworks use a unified wrapper for install management, config, auth, and cost visibility. Two standardized defaults directly cut tokens per request: auto-compression at 400k tokens even for 1M context windows, balancing model performance, cache spikes, and repeat input token cost; reasoning effort default set to Medium, because output tokens (including internal reasoning tokens) are billed at multiples of input tokens, and Medium reasoning balances cost and quality for most tasks.
Prompt Caching Strategy
Prompt caching economics depend on provider read/write pricing. Since full conversation history is resent each turn, caching the prefix avoids repeated full-cost reads, dropping subsequent read cost to 0.1x standard input token rate. Write premiums vary: 5-minute cache entries cost 1.25x, 1-hour entries cost 2x. Optimal TTL depends on inter-turn idle time. Available TTLs: Anthropic 5min/1hr, OpenAI 30min. Engineers often idle interactive sessions beyond 5 minutes, so Uber changed the default from 5min to 1hr to prevent cache invalidation and full-price context rebuilds. Sub-agents keep 5min TTL due to short-lived tasks.
MCP Tools via Shell Execution
All MCP interactions route through a unified gateway covering 1,000+ MCP servers (internal and third-party SaaS), enabling centralized auth and policy enforcement. Standard MCP loads all tool schemas into every session regardless of use, adding 50-70k tokens of schema overhead for 100+ tools, repeated every turn. To solve context bloat, Uber introduced two complementary optimizations: CLI tool resolution lets models execute shell commands that dynamically resolve and invoke needed tools via the gateway, eliminating Uber MCP schemas from session context; tool search lets models search the tool catalog and load only needed tools, scaling to thousands of tools while maintaining high selection accuracy.
Code Mode for Batch Operations
When tools are invoked as shell commands, models can batch multiple operations in a single script. Standard MCP requires a separate model turn per operation: emit request, load raw response into context, process results sequentially. For example, a SQL query needs request submission, 2-5 status polls, and output retrieval. Code mode collapses this into an automated Python loop, keeping intermediate polling out of the model's active context. Running 5 identical SQL queries via both paths showed code mode reduces token usage by over 50% even for tiny result sets, by eliminating schema initialization, multi-turn polling, and redundant step-by-step reasoning. Batch workflows amplify savings to 90%+. Uber deployed 25+ pre-built code mode skills for highest-traffic MCP servers to make standard workflows default to the most cost-effective path.
SaaS MCP Integration
Third-party MCP servers are harder to manage because vendors expose full product capabilities (e.g., 49 tools ~22k tokens, 34 tools, 46 tools). Loading two or three vendor servers exceeds the token size of the file being edited before the user even prompts. Uber routes SaaS MCP through the same gateway, exposes them as CLI for any agentic interface, and writes dedicated code mode skills per server to encapsulate common workflows, unlocking efficient agentic workflows across many SaaS vendors.
Optimizing Requests per Turn
Context Engineering with AI Context Graph
In Uber's massive codebase (hundreds of millions of lines, thousands of tables), agents spend most turns locating information, not generating code. Uber built an AI Context Graph: a unified network of 24M nodes and 80M edges covering 86 node types and 117 edge types, integrating data from 30+ internal systems (services, teams, incident logs, PRs, architecture docs, deployments, datasets, historical table usage). Any agent can query it in natural language. An agent with graph access located a specific table used by 50+ analysts and answered in 38 seconds. Without the graph, the agent couldn't see the table, spent 20 minutes checking service code, spawned 2 sub-agents, hit 3 errors, and incorrectly concluded the dataset was unqueryable.
Visibility and Education
Status Bar Cost Counter
A real-time cost counter in the test framework's status bar tracks live spend per framework and per user across all frameworks.
Spend Tiers and Alerts
Instead of hard caps, Uber implemented real-time spend tracking with automated alerts: status bar live counter shows current session cost; execution framework pool shares a tier across all interactive frameworks (managed agents use separate tiers); Slack alerts at 50/80/100% projected spend give engineers time to plan; streamlined approval lets managers sign off tier increases for quick effect; cost check skill and prompts provide a dashboard skill for on-demand cost breakdown and real-time usage suggestions via status bar. These features let engineers independently assess task ROI while reducing runaway spend risk.
Session Analysis Dashboard
The status bar shows total session spend but not cost drivers or actionable efficiency steps. Generic guidelines can't evaluate individual workflows. The session analysis dashboard bridges this gap by directly inspecting session artifacts. Built into the runtime with no setup, running the cost dashboard skill analyzes all session traces across local and remote cloud sandboxes and all execution frameworks. It flags 16 distinct anti-patterns with financial impact and targeted fixes, including: suboptimal model routing (e.g., using Opus for simple multi-turn sessions Sonnet could handle); context window bloat (large MCP payloads like 40KB responses retained and re-billed); cache expiration inefficiency (long pauses invalidate prefix cache forcing full-price rebuild); prompt initialization overhead (pre-loading 100k tokens of system instructions and tool definitions before user input).
Future Work
Expanding managed agent fleet: For each new agent, establish target outcome metrics, build evaluation benchmarks, and identify a Pareto-optimal model to advance every SDLC stage to a higher factory maturity level.
Dynamic model routing: Expand benchmark coverage across more languages, repos, and agent shapes; effective routing relies on comprehensive evaluation because model capabilities vary widely.
Deeper context graph integration: Open graph querying to more autonomous agents.
Evolve session analysis into real-time developer coaching: Shift from periodic batch anti-pattern detection to continuous trajectory monitoring for personalized, real-time efficiency suggestions.
Continuous skill improvement: Explore automated logging of minor issues in agent skill executions and auto-generating skill updates from collected trajectories.
Conclusion
Managing and containing rising AI coding costs is a tractable engineering problem. By eliminating wasteful, zero-value token consumption rather than relying solely on lower unit prices or tool downgrades, Uber grew usage 7x while lowering unit costs across all metrics and maintaining or improving output quality. The core strategic shift is from interactive developer workflows to fully managed agents. Moving SDLC workloads into managed environments enables full control over model routing, execution frameworks, and operational spend. Optimizing a specialized fleet of managed agents, each with dedicated evaluation benchmarks and a Pareto-efficient model, is fundamentally more cost-effective and scalable than optimizing thousands of engineers' individual terminal sessions.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
