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§
- Adaptive
Config - Config for online/adaptive conformal serving (
crate::conformal::AdaptiveConformal). - Bandit
Config - Config for the UCB1 start-rung bandit (
firstpass_proxy::bandit::StartRungBandit). - Budget
- Spend caps.
Nonemeans “no cap”. - Config
- Top-level configuration document.
- Consistency
Def - Configuration for a self-consistency uncertainty gate: resample the original request
ktimes on the same model and score the candidate by agreement with the fresh samples. - Escalation
- Escalation limits and session-level promotion.
- Exploration
Config - Epsilon-greedy start-rung exploration: a fraction
epsilonof 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:
- Judge
Def - 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. - Model
Ref - A parsed
provider/modelreference. - Price
Def - A per-deployment price override for one model (
provider/model), USD per 1M tokens. - Provider
Def - 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.
- Session
Promotion - “After N failures within a window, promote this session’s starting rung.”
Enums§
- Abstain
Policy - Per-gate abstain policy (§7.2): what happens to serving when the gate can’t produce a verdict.
- Auth
Scheme - 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. - Bandit
Algorithm - 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).
- String
OrVec - A field that accepts either a single string or a list of strings in TOML/JSON.