Policies
How routing decides: filter first, rank survivors, no silent downgrade. Plus copyable presets grouped by goal.
Routing semantics
Filter first. Rank survivors. No silent downgrade. Routing is deterministic and ordered, and spend ceilings and quality minimums live in the filter, not the score, so a cheap model can never win on points against your rules. If it does not clear the floor, it is not a candidate at all.
A decision, step by step
One policy (tools, bench_intelligence ge 0.5, cheapest) over a live catalog (price_out is USD per million output tokens). The filter drops the two models below the floor; the cheapest survivor wins:
no_candidates); you never get a silent downgrade you didn't ask for. Terms are admitted and fingerprinted before they run, so a malformed policy is rejected (invalid_policy) rather than mis-routed.Preview a decision without spending inference: POST /x/rank returns the ranked survivors and the rule that dropped each model.
Watch policies resolve
The same idea inside a workflow: each node declares its own policy: a filter and a rank. Watch every step drop what fails its bar and lock the cheapest survivor (the output node declares no model; it just returns the last step).
Policy presets
Copyable routing patterns, grouped by goal. Each is an ordinary policy_ir: paste it, adjust the floor and ceiling, and ship. Dry-run with POST /x/rank first.
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["add",
["scale", 0.6, ["normalize", ["field", "bench_intelligence"]]],
["scale", 0.4, ["neg", ["normalize", ["field", "price_out"]]]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["cmp", "bench_intelligence", "ge", 0.5]],
["neg", ["normalize", ["field", "price_out"]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["cmp", "price_out", "le", 0]],
["field", "bench_intelligence"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "cap_reasoning"]],
["field", "bench_intelligence"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "in_image"]],
["neg", ["normalize", ["field", "price_out"]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["cmp", "context", "ge", 200000]],
["neg", ["normalize", ["field", "price_out"]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["has_cap", "supports_json_mode"]],
["add",
["scale", 0.5, ["normalize", ["field", "bench_intelligence"]]],
["scale", 0.5, ["neg", ["normalize", ["field", "price_out"]]]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["has_cap", "supports_tools"],
["cmp", "bench_agentic_rank", "le", 5]],
["field", "bench_agentic"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["has_cap", "supports_tools"],
["cmp", "bench_coding_rank", "le", 5],
["cmp", "price_out", "le", 5]],
["field", "bench_coding"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"],
["sample", 0.3], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["cmp", "latency_ms", "le", 2000]],
["add",
["scale", 0.7, ["neg", ["normalize", ["field", "latency_ms"]]]],
["scale", 0.3, ["normalize", ["field", "bench_intelligence"]]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["is", "has_tee"], ["is", "no_log"]],
["field", "bench_intelligence"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["add",
["scale", 0.6, ["normalize", ["field", "bench_intelligence"]]],
["scale", 0.4, ["normalize", ["field", "success_rate"]]]],
["top_k", 3, ["argmax"]], ["id"], ["always", {"action": "next_candidate"}]]