Skip to content
Français

HarnessModelRoutingOptions

import type { HarnessModelRoutingOptions } from "@elie-laloum/outpost";
  • providerRequired
    DecisionProvider
    Independent decision provider used once per harness step after compaction.
  • modelRequired
    string
    Named router model, independently of the conversational candidate models.
  • decisionRequired
    Decision<Q>
    Frozen question declaration containing the selected choice question.
  • questionRequired
    Key
    Explicit choice-question key whose criteria exactly match the candidate model keys.
  • modelsRequired
    Readonly<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.
  • minConfidenceOptional
    number | undefined
    Confidence threshold in [0,1]; lower confidence selects fallback. Defaults to 0.85 when declared.
  • fallbackRequired
    \${Extract<keyof Extract<Q[Key], ChoiceQuestion>[“criteria”], string | number>}“
    Declared candidate key used for low confidence or permitted router failures.
  • onErrorOptional
    "fallback" | "fail" | undefined
    Defaults to fallback for timeout or classified unavailability only; fail propagates those faults. Other faults always propagate.
  • stateOptional
    ((context: HarnessModelRoutingContext) => DecisionState | Promise<DecisionState>) | undefined
    Optional synchronous/asynchronous state builder; default state contains instructions, visible history, tools, step and active model without opaque reasoning.
export interface HarnessModelRoutingOptions<
  Q extends DecisionQuestions = DecisionQuestions,
  Key extends RoutingQuestion<Q> = RoutingQuestion<Q>,
> {
  readonly provider: DecisionProvider;
  readonly model: string;
  readonly decision: Decision<Q>;
  readonly question: Key;
  readonly models: Readonly<Record<RoutingChoices<Q, Key>, ModelSpec>>;
  readonly minConfidence?: number;
  readonly fallback: RoutingChoices<Q, Key>;
  readonly onError?: "fallback" | "fail";
  readonly state?: (
    context: HarnessModelRoutingContext,
  ) => DecisionState | Promise<DecisionState>;
}