Skip to main content

AlgorithmSpec

Enum AlgorithmSpec 

Source
pub enum AlgorithmSpec {
    Noop {},
    Random {
        targets: Vec<String>,
        weights: Option<Vec<f64>>,
        seed: Option<u64>,
    },
    Passthrough {
        target: String,
        subagents: Option<SubagentRouteConfig>,
    },
    PlanExecute {
        capable_target: String,
        efficient_target: String,
        tool_semantics: ToolSemantics,
        planning_prompt: Option<String>,
        handoff_prompt: Option<String>,
        planner_reasoning_as_text: bool,
    },
    LlmClassifier {
        config: LlmClassifierRouteConfig,
    },
    StageRouter {
        tiers: StageTierConfig,
        picker: PickerMode,
        classifier: Option<StageClassifierConfig>,
        subagents: Option<SubagentRouteConfig>,
    },
    Auto {
        capable_target: String,
        efficient_target: String,
    },
    Composite {
        classifier: StageClassifierConfig,
        stage: StageTierConfig,
        subagents: Option<SubagentRouteConfig>,
    },
    Advisor {
Show 13 fields executor_target: String, advisor_target: String, reviewer_system_prompt: Option<String>, redo_feedback_prefix: Option<String>, gate_trigger: AdvisorTriggerConfig, gate_trigger_pattern: Option<String>, max_reviews: u32, gate_stall_turns: u32, gate_min_tool_results: u32, advisor_max_tokens: u64, advisor_temperature: Option<f64>, transcript_max_chars: usize, fail_open: bool,
}, Vgr { config: VgrRouteConfig, }, PrefillRouter { targets: Vec<String>, checkpoint: PathBuf, device: Option<String>, cache_dir: Option<PathBuf>, max_length: Option<usize>, batch_size: Option<usize>, }, }
Expand description

A routing algorithm described by configured target names.

Variants§

§

Noop

Replies OK without calling any model. Useful for smoke tests.

§

Random

Splits traffic across several targets.

Fields

§targets: Vec<String>

Target names to choose from.

§weights: Option<Vec<f64>>

Relative weights in targets order. Equal weights when unset.

§seed: Option<u64>

Makes the sequence of choices repeatable.

§

Passthrough

Sends every request to one target.

Fields

§target: String

Target that serves the request.

§subagents: Option<SubagentRouteConfig>

Separate policy for delegated sub-agent work.

§

PlanExecute

Plans on the capable target, then permanently hands off after the first mutation.

Fields

§capable_target: String

Target used before the first edit or write.

§efficient_target: String

Target used from the first edit or write onward.

§tool_semantics: ToolSemantics

Additional tool names whose mutations trigger handoff.

§planning_prompt: Option<String>

Replaces the built-in planning instruction.

§handoff_prompt: Option<String>

Appends an instruction to the handoff request.

§planner_reasoning_as_text: bool

Replays visible planner reasoning summaries as assistant text at handoff.

§

LlmClassifier

Asks a judge model which target should serve the request.

Fields

§config: LlmClassifierRouteConfig

Judge and tier settings, written directly in the route table.

§

StageRouter

Picks a tier per turn by scoring signals from recent tool results.

Fields

§tiers: StageTierConfig
§picker: PickerMode

Tier to use when the signals are not confident.

§classifier: Option<StageClassifierConfig>

Judge consulted for turns the tool signals cannot decide.

§subagents: Option<SubagentRouteConfig>

Separate policy for delegated sub-agent work.

§

Auto

Picks a routing strategy automatically, preset with recommended knobs. Currently a stage_router with picker = "efficient_first" and confidence_threshold = 0.5; change build_algorithm’s Auto arm to repoint it at a different algorithm or preset.

Fields

§capable_target: String

The capable tier.

§efficient_target: String

The efficient tier.

§

Composite

A judge picks the tier at each user turn; a stage router runs the turns within it.

Fields

§classifier: StageClassifierConfig

Judge that picks the tier. Called through its own target.

§stage: StageTierConfig

The stage router the judge hands off to.

§subagents: Option<SubagentRouteConfig>

Separate policy for delegated sub-agent work.

§

Advisor

Serves every turn from one target, and has a second model review some of those turns before the caller sees them.

Fields

§executor_target: String

Serves every client-visible turn.

§advisor_target: String

Reviews gated turns. Never a routing destination.

§reviewer_system_prompt: Option<String>

Replaces the built-in APPROVE/REDO reviewer prompt.

§redo_feedback_prefix: Option<String>

Replaces the built-in text put in front of a REDO plan.

§gate_trigger: AdvisorTriggerConfig

What fires a review.

§gate_trigger_pattern: Option<String>

Regular expression for the pattern trigger. Required by it, and unused otherwise.

§max_reviews: u32

How many reviews one session may spend.

§gate_stall_turns: u32

Reviews a turn after this many assistant turns, as a mid-task checkpoint. Zero turns the checkpoint off.

§gate_min_tool_results: u32

Tool results a turn needs before it can be reviewed. Skips early chatty turns.

§advisor_max_tokens: u64

Most output tokens one review may use.

§advisor_temperature: Option<f64>

Sampling temperature for reviews. Left off the request when unset.

§transcript_max_chars: usize

Size cap on the transcript sent to the advisor. Longer transcripts are trimmed from the middle.

§fail_open: bool

Lets the turn through when the advisor fails, instead of erroring.

§

Vgr

Fields

§

PrefillRouter

Routes using a checkpoint-backed prefill classifier.

Fields

§targets: Vec<String>

Target names in checkpoint output order.

§checkpoint: PathBuf

Tensor-only router checkpoint path.

§device: Option<String>

PyTorch device used for encoder inference, such as cpu, cuda, or cuda:0. Auto-detected when omitted.

§cache_dir: Option<PathBuf>

Directory where Hugging Face caches the downloaded encoder and tokenizer.

§max_length: Option<usize>

Maximum tokenized encoder input length; longer prompts are truncated.

§batch_size: Option<usize>

Maximum prompts per encoder forward pass.

Implementations§

Source§

impl AlgorithmSpec

Source

pub fn routing_target_names(&self) -> Vec<&str>

Completion targets in algorithm order; judge-only targets are excluded.

Source

pub fn callable_target_names(&self) -> Vec<&str>

Every target the algorithm may call, including judge-only targets.

routing_target_names covers completion destinations; a classifier also calls its judge, and that call needs a client too.

Source

pub fn build( &self, route_name: &str, targets: &BTreeMap<String, ModelId>, ) -> Result<Arc<dyn Algorithm>, AlgorithmConfigError>

Builds this algorithm after resolving configured target names.

Source

pub fn build_with_runtime_models( &self, route_name: &str, targets: &BTreeMap<String, ModelId>, ) -> Result<(Arc<dyn Algorithm>, RuntimeModels), AlgorithmConfigError>

Resolves target names to host model IDs and builds the algorithm and runtime groups.

Trait Implementations§

Source§

impl Clone for AlgorithmSpec

Source§

fn clone(&self) -> AlgorithmSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AlgorithmSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AlgorithmSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more