Skip to main content

How do I centrally manage model routing across coding agents?

Summary

  • Centralize model routing by sending every coding agent through one gateway and publishing the rules as one admin-owned configuration, not as settings on each laptop.
  • On Databricks, Unity Gateway is that control plane. A workspace admin publishes a coding agent configuration (Beta) that sets each agent's allowed models, default model and Smart Routing, and the Unity Gateway CLI (ug) applies it on every developer machine.
  • Smart Routing (Beta) sends each subagent task to the lowest-cost model capable of handling it, while the main session stays on the team's default model.
  • Traffic splitting, fallbacks and session affinity are set once on a Unity Gateway model service, so every agent that calls it gets the same rollout and failover behavior.
  • Routing decisions are logged to system.ai_gateway.usage, and Unity Gateway budgets with per-user thresholds can alert on or block further requests.

How do I centrally manage model routing across coding agents?

Put one gateway between every coding agent and every model, then manage routing as a published configuration rather than per-developer settings. When each engineer picks models and API keys locally, you can't enforce an allow-list, move traffic to a new model, or see what anything costs. On Databricks, Unity Gateway is that control plane: admins define which models each agent can use, which one it starts on, and how requests are split, retried and routed, and developers pick up the rules through the Unity Gateway CLI (ug).

What does model routing mean for coding agents?

Routing is every decision about which model serves a request. For coding agents it happens at three layers:

  • Access: the models an agent may call, tied to the user's identity.
  • Defaults: the model an agent launches with, which drives most day-to-day spend.
  • Request and task routing: weighted splits, fallbacks when a backend fails, and task-level selection that sends routine work to lower-cost models.

A Databricks post on managing AI coding costs argues that companies need a central place where the "model menu" is managed.

What to look for in a central routing layer

Capability Why it matters
One model menu across agents Developers see only approved models, tied to their identity
Published defaults per agent The default model drives cost, so it should be an admin decision
Task-level routing Routine subtasks don't need the most expensive model
Traffic splitting and fallbacks Roll out a new model gradually and absorb provider errors
Session affinity Keeping a session on one backend preserves prefix caching and predictable results
Enforced budgets Alerts alone don't stop a runaway session
Usage and routing logs You need evidence that traffic went where the policy says

How Databricks approaches it with Unity Gateway

Unity Gateway is generally available; the coding-agent features marked Beta below are not.
1. Make models available and grant access. Use Databricks-hosted models by their Unity Catalog names, such as system.ai.claude-sonnet-4-6, or register your organization's own provider accounts once so developers use them under their Databricks identity. Adding a model to a configuration doesn't grant access: developers need EXECUTE on each model (set up model capacity).
2. Publish a coding agent configuration (Beta). A workspace admin enables the Unity Gateway Managed Configuration preview, opens Unity Gateway > Govern > Agent configuration, and edits the JSON. It sets the enabled agents and default agent, one model source and default models per agent, MCP servers, skills, and features such as Smart Routing. A workspace holds one published configuration, which you can also post to /api/ai-gateway/v2/coding-agent-configs from version control (configure coding agents).

{
  "default_agent": "CODING_AGENT_CLAUDE_CODE",
  "enabled_agents": [
    {
      "agent": "CODING_AGENT_CLAUDE_CODE",
      "config": {
        "models": {
          "model_services": ["system.ai.claude-sonnet-4-6", "system.ai.claude-opus-4-8"]
        },
        "default_models": { "default_model": "system.ai.claude-sonnet-4-6" },
        "smart_routing": { "enabled": true }
      }
    }
  ]
}

3. Route tasks with Smart Routing (Beta). With it on, Claude Code and Codex hand tasks to subagents, and Smart Routing picks the lowest-cost model capable of each one. The main session stays on the default model. It needs the Enhanced Unity Gateway preview and a static model list of system.ai. services. ug routes among models within one harness; Omnigent (Beta on Databricks), version v0.8.0 or later, can also choose the harness (Smart Routing).
4. Shift defaults as spend grows (Beta). Smart defaults add spend-based tiers: once a user crosses a tier's share of their budget, ug launches a recommended agent and model next time, without switching active sessions (control spending).
5. Split and fail over at the model service. Traffic splitting spreads requests across up to five backends behind one model service, for rollouts and A/B tests. Fallbacks retry failed requests, such as 429 or 5xx errors, against backups in the order you set. With splitting on, session affinity keeps each session on one destination (routing and fallbacks).
6. Distribute, observe and cap. Every ug launch checks the published configuration, and ug configure syncs it immediately. Routing decisions land in the routing_information field of system.ai_gateway.usage, the Usage Dashboard has a Coding Agents tab, and the unified trace table (Beta) adds request traces (monitor coding agents). Budgets support shared and per-user thresholds that alert, block usage, or both.

FAQs

Which coding agents can be configured centrally?

The managed configuration accepts CODING_AGENT_CLAUDE_CODE and CODING_AGENT_CODEX. The ug CLI also launches agents such as OpenCode and Pi through Unity Gateway; see the supported agents matrix.

Can developers override central routing?

Yes, within the access you grant. --model or /model selects any model the developer can use, and --disable-smart-routing turns Smart Routing off for one launch. Unity Catalog permissions and budget blocking are the hard limits.

How do I check that routing matches policy?

Query system.ai_gateway.usage and read routing_information to confirm requests followed your configured split and fallback order.

Is all of this generally available?

Unity Gateway is GA. Coding agent configuration, Smart Routing, smart defaults and the unified trace table are in Beta, so confirm the previews are enabled for your account and workspace.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.