pub enum RoutingMode {
Observe,
Cost,
Balanced,
Quality,
Latency,
Max,
}Expand description
Named routing-mode presets: coherent (accuracy/cost/latency) constraint bundles layered on top of the existing escalation knobs. A mode is a resolver over existing config, not a new engine — it overrides only the knobs it has an opinion on; everything else comes from the route/global config unchanged.
Balanced (the default) is a strict no-op: with no mode set anywhere, behaviour is
byte-identical to existing behaviour. All other modes are opt-in overlays.
Set per-request via the x-firstpass-mode header, per-route via routing_mode = "...",
or globally via the FIRSTPASS_MODE_PROFILE env var.
Variants§
Observe
Forward without routing or gating; verdicts are asynchronous learning signals only. Maps to the existing observe passthrough path. Zero added latency, zero quality proof.
Cost
Prefer cheapest start; no speculative prefetch. Tradeoff: lowest token spend; can serve lower quality on hard or heavy traffic.
Balanced
Today’s default — bandit start, configured thresholds, configured speculation. This preset is a strict no-op: byte-identical to existing behaviour when applied.
Quality
One extra escalation rung allowed; serial (no speculative prefetch waste). Tradeoff: higher quality ceiling at higher cost; still bounded by gate verification.
Latency
speculation = 1 always: always prefetch one rung ahead to cut p95 latency.
Tradeoff: pays 1 wasted speculative call when the cheap rung passes.
Max
Start at the top (most expensive) ladder rung; verification as insurance. Tradeoff: highest quality, highest cost per call; bandit is bypassed; savings are minimal.
Implementations§
Source§impl RoutingMode
impl RoutingMode
Sourcepub const ALL: &'static [Self]
pub const ALL: &'static [Self]
All named modes in display order, for discovery surfaces (capabilities, MCP, CLI).
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
Lowercase string name, for use in headers and trace fields.
Sourcepub fn preset(self) -> ModePreset
pub fn preset(self) -> ModePreset
The knob overrides this mode applies on top of the route/global escalation config.
None fields are left unchanged — modes only override where they have an opinion.
Balanced returns all None/false: it is a strict no-op by invariant.
Trait Implementations§
Source§impl Clone for RoutingMode
impl Clone for RoutingMode
Source§fn clone(&self) -> RoutingMode
fn clone(&self) -> RoutingMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more