Skip to main content

Module config

Module config 

Source
Expand description

Routing configuration (SPEC §8.4) — declarative, agent-first.

Config is the policy an operator (or agent) hands Firstpass: an ordered list of routes, each matching a slice of traffic to a mode, a model ladder, and gates; plus budget caps and escalation rules. The first matching route wins, so specific routes go first and a bare match = {} catch-all goes last.

Structs§

AdaptiveConfig
Config for online/adaptive conformal serving (crate::conformal::AdaptiveConformal).
BanditConfig
Config for the UCB1 start-rung bandit (firstpass_proxy::bandit::StartRungBandit).
Budget
Spend caps. None means “no cap”.
Config
Top-level configuration document.
ConsistencyDef
Configuration for a self-consistency uncertainty gate: resample the original request k times on the same model and score the candidate by agreement with the fresh samples.
ElasticConfig
Elastic-verification serving config (ADR 0008 Phase 3). When present, the gates named in expensive_gates are treated as skippable: a rung serves without running them when the visible (cheap, always-run) gate score is >= lambda — the elastic three-regime rule, validated offline (firstpass-bench --elastic, artifact docs/benchmarks/elastic-validation.txt).
Escalation
Escalation limits and session-level promotion.
ExplorationConfig
Epsilon-greedy start-rung exploration: a fraction epsilon of requests start at a uniformly-random rung so that propensities are logged and IPS/SNIPS off-policy estimates are valid (Horvitz-Thompson 1952; SNIPS: Swaminathan & Joachims 2015). The bandit still observes all gate verdicts — including from exploration draws — so learning is uninterrupted.
GateDef
A user-defined gate (SPEC §8.1). Exactly one kind per definition:
JudgeDef
Configuration for a native LLM-judge gate (SPEC §8.3): a separate model grades the candidate against a rubric. The runner enforces maker ≠ checker (a model never grades its own output) and treats the candidate as data, not instructions.
Match
Predicate over a request’s Features. Every present field is an AND-constraint; absent fields are wildcards.
ModePreset
Knob overrides a RoutingMode applies on top of the route/global escalation config. Only non-None fields override; absent fields leave the config value unchanged.
ModelRef
A parsed provider/model reference.
PredictorConfig
Per-query gate-pass predictor configuration (ADR 0008 Phase 2). The model is an online logistic regression (firstpass_core::predictor::PassPredictor) trained from the trace store. Its prediction is recorded on the receipt in shadow — it does not change routing in this phase; whether it is good enough to act on is decided offline (firstpass predictor-eval).
PriceDef
A per-deployment price override for one model (provider/model), USD per 1M tokens.
ProbeConfig
Shadow-probe configuration (ADR 0008 Phase 1): measure the validated k-sample gate-pass-count signal on a sampled fraction of requests WITHOUT changing serving.
ProviderDef
A model provider a ladder can route to. Declared as [[provider]] in TOML; referenced from a ladder as <id>/<model> (e.g. groq/llama-3.3-70b-versatile).
Route
One routing rule.
SessionPromotion
“After N failures within a window, promote this session’s starting rung.”

Enums§

AbstainPolicy
Per-gate abstain policy (§7.2): what happens to serving when the gate can’t produce a verdict.
AuthScheme
How a provider call is credentialed — orthogonal to Dialect (ADR 0006): dialect shapes the request/response body, auth scheme shapes how the request is signed/credentialed. Default (api_key_env / BYOK header) is unchanged for every existing [[provider]] entry.
BanditAlgorithm
Start-rung bandit selection algorithm.
Dialect
The wire API a provider speaks. anthropic = Messages API; openai = Chat Completions API (the de-facto standard that nearly every hosted and open-source model host implements); gemini = Google’s Generative Language API (generateContent).
Mode
Serving mode for a route (SPEC glossary).
OnExhausted
What to do when a spend cap is hit (SPEC §8.4 — never brick the customer).
RoutingMode
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.
StringOrVec
A field that accepts either a single string or a list of strings in TOML/JSON.