The typed counterpart to YAML routing — declare routing decisions in code with full type safety. Same topology, same routing rules, but the compiler and runtime schema validation catch mistakes before a single request goes out.
npm install conductor-sdk
import { route, type Rule, type Model } from 'conductor-sdk';
const models: Model[] = [
{ name: 'gpt-4o-mini', costPer1M: 0.75 },
{ name: 'gpt-4o', costPer1M: 15.0 },
];
const rules: Rule[] = [
{ when: 'summarize', routeTo: 'gpt-4o-mini', priority: 10 },
{ when: 'analyze', routeTo: 'gpt-4o', priority: 10 },
];
const { model } = route('summarize this document', rules);
// → model === 'gpt-4o-mini'
Every routing declaration is validated against a Zod schema at load time. Missing fields, unknown model identifiers, unset constraints, and empty fallback chains are surfaced synchronously — not at the first traffic spike. Type errors appear in your editor; structural errors appear in your build log. Either way, bad declarations never reach the routing engine.