How can I choose cheaper models automatically for new coding agent tasks?
Summary
- Omnigent can pick a harness and model for a new session automatically. When a user picks Auto, Smart Routing reads the first message and asks a router, either a built-in LLM judge or an external routing API, which combination fits the task.
- To keep trivial work off expensive models, the
deny_trivial_to_expensive_modelpolicy classifies a request as trivial or complex and denies trivial ones on the models you list. - Budget policies add a second guardrail.
cost_budgetasks at soft spend thresholds and, with an explicit expensive-model list, blocks those tiers at the hard limit so the session can move to a cheaper model with/model. - You can also choose models by role, because each sub-agent picks its own harness and model.
- Omnigent is open source (status alpha). On Databricks it is in Beta, and model access goes through Foundation Model APIs and Unity Gateway.
How can I choose cheaper models automatically for new coding agent tasks?
Omnigent, the open-source meta-harness for coding agents (Apache 2.0, status alpha), gives you two automatic levers and a few manual ones. Smart Routing picks the harness and model for a session from its first message. Policies then guard cost while the session runs: one denies expensive models for trivial requests, and budget policies gate spend. The docs describe Smart Routing as choosing the harness and model that fit the task, so whether that means a cheaper model depends on the router you configure. The cost policies use the expensive-model lists you provide.
Which options does Omnigent give you?
| Option | What it does | Trade-off |
|---|---|---|
| Smart Routing | The server picks a harness and model for the session from its first message | It decides once, at the start, and needs an llm: or routing: block in the server config |
deny_trivial_to_expensive_model |
Classifies each request to a model on your list as trivial or complex, and denies the trivial ones | Needs a server llm: block, and lets requests through if classification fails |
cost_budget (per session), user_daily_cost_budget (per user per day) |
Ask at soft spend thresholds, then block the expensive models you list at the hard limit | Reacts to spend, not to task difficulty |
| Per-role models | Each sub-agent sets its own executor.harness and model |
You pick the models by hand in YAML |
| Project default model | Pins the model new sessions start on for Claude Code and Codex | Static, though an explicit pick in the composer wins |
| Scheduled tasks | The REST API takes model_override and max_cost_usd per task |
REST API fields for unattended runs |
How does Smart Routing choose a model?
Smart Routing asks a router, "given this task, which harness and model fit?", and applies the answer for the rest of the session. Two routers exist. The built-in judge is an LLM call that uses the server's own llm: block:
# config.yaml, started with: omni server -c path/to/config.yaml
llm:
model: openai/gpt-5.5
connection:
api_key: ${OPENAI_API_KEY}
Or add a routing: block with provider: external to delegate to your own routes:select service, which receives the candidate harness and model pairs plus the task. With a router configured, users see an Auto option in the harness picker, and picking it defers the choice to the router on the first message. If the router errors or returns an invalid pick, the server falls back to the session's default harness.
How do you keep trivial tasks off expensive models?
policies:
skip_opus_for_trivial_tasks:
type: function
handler: omnigent.policies.builtins.routing.deny_trivial_to_expensive_model
factory_params:
expensive_models:
- databricks-claude-opus-4-6
session_budget:
type: function
handler: omnigent.policies.builtins.cost.cost_budget
factory_params:
max_cost_usd: 5.00
ask_thresholds_usd: [1.00, 3.00]
expensive_models: ["opus", "gpt-5"]
The first policy fires on requests to the listed model ids. When the server's LLM classifies the last user message as trivial, the policy denies the request and tells the agent to use a smaller model. The second gates cumulative spend. In cost_budget, expensive_models are case-insensitive substrings, so "opus" matches any Opus deployment. At the hard limit those tiers are denied until you switch to a cheaper model with /model, and cheaper models keep working. You can set policies per agent, server-wide or for one session.
How does Databricks approach model choice?
On Databricks, Omnigent is in Beta. Model access goes through Foundation Model APIs and Unity Gateway, so usage inherits Unity Gateway's governance and controls. A Databricks Sandbox host routes model access through Unity Gateway, and you can't bring your own provider API keys there. The managed service supports the built-in contextual policies and custom CEL policies, not custom Python policies. The Databricks documentation for the managed service doesn't describe Smart Routing settings. On a server you run yourself, you set llm: or routing: in the server config.
FAQs
Can I switch models in the middle of a session?
Yes. Use the /model command, or the model picker in the web UI.
Does Smart Routing re-route every message?
No. It uses the first message and applies the choice for the rest of the session.
Does the trivial-task policy slow or block my work?
It sends a classification request to the server's LLM when a request targets a listed model, and it caches the result per message. If the server has no llm: block or the call fails, the request goes through.
Can a sub-agent use a cheaper model than its supervisor?
Yes. Each sub-agent picks its own harness and model. The harness docs describe Pi as a headless worker that runs on any gateway model, suited to review, exploration and read-heavy tasks delegated by a supervisor.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.