As coding agents take on multi-step work across enterprise repositories, engineering leaders face a new operational challenge: controlling execution costs while maintaining code quality and oversight. Engineering leaders face a structural dilemma: token consumption is expanding exponentially, but base-model price cuts do not stop budget inflation. Scaling agentic software development across thousands of engineers requires moving beyond simple vendor negotiations and treating context management, model routing, and verification as core systems engineering disciplines.
How Enterprises Are Building Governed AI Software Factories
Uber, Databricks, Vercel, Shopify, and Amazon have documented different approaches to integrating coding agents into software development workflows. They are re-architecting the software development life cycle (SDLC) into semi-autonomous pipelines, broadly called the AI Software Factory.
In this model, work arrives as machine-readable events: production alerts, bug reports, issue tickets, or framework migration targets. Agents triage incoming tasks, build context boundaries, write code changes, run regression suites, and submit verified pull requests (PRs) for human approval.
Uber reports that more than 70% of its pull requests are now attributed to local or cloud agents, and that its engineers have built over 3,600 agent skills across the SDLC (as of August 2026). [1] In 2024, Amazon reported that its Q Developer code-transformation agent helped migrate about 30,000 production applications to Java 17, which it estimated saved 4,500 developer-years of effort and $260 million in annual infrastructure costs from Java 17 performance gains. [11] [14]
Running autonomous development loops across thousands of engineers and monorepos with hundreds of millions of lines of code carries real infrastructure and financial risk. Without appropriate controls, agent workflows can accumulate unnecessary context, reduce cache efficiency, increase tool-call overhead, and introduce changes that require additional architectural review.
These risks make execution controls, observability, and verification essential considerations when designing enterprise agent platforms.
Why Context Growth Drives AI Agent Costs
Volume discounts and smaller models can reduce unit costs, but they do not address the execution overhead that accumulates across agent workflows. That approach addresses unit cost and ignores context growth.
To control spend, enterprise platform teams decompose total expenditure into six multiplying terms: [1]
Total expenditure = Weekly Active Users (WAU) × (Sessions / Users) × (Turns / Session) × (Requests / Turn) × (Tokens / Request) × (Price / Token)
The formula separates developer adoption and workflow scale from internal platform execution efficiency:
- Adoption Terms: Weekly Active Users (WAU) and Sessions per User (Sessions / Users) measure organizational reach. Platform engineering aims to grow these metrics rather than restrict them through blunt usage caps.
- Platform Efficiency Terms: Turns per Session (Turns / Session) , Requests per Turn (Requests / Turn) , and Tokens per Request (Tokens / Request) capture execution overhead: context bloat, planning steps, schema definitions, and retry loops. Platform teams work to minimize these three terms.
- Commercial Unit Pricing Term: Price per Token (Price / Token) reflects base model rates, prompt caching discounts, and dynamic routing efficiency.
Why Per-Token Price Distorts Real Execution Costs
Lower token prices do not necessarily translate into lower task costs. A model that requires more tokens, retries, or execution turns may cost more to complete the same task.
Databricks’ internal benchmarking across its multi-million-line codebase shows this. In the July 2026 results, Claude Sonnet 5 was approximately 1.7x cheaper per token than Claude Opus 4.8. But on Databricks’ tasks, Sonnet 5 cost $2.09 per completed task compared to Opus 4.8’s $1.94 per task, while scoring lower on task completion accuracy (81% vs. 87%). Sonnet 5 consumed 1.9x more tokens, mostly because it worked longer and read more, so it cost more in practice. [2]
Model per-task cost comparison (Databricks internal benchmark)

In Databricks’ tests, running the same model at the same thinking effort through Pi instead of Claude Code or Codex changed cost per task by more than 2x in some cases, with no change in quality. Pi sent about 3x less context per turn. [2]
Bimodal Prompt Caching and Cache-Aware Routing
For workflows that repeatedly reuse large prompt prefixes, caching can substantially reduce input-token costs. Prompt caching can cut the cost of reused input tokens by 90% or more by storing conversation prefixes in provider memory. Maximizing cache efficiency requires aligning cache Time-To-Live (TTL) policies with human developer rhythms and subagent execution modes.
Anthropic’s API charges write premiums for cache creation (1.25x base input cost for 5-minute TTLs; 2.0x for 1-hour TTLs). Reads cost 0.10x on most models, a 90% discount, and less on some newer models. Other providers differ; Uber notes OpenAI offers a 30-minute TTL. In developer-facing interactive sessions, human pauses for local testing, code reading, or context switching routinely exceed five minutes. Under default 5-minute TTL policies, these pauses evict the cache prefix, and the subsequent turn forces a cold cache rebuild, paying full-price write penalties across accumulated context histories, repository maps, and tool schemas. [1] [13]
Platforms fix this with bimodal TTL policies:
- Interactive Developer Sessions: Configured with a 1-hour cache TTL. The higher write premium (2.0x) pays for itself across human conversational gaps and can preserve cached context across longer pauses between requests. [1]
- Subagents: Configured with a 5-minute cache TTL. Subagents handle single, short-lived tasks, so Uber keeps the cheaper TTL for them. Where a subagent may run longer than 5 minutes, Anthropic recommends the 1-hour TTL. [1] [13]
Routing must also respect cache persistence. Per-request routing (switching model providers turn by turn within a single session) destroys prompt-cache hit rates, which dominate total cost at scale. Databricks’ router avoids this by evaluating task complexity once at session start and keeping that model for the whole session. [4]
Understanding these context mechanics allows engineering organizations to shift from theoretical cost equations to production execution. Leading enterprise platforms translate these economic constraints into concrete architectural patterns tailored to their monorepo scale and workflow requirements.
Five Enterprise Approaches to Agentic Software Engineering
Five companies apply these constraints in different ways. Each case below shows how the company handles some combination of context boundaries, model routing, verification, and cost controls.
1. Uber: Context Graph Grounding and Code-Mode Execution
Uber organizes its AI infrastructure into a 4-layer execution stack, spanning interactive terminal harnesses down to fully managed autonomous agents. With the model held constant, Uber reports cost per 1,000 model requests down almost 34% from its peak (measured February to July 2026) and cost per session down 52% from its June peak. Over February to August, weekly active users across its agentic tools grew 7x and weekly agent requests grew 9.4x. [1]
Uber cut waste with three mechanisms:
- CLI Tool Projections: Standard Model Context Protocol (MCP) integrations pre-load JSON tool schemas directly into the LLM system prompt. In enterprise environments with over 100 installed tools, this schema injection adds 50,000 to 70,000 tokens of static overhead to every turn. Uber projects internal MCP tools through a central gateway as executable Command-Line Interface (CLI) binaries. Instead of loading extensive tool schemas into the prompt, the agent interacts with tools through CLI interfaces, reducing the initial context overhead. [1]
- Code-Mode Execution: Standard tool protocols require multi-turn JSON function calls, where an agent emits a request, polls status over multiple turns, and ingests raw responses into context. Code-Mode replaces multi-turn LLM turns with sandboxed Python scripts. Polling, intermediate wait states, and raw database payloads execute inside a local subprocess; only the final synthesized summary returns to the model context window. Standard tool protocols require multi-turn JSON function calls, where an agent emits a request, polls status, and ingests raw responses into context, Code-Mode replaces those turns with a sandboxed Python script; polling and raw payloads stay in a local subprocess, and only the summary returns to the model. In Uber’s test of five SQL queries in one Claude Code session, this cut tokens per query by 55% to 71% for small and mid-sized results, and by nearly 100% for one large wide-table query. Uber reports savings above 90% for bulk workflows, and notes results will vary by environment. [1]
- The AI Context Graph: To prevent ungrounded agents from failing slowly over long directory search loops, Uber engineered an AI Context Graph linking 24 million nodes and 80 million edges across more than 30 internal systems (service maps, team ownership, incident logs, PR diffs, database schemas). In one example Uber shared, the same prompt took 20 minutes without the graph, launched two subagents, hit three errors, and reached the wrong answer. With the graph, the agent found the table analysts actually use and answered correctly in 38 seconds. [1]
2. Databricks: Gateway Governance, Private Benchmarks, and Session-Level Smart Routing
Databricks operates as "customer zero" for its own AI governance infrastructure, routing all engineering coding-agent traffic through Unity Gateway (formerly Unity AI Gateway). Thousands of Databricks engineers use tools such as Claude Code, Codex, and Cursor simultaneously. Rather than enforcing a single IDE harness, Databricks standardizes on a unified control plane. [3] [5]
Databricks’ factory architecture has four parts:
- Central Gateway Governance: Every agent request is attributed to a user identity and metered centrally. MCP servers are governed in Databricks, developers authenticate once for GitHub and Atlassian, and traces flow via OpenTelemetry into Delta tables managed by Unity Catalog. [3] [9]
- Private PR-Mined Benchmarks: Databricks constructed an internal benchmark drawn from recent, human-authored pull requests across Scala, Rust, TypeScript, Protobuf, and Bazel codebases. Task prompts state intent without solutions, unit tests are held out for automated grading, and LLM judges are excluded to avoid rewarding superficial answers. To prevent scoring leakage, the harness seals git working copies from historical repository trees so agents cannot retrieve reference solutions from git logs. [2]
- Omnigent Meta-Harness and Smart Routing: Omnigent, an open-source meta-harness (alpha at launch), lets teams define a custom agent in YAML and move it between harnesses with a one-line change. [12] Built on top of this, Databricks deployed task-aware Smart Routing; a low-latency classifier labels task descriptions at session start, defaulting to a medium-sized model, escalating when a task needs frontier capability and delegating to cheaper models when it doesn’t. Smart Routing operates per-session rather than per-request to protect prompt-cache hit rates. Smart Routing is in Beta. In Databricks’ early results, it cut cost per task by 35% on its internal benchmark and 56% on public coding benchmarks, relative to a leading frontier model such as Opus 5. [4]
- Two-Budget FinOps: A single monthly budget previously caused 500 to 1,000 engineers to hit spending caps monthly, flooding platform teams with approval tickets. Databricks split spending controls into a small daily limit that catches runaway automation loops and a higher monthly limit requiring manager sign-off for exceptional project spend. Engineers raise the daily limit themselves by acknowledging in Slack that the spend is intentional. This prevents unattended background jobs from authorizing their own spending increases. [3]
3. Vercel: Station-Based Pipelines and Independent Review
Vercel’s Foreman is a software factory template built on eve, its framework for durable backend agents. It turns GitHub and Linear work items into reviewed draft pull requests by routing each item through four stations, each station is its own subagent that starts a fresh session and works only from the brief it is handed. The analyst, implementer, and reviewer each work in their own sandboxed checkout of the repository: [6]
- Classifier Station: Triages each item: type, priority, complexity, affected area, and whether it is actionable or needs clarification.
- Analyst Station: Plans against a live checkout of the repository, producing an approach, ordered steps, risks, and acceptance criteria.
- Implementer Station: Executes the plan in its own checkout, runs the repository’s own checks, commits, and pushes a branch.
- Reviewer Station: Judges the pushed branch against the acceptance criteria and returns approve, request changes, or reject, with evidence for each criterion. Requested changes go back to the implementer, for at most two rounds.
The reviewer never sees the implementer’s reasoning, and the template runs it on a different model vendor so it doesn’t share the implementer’s blind spots. A different vendor may reduce correlated errors, although it does not replace independent testing. Unattended runs stop at a draft pull request; a person marks it ready and merges. GitHub and Linear authenticate through Vercel Connect, which issues short-lived, scoped tokens at request time. Inside the sandboxes, git credentials are injected at the sandbox firewall, so they never enter the sandbox. [6] [7]
4. Shopify: Declarative Workflows and Session Replay
At Shopify, open-ended autonomy across Ruby and TypeScript systems initially created code drift, so Shopify developed Roast, a workflow orchestration framework built on Raix (Ruby AI eXtensions). [8] [10]
Roast combines deterministic code execution with non-deterministic model calls. Workflows are defined as declarative YAML pipelines containing sequential steps, such as parsing Abstract Syntax Trees (ASTs), computing code coverage diffs, or invoking linters, alongside LLM prompts. [10]
Roast persists every workflow step, API response, and shell output to disk, which allows session replay and resumption. If an execution fails during a late validation stage, an engineer can resume the pipeline from the exact point of failure without re-executing upstream LLM calls. Background agents can run with restricted file-write and command permissions. [10]
5. Amazon: Automated Java Modernization at Scale
Amazon used an AI agent to clear a large technical-debt backlog. In 2024, it reported using the Amazon Q Developer agent for code transformation to migrate production applications from Java 8 or 11 to Java 17. [14]
The agent automates the end-to-end upgrade process. Dependency migrations that can take a developer a day or more are often completed in minutes. [14] According to The New Stack, upgrading a single application had previously taken about 50 developer-days and could now be done in hours. [11]
Amazon reported about 30,000 migrated applications, though its own blog post says only “tens of thousands.” It estimated the work saved 4,500 developer-years, based on the number of Java dependencies migrated. It also estimated $260 million in annual cost savings, which came from performance gains in Java 17 that let Amazon remove hosts, not from developer-labor savings. Amazon describes both estimates as conservative. [11] [14]
Controlling Agent Costs Through Governance and Telemetry
Enterprise agent platforms need execution telemetry to identify inefficient workflows, monitor spending, and detect operational failures. Effective controls should limit runaway costs without unnecessarily interrupting legitimate engineering work.
Trace-Based Session Analyzers and Anti-Pattern Detection
While aggregate dashboards track macro-level spend, they typically fail to explain why specific agent sessions consume excessive tokens. Modern runtimes integrate automated trace analyzers that inspect raw session artifacts (JSONL logs, tool execution traces, context states) across local and cloud environments.
Uber’s session analysis dashboard scans executions for 16 distinct operational anti-patterns, pairing each detected inefficiency with estimated financial impact and targeted remediations. Four examples from enterprise trace analytics: [1]
- Suboptimal Model Routing: Executing basic multi-turn file edits or unit test updates on high-cost reasoning models when a mid-tier model could handle them.
- Context Window Bloat: Allowing large, unparsed API payloads (e.g., a 40KB raw JSON response from a monitoring service) to persist within conversation history, increasing the number of input tokens processed on subsequent turns, particularly when caching is unavailable or ineffective.
- Cache Expiration Inefficiencies: Intermittent developer pauses exceeding provider cache lifetimes trigger cold cache rebuild penalties across accumulated context.
- Prompt Initialization Overhead: Pre-loading large system instructions and tool definitions (Uber cites 100,000 tokens) before any user input is provided.
Four Architecture Decisions for Enterprise AI Leaders
What the five companies have in common is that their AI maturity comes from how efficiently and how safely the software factory runs. Engineering executives building AI platforms should make four design choices:
- Standardize on Gateway Control Planes: Implement a unified control plane (such as Databricks' Unity Gateway pattern) to meter token spend, centralize identity, manage MCP servers, and capture OpenTelemetry traces across all internal coding tools. [9]
- Decouple Tool Schemas and Polling Loops: Replace static MCP schema pre-loading with CLI projections or dynamic tool search. Offload multi-turn status polling, parsing, and file scans to Code-Mode Python scripts running inside sandboxed execution environments.
- Evaluate Models on Private PR-Mined Benchmarks: Do not select foundation models based on public academic benchmarks. Construct evaluation harnesses drawn from historical, human-authored pull requests, holding out tests and sealing git worktrees to prevent scoring leakage.
- Enforce Session-Aware Routing and Bimodal Cache Rules: Preserve prompt-cache hit rates by evaluating task complexity once at session start rather than routing per request. Apply 1-hour cache TTLs for interactive developer sessions and 5-minute TTLs for short-lived subagents.
For enterprises adopting coding agents, these patterns provide a practical starting point for architecture decisions. The right approach depends on repository complexity, security requirements, existing tooling, and the cost of failed changes. Factored's embedded AI and data engineers work alongside client teams to evaluate architecture decisions and support production implementation.
Discuss your AI engineering architecture with Factored's embedded engineers.
References
- Running a Software Factory Efficiently at Uber Scale - Uber Engineering Blog, August 2026
- Benchmarking Coding Agents on Databricks' Multi-Million Line Codebase - Databricks Blog, July 2026
- How Databricks manages its own coding agent spend with Unity Gateway Budgets - Databricks Blog, July 2026
- Smart Routing in Unity Gateway: Match frontier quality with 30%+ lower cost per task - Databricks Blog, August 2026
- Control spending with Unity Gateway - Databricks Documentation
- Build a Software Factory with Eve - Vercel Knowledge Base, August 2026
- The end of credential sprawl for agents - Vercel Blog, August 2026
- Roast: structured AI workflows in Ruby - Shopify, GitHub
- Governing Coding Agent Sprawl with Unity AI Gateway - Databricks Blog, April 2026
- Introducing Roast: Structured AI workflows made easy - Shopify Engineering, June 2025
- Amazon Revamps Developer AI with Code Conversion, Security - The New Stack, September 2024
- Introducing Omnigent: Meta-Harness to Combine, Control and Share Your Agents - Databricks Blog, June 2026
- Prompt caching - Claude Platform Documentation
- Amazon Q Developer just reached a $260 million dollar milestone - AWS DevOps & Developer Productivity Blog, August 2024


