Routing Policies
Pick the right function for every request.
Routing turns a fleet of pricing functions into one decision. Choose how to pick a candidate, set per-function weights, and fall back through a chain when one fails.
What you can do
- Choose from seven routing strategies, including weighted rollouts and per-rule policies.
- Add a fallback chain so a single function failure never breaks pricing.
- Wrap each candidate in a circuit breaker that opens on errors and recovers automatically.
- Override the policy per request with an explicit function name when you need to.
- Audit which function actually served each call from the Cost Tracing view.
Seven routing strategies
explicitPin to one function. Useful when a tenant wants exact, repeatable behaviour.
cheapestLowest expected cost wins. Good for high-volume, latency-tolerant traffic.
fastestLowest p95 latency wins. Good for checkout and real-time surfaces.
round_robinEven split across candidates. Good for warming a new function.
weightedPer-function weights. Roll out a new model at 5% and ramp it up.
policyCustom rules per request — segment, geo, product type, anything in context.
defaultThe tenant's pinned default with a fallback chain behind it.
The runtime list and the RoutingStrategy type both come from ROUTING_STRATEGIES in packages/pcn, so this page can never drift from what the router actually accepts.
A policy looks like this
{
"name": "checkout-pricing",
"strategy": "policy",
"rules": [
{ "when": { "segment": "enterprise" }, "function": "lastprice/jale-advanced" },
{ "when": { "geo": "EU" }, "function": "lastprice/jale-elasticity" }
],
"fallback_chain": [
"lastprice/jale-optimizer",
"lastprice/jale-psychological"
]
}Ready to try it?
Spin up a free playground tenant in under a minute. No credit card.