ACAgentic Craft

Intermediate~12 minHazelJS

Model Routing

Choose models by task class, cost, and risk using per-agent model prefs and documented cost routing—not one frontier model for everything.

Authors
editorial-team
Published
Last reviewed

Problem

One frontier model for every step wastes budget or underperforms on specialist tasks.

Context

Platforms with multiple model providers and quality tiers.

Forces and constraints

  • Cost vs quality tradeoffs
  • Riskier tasks need stronger models + HITL
  • Routing logic must be observable

Recommended design

Assign model preferences per @Agent / DNA; use small models for classification routers and larger for hard reasoning; apply options.costRoute / CostOptimizer where documented in Agent OS. Keep budgets as hard stops.

Minimal pseudocode

@Agent({ name: 'router', /* model prefs per your DNA/config */ })
class RouterAgent {}

@Agent({ name: 'analyst' /* stronger model */ })
class AnalystAgent {}

await runtime.execute('router', goal, {
  budget: { maxCostUsd: 0.05 },
});

Failure modes

  • Silent fallback to expensive model
  • No eval coverage per model tier

Security considerations

  • Do not put API keys in DNA

Observability signals

  • Model id on each step span
  • cost by model

Evaluation approach

Quality floors per tier; cost regression tests

Trade-offs

  • Ops complexity of multi-model

Sources

Related patterns