Policy
Use logical models to define upstream selection, failover, and conditional routing.
Choose a routing strategy
| Strategy | Use case |
|---|---|
| single | Route a logical model to one upstream target. |
| fallback | Try configured alternatives after primary failure; targets must meet request capabilities. |
| load_balance | Distribute traffic using configured weights. |
| conditional | Select targets using Metadata or time conditions with an explicit timezone; unmatched requests use default. |
| auto (decision-v1) | A fixed Decision model chooses among approved candidates; uncertain or failed decisions use a fallback. |
Create and apply a Policy
-
Create a Policy and a logical model such as support-chat in Gateway → Policy.
-
Use @slug/upstream-model from a visible Integration as a target, then configure the strategy and capabilities.
-
Bind a Gateway API key to this Policy, validate, review, and publish.
-
Call model: support-chat and inspect the actual Provider and attempt results in request details.
Configure decision model routing
Provision and publish the business candidates and judge in the current Workspace. The judge must support native Decisions or System One, Usage, and Token Credits rates; an ordinary Chat model is not a substitute. Deploy matching Web, Control Plane, and Gateway versions to use this feature.
Create or edit a logical model in Policy and select decision model routing (auto / decision-v1). Add 2–8 candidates, each with a name, Integration, upstream model, and suitable tasks and limitations in one card. Enter routing requirements and choose a fallback. Selecting the judge infers its protocol. Add logical model and Add candidate appear below their lists.
Test a draft and read the result
Use an editor account and a valid published test Gateway API key allowing Integration model access; no plaintext Key is required. The editor defaults to an available Key and refreshes models when it changes. Enter approved test text and run the test. Short-lived delegation binds the current draft; testing incurs judge cost, without business generation, saving, or publication.
Results distinguish a selected target, fallback, and no eligible target. Inspect the final model, candidates sorted by probability, latency, Credits, and token usage; expand excluded candidates when present. Configuration, sample, or Key changes mark the previous result stale. Preview success does not guarantee business Provider health or budget. Save, review, and publish, then call the logical model through a Key bound to the Policy to verify the real path.
Probability thresholds and boundaries
Probability thresholds in advanced settings are off by default: valid authorized choices are accepted even at low or tied probabilities. When enabled, the highest selection probability and the top-two margin must pass; insufficient values or ties use fallback. The initial 0.75 / 0.15 values are experimental and need calibration. Existing nonzero thresholds stay enabled; disabling them affects business requests only after saving and publishing. Selection probability is not answer accuracy.
Text Chat Completions, stateless Responses, and business SSE are supported. Business requests must set positive max_tokens / max_completion_tokens or max_output_tokens. Tool conversations, multimodal input, and stateful continuation such as previous_response_id are unsupported. Full visible text is sent to the judge Provider; exceeding the evidence limit uses an eligible fallback without truncation. Test samples are not archived.
abstain, invalid results, timeouts, or judge unavailability use an eligible fallback; no eligible target means rejection. Permissions, limits, budgets, and cancellation can still stop a request and cannot be bypassed through fallback. Judge and business calls are billed separately. Empty capacity metadata means unknown for candidates and judges; only configured positive limits are enforced, and upstream may still reject. Routing quality, savings, and latency need separate evaluation.
Session stickiness
Enable Session stickiness to select a model on the first request and prefer the same Integration and upstream model for follow-ups. This reduces repeated decisions and improves opportunities for context cache reuse. New drafts enable it by default; existing configurations keep their behavior. Advanced settings default to 30 idle minutes, configurable from 1–1440 minutes. Unavailable targets use configured backups, subject to allowed failures and attempt limits; without an eligible backup, routing may decide again or reject. A successful backup becomes the preferred target.
The fingerprint uses the first system and first user messages, plus the first developer instruction; Responses instructions are treated as developer content. No extra session identifier is required. Keep opening instructions and the initial user intent stable, appending new turns at the end. Changing these, idle expiry, or a new publication triggers model selection again. Requests without user text skip stickiness. Permissions, capabilities, capacity, and budgets are checked on every request; a hit saves only the judge call, while business usage is billed normally.
Draft tests always make a fresh decision without reading or changing business stickiness. Save, review, and publish, then call the same logical model with the same Key, retaining initial messages and appending turns. Request metadata can show session_sticky without a routing_decision judge call for that request. The current cache is local to one Gateway process and stores only digests and target identities. Restarts or capacity eviction clear entries; replicas do not share them, and concurrent first requests may decide independently. Stickiness does not store answers, guarantee upstream cache hits, or inject X-Session-ID, prompt_cache_key, or cache_control.
Configuration and version compatibility
This fragment belongs under models[].strategy.auto.decision in a Policy; it is not a complete Policy:
{
"session_stickiness": {
"enabled": true,
"idle_ttl_seconds": 1800
}
}session_stickiness is optional and off when omitted. If supplied, both enabled and idle_ttl_seconds are required. The API uses integer seconds from 60–86400; the console uses minutes, so 30 minutes is 1800 seconds. Each hit restarts the idle timer.
Before publishing, upgrade Web, Control Plane, and Gateway to matching versions supporting Snapshot v15. Including the field generates v15 even when explicitly disabled; older Gateways reject it. Before downgrading, restore a compatible Release without the field; existing decision-v1 uses v14. Turning off the switch alone does not restore compatibility.
Verification and troubleshooting
- A judge call on every turn: confirm you are calling a published logical model, not a draft test. Keep the first system, developer, and user messages, Key, Policy, Release, and operation unchanged. A missing or empty first user message skips stickiness; process changes, restarts, expiry, eviction, and concurrent first requests can also trigger new decisions.
- A changed target: inspect
_shieldon.auto_routing.reasonand_shieldon.auto_target.session_stickyindicates a hit;session_fallbackindicates a backup selected because the cached target failed static checks. Online retries may also switch targets, so use actual target and attempt records to identify the final model and supplier, rather than the initial routing reason alone. - No upstream cache savings: stickiness only preserves target preference. Check Provider Prompt Cache support, identical request prefixes, and its cache lifetime, which differs from the idle timer here. Verify actual Provider-reported cached usage; one fewer judge call is not evidence of an upstream cache hit.
- A new task still uses the same model: stickiness favors stability. The same Key and identical opening may share a target preference, but never conversations or answers. Start a conversation with a new initial user intent, or disable stickiness and publish, when fresh selection is needed.
Time and failure boundaries
Time conditions use an explicit IANA timezone such as UTC and are evaluated at request start. Overnight windows belong to their start date. Fallback and retries remain subject to capabilities, timeouts, budgets, and streaming state.
Direct models bypass logical routing. To require a key to use logical models, disable its direct Integration access and publish again.
Examples
Stable model name and fallback
In Workspace → Gateway → Policy, create support-chat, select a visible Integration model as its primary target, and bind the application’s Gateway API key to this Policy. Publish the changes, then send the logical model name shown below. To prepare for provider failures, choose fallback and add a compatible backup target. After publication, eligible failures can try the backup without changing the application’s model name; this does not guarantee recovery from every error.
{ "model": "support-chat" }Temporary content diagnostics
For missing prompts and replies, edit the Policy and set Request retention mode to content, specify retention and size limits, then publish. Send a new request and inspect Request Logs → Request details → Captured payloads as an administrator. Historical requests are not backfilled. Capture storage must be configured; asynchronous capture can be missing. After diagnosis, switch to none and publish again.