Skip to content

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.

last-price.ai/routing-policies
Routing Policies builder — assign rules and fallbacks per tenant.

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

  • explicit

    Pin to one function. Useful when a tenant wants exact, repeatable behaviour.

  • cheapest

    Lowest expected cost wins. Good for high-volume, latency-tolerant traffic.

  • fastest

    Lowest p95 latency wins. Good for checkout and real-time surfaces.

  • round_robin

    Even split across candidates. Good for warming a new function.

  • weighted

    Per-function weights. Roll out a new model at 5% and ramp it up.

  • policy

    Custom rules per request — segment, geo, product type, anything in context.

  • default

    The 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

POST /api/routing-policies
{
  "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.