defineHarnessModelRouting
Purpose and behavior
Section titled “Purpose and behavior”Validate and freeze a choice-to-model routing declaration. Exact candidate keys and a declared fallback are required; the built-in harness validates candidates against its model provider before allocation.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”optionsRequiredHarnessModelRoutingOptions<Q, Key>Choice question, exact candidate mapping, fallback policy and optional state builder.options.providerRequiredDecisionProviderIndependent decision provider used once per harness step after compaction.options.modelRequiredstringNamed router model, independently of the conversational candidate models.options.decisionRequiredDecision<Q>Frozen question declaration containing the selected choice question.options.questionRequiredKeyExplicit choice-question key whose criteria exactly match the candidate model keys.options.modelsRequiredReadonly<Record<\${Extract<keyof Extract<Q[Key], ChoiceQuestion>[“criteria”], string | number>}`, ModelSpec>>`One candidate per declared choice; all use the harness model provider and have independent model settings.options.minConfidenceOptionalnumber | undefinedConfidence threshold in [0,1]; lower confidence selects fallback. Defaults to 0.85 when declared.options.fallbackRequired\${Extract<keyof Extract<Q[Key], ChoiceQuestion>[“criteria”], string | number>}“Declared candidate key used for low confidence or permitted router failures.options.onErrorOptional"fallback" | "fail" | undefinedDefaults to fallback for timeout or classified unavailability only; fail propagates those faults. Other faults always propagate.options.stateOptional((context: HarnessModelRoutingContext) => DecisionState | Promise<DecisionState>) | undefinedOptional synchronous/asynchronous state builder; default state contains instructions, visible history, tools, step and active model without opaque reasoning.