Repository navigation
Let Team model routers classify requests with a decision model, within its context - #348
Merged
Merged
Conversation
Team model routers take a third classifier type, jev: the router asks a shared decision model of the AI Gateway, such as Microsoft-Decision-1, to pick the tier. The operator registers it with LiteLLM's jev_classifier_config naming the decision model only, so LiteLLM's own instructions apply and the router does not count against LiteLLM's licence limit. The operator publishes the Gateway's decision models in its catalog, the Portal offers them for the new classifier, and the router planner now sees every shared model: it refuses a tier or an llm classifier that answers no conversation, and a jev classifier that is not a decision model. In our tests Decision-1 placed 39 of 40 English and 39 of 40 Chinese prompts on the expected tier, where the heuristic classifier placed 15 and 11. Until now only routers defined in the Gateway chart could use it. The registrations of existing heuristic and llm routers are unchanged, so an upgrade does not register them again. A Team router named like a shared model that answers no conversation, such as a decision model, is now refused as misconfigured. Apart from that case, the operator change itself restarts no Agent.
The guard shortens the request a router sends a decision model to classify a request to as many bytes as the model takes tokens: the smallest model_info.max_input_tokens of its deployments, or 32,768, Microsoft-Decision-1's, less the questions and 512 bytes for the service's own template. Each token is at least one byte of text, so the request fits in any language. The newest user message stays whole where it fits, and the rest keeps its beginning and its end; the Gateway logs each change without its content. A client's own calls to the Decisions API are left as they are. Routers with a jev classifier, Team routers the operator registers and routers in the Gateway chart alike, now send a request whose classification failed to their default model, the medium tier, instead of to LiteLLM's heuristic scorer. A router that sets classifier_fallback keeps its value; one with its own tier_definitions keeps its fallback_tier. Measured directly, Microsoft-Decision-1 refuses a request over 32,768 tokens with a 422. LiteLLM sends the classifier the caller's whole system prompt, so every request with a long system prompt was refused, and the router silently used the heuristic scorer, which placed 15 of 40 English and 11 of 40 Chinese prompts on the expected tier in our tests. With LiteLLM 1.105.1 and Microsoft-Decision-1 on a local rig, requests with a 40,000-word English or a 60,000-character Chinese system prompt, or a 120 KB log as the message, were classified by the decision model after the change and by the heuristic scorer before it. Chart routers with a jev classifier that do not set classifier_fallback send a failed classification to their default model after the upgrade, which rolls the Gateway pods. Team routers with a jev classifier are new on this branch and are registered with the setting from the start. Heuristic and llm routers, and their registrations, are unchanged.
Pengfei Ni (feiskyer)
approved these changes
Oct 29, 2026
This was referenced Nov 2, 2026
Zhupku
added a commit
that referenced
this pull request
Nov 2, 2026
…re it writes (#397) * Align the install, Sandbox and smart-routing docs with make deploy, decision-model Team routers and optional Teams Since #364, make deploy DEPLOY_CONFIG=<environment.yaml> installs the platform. The site still told readers to run the platform helper with DOMAIN and VALUES_FILE, which now exits with an error, and to install Sandbox admission without enforcement themselves, which make deploy refuses. - Install CetiRun: make publish with the VS Code Server license acceptance, what must exist before the first make deploy (with the Gateway's Secrets), the environment file, make deploy-plan and make deploy. - Policy-bound Teams: the admission certificate and administrators before the first run, then the registration, the peer labels, and a second make deploy that enables Sandbox execution. - Smart routing: models in the environment file, with the auto router and the decision model that make deploy requires; a Team router named auto-team, because auto is the Gateway's; decision models for Team routers (#348); default_model_fallback, and a log query on routing_cause. - Gateway chart README, teams.md and models.md: a jev router falls back to its default model, and the guard shortens its classifier requests (#348). make publish needs the license flag. - first-instance.md: a Team is optional (#353), and the form's model switches, default model and Agent Identity switch. - helm.md, scripts.md, infrastructure.md, and the platform README and values comments: make deploy instead of the earlier helper's variables. - The site test now expects make deploy on the installation page, and no VALUES_FILE invocation. * Say that LiteLLM's spend log keeps prompts and responses by default Since #363, spendLogs.storePrompts defaults to true, so each row of LiteLLM_SpendLogs holds the call's prompt and response. The Helm reference and the platform values comment still said that neither is stored. The stdout request log still carries no content. * Name a wrong managed Istio Deployment or mesh ConfigMap before make deploy writes AKS managed Istio adds the revision to the name of the ingress gateway Deployment, but the example environment file had the name without it. The preflight then failed at kubectl rollout status, and the helper withholds tool output, so the run only said "kubectl --context failed with exit 1". The preflight now makes sure that the configured control plane and ingress Deployments exist before it waits for them. If one does not exist, it names the input, and the name with the revision when that Deployment exists. It does not replace a configured name. A mesh ConfigMap that does not exist is created by the helper. AKS managed Istio reads only istio-shared-configmap-<revision>, so a different name left the OAuth2 provider out of the mesh without an error. The preflight now stops when the configured ConfigMap does not exist but that one does. * Give the example's ingress Deployment its revision, and say how to read the AKS Istio names The example named the control plane Deployment and the mesh ConfigMap with the revision placeholder, but not the ingress gateway Deployment. Install CetiRun and the platform README now say which managed Istio names carry the revision, how to read them from the cluster, and when make deploy stops. --------- Co-authored-by: Scott Zhu <mengzezhu@microsoft.com>
Pengfei Ni (feiskyer)
pushed a commit
that referenced
this pull request
Nov 3, 2026
… router names (#396) * Give Gateway routers the smallest limits of their models A router configured in the Gateway's models had no context window or output limit in Agent configurations unless the administrator set them on the router, so Agents used their own defaults, which can exceed a tier model's window. The catalog now gives such a router the smallest limits among its tier and default models, as for a Team's router; limits set on the router are kept. Only Agents configured with the router are reconfigured when its limits change. * Send a router's request on to its other models when its tier fails A complexity router's tier model that failed, such as an Agent's GitHub Copilot model while its proxy was down, failed the request with 503 although the router's other tiers could answer, and the error named the router's internal model group. The guard now gives a router request fallbacks for that request only: the tier's other models, the higher tiers, the default model, then the lower tiers. Fallbacks the administrator, a key, a team or the request names apply instead; refusals and unreadable encrypted reasoning still go to no other model. LiteLLM's router details are kept out of errors, retry fields are dropped from router_settings_override as from the body, and the request log records fallback_from, attempted_fallbacks and fallback_cause. * Let Agents use a Team's router by its name Hermes showed a Team router by its internal name, cetirun-router-<hash>, and clients that list the key's models saw that name. The operator now keeps a key alias for each granted Team router, the router's name for its internal name, unless the Agent reaches another model by that name, and records it on the router's status. Hermes is configured with the router's name; OpenClaw keeps the internal name its sessions hold. The Gateway lists such a router under its name only. A Policy's per-model limit for a Team router's name is set under the internal name, which the Gateway counts. * Describe the jev classifier of Team routers and its fallback in the routing docs The smart-routing page and the Gateway README still said that Team routers classify with heuristic or llm only and that a failed decision classifier falls back to the heuristic scorer. Team routers take a decision model since #348, the Gateway shortens a request to fit the decision model, and a jev router sends a request it cannot classify to its default model. * Say what attempted_fallbacks counts and record the live tier-fallback measurement On the e2e cluster, a router request whose Copilot tier failed was answered after a fallback to the router's Azure tier and a failover within that model, and the request log reported attempted_fallbacks 2 where the response header said 1: LiteLLM counts failovers to another deployment of the same model as well. * Keep a policy limit on a Team router's name when another model keeps the name A per-model limit that an AgentPolicy sets for a Team router's name was moved to the router's internal name. When one of the Agent's GitHub Copilot models has the same name, the key gets no alias for the router, and the Agent still requests the Copilot model by that name. The Copilot model then had no per-model limit, on every reconcile, also when the router was not granted. The operator now copies the limit to the internal name and keeps it under the router's name. The Gateway counts the router's requests under the internal name, also those sent by the alias. The name's limit applies to the other model when the name is not the router's alias. The copy does not depend on the alias, which the same pass decides later, after the Copilot routes are registered, so no pass leaves either model without its limit. If the policy limits both names, the internal name gets the smaller value. Tests: the existing limit test now expects the name to keep its limit and checks the smaller-value rule in both directions; a new test covers a router named like a Copilot model with RPM and TPM limits, granted and withdrawn. * Say that a standalone Gateway does not limit a router's tier fallbacks to the key The README said that LiteLLM uses only the models that the caller's key can use for the fallbacks that the guard adds to a router's request. LiteLLM examines the key for fallback targets only with general_settings.enforce_fallback_model_access, which the chart sets with operatorIntegration. main now says the same for router.fallbacks. A standalone Gateway does not examine the key, but these fallbacks go only to the router's own models, which the router can select for the key anyway. --------- Co-authored-by: Scott Zhu <mengzezhu@microsoft.com>
Pengfei Ni (feiskyer)
pushed a commit
that referenced
this pull request
Nov 3, 2026
* Give Gateway routers the smallest limits of their models A router configured in the Gateway's models had no context window or output limit in Agent configurations unless the administrator set them on the router, so Agents used their own defaults, which can exceed a tier model's window. The catalog now gives such a router the smallest limits among its tier and default models, as for a Team's router; limits set on the router are kept. Only Agents configured with the router are reconfigured when its limits change. * Send a router's request on to its other models when its tier fails A complexity router's tier model that failed, such as an Agent's GitHub Copilot model while its proxy was down, failed the request with 503 although the router's other tiers could answer, and the error named the router's internal model group. The guard now gives a router request fallbacks for that request only: the tier's other models, the higher tiers, the default model, then the lower tiers. Fallbacks the administrator, a key, a team or the request names apply instead; refusals and unreadable encrypted reasoning still go to no other model. LiteLLM's router details are kept out of errors, retry fields are dropped from router_settings_override as from the body, and the request log records fallback_from, attempted_fallbacks and fallback_cause. * Let Agents use a Team's router by its name Hermes showed a Team router by its internal name, cetirun-router-<hash>, and clients that list the key's models saw that name. The operator now keeps a key alias for each granted Team router, the router's name for its internal name, unless the Agent reaches another model by that name, and records it on the router's status. Hermes is configured with the router's name; OpenClaw keeps the internal name its sessions hold. The Gateway lists such a router under its name only. A Policy's per-model limit for a Team router's name is set under the internal name, which the Gateway counts. * Describe the jev classifier of Team routers and its fallback in the routing docs The smart-routing page and the Gateway README still said that Team routers classify with heuristic or llm only and that a failed decision classifier falls back to the heuristic scorer. Team routers take a decision model since #348, the Gateway shortens a request to fit the decision model, and a jev router sends a request it cannot classify to its default model. * Say what attempted_fallbacks counts and record the live tier-fallback measurement On the e2e cluster, a router request whose Copilot tier failed was answered after a fallback to the router's Azure tier and a failover within that model, and the request log reported attempted_fallbacks 2 where the response header said 1: LiteLLM counts failovers to another deployment of the same model as well. * Send images to the Gateway models that accept them OpenClaw and Hermes treated most Gateway models as text-only: Hermes every one, OpenClaw every name its own catalog does not know (routers, Copilot Claude and Gemini, merged names). Hermes had the model describe each image in an extra call; OpenClaw had another model describe it and offered no computer tool. The operator now reads supports_vision from the Gateway's model info and the price table. A shared name accepts images when every deployment does, and the Agent's own Copilot route under the name too; a router when every model it sends requests to answer does. A chart that declares aiGateway.visionModels gets the list: OpenClaw sets input text and image, Hermes supports_vision, for those models only. * Keep the label of OpenClaw's tool-result images out of router classification With images, OpenClaw passes on the images of a tool result, such as a screenshot of its computer tool, in a user message of their own, labelled "Image(s) from tool result #1 (computer):". A complexity router classifies the newest message a person wrote and took that label for it: measured on LiteLLM 1.105.6, a request for a design that a heuristic router put in the medium tier went to the simple tier after one screenshot. A jev router kept the complex tier. Team routers and the routers of the Gateway chart that set no markers of their own now leave the label out, as they leave out OpenClaw's context. Each Team router is registered again once, as its configuration changes. * Keep a policy limit on a Team router's name when another model keeps the name A per-model limit that an AgentPolicy sets for a Team router's name was moved to the router's internal name. When one of the Agent's GitHub Copilot models has the same name, the key gets no alias for the router, and the Agent still requests the Copilot model by that name. The Copilot model then had no per-model limit, on every reconcile, also when the router was not granted. The operator now copies the limit to the internal name and keeps it under the router's name. The Gateway counts the router's requests under the internal name, also those sent by the alias. The name's limit applies to the other model when the name is not the router's alias. The copy does not depend on the alias, which the same pass decides later, after the Copilot routes are registered, so no pass leaves either model without its limit. If the policy limits both names, the internal name gets the smaller value. Tests: the existing limit test now expects the name to keep its limit and checks the smaller-value rule in both directions; a new test covers a router named like a Copilot model with RPM and TPM limits, granted and withdrawn. * Say that a standalone Gateway does not limit a router's tier fallbacks to the key The README said that LiteLLM uses only the models that the caller's key can use for the fallbacks that the guard adds to a router's request. LiteLLM examines the key for fallback targets only with general_settings.enforce_fallback_model_access, which the chart sets with operatorIntegration. main now says the same for router.fallbacks. A standalone Gateway does not examine the key, but these fallbacks go only to the router's own models, which the router can select for the key anyway. --------- Co-authored-by: Scott Zhu <mengzezhu@microsoft.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Team model routers (
Team.spec.modelRouters) could classify requests only with LiteLLM's heuristic scorer or with a shared chat model (llm). Routers defined in the AI Gateway chart can also use a decision model, such as Microsoft-Decision-1, through LiteLLM'sjevclassifier. In our tests that classifier placed 39 of 40 English prompts and 39 of 40 of their Chinese translations on the expected tier (every pair on the same tier), where the heuristic classifier placed 15 and 11 and never chose the complex or reasoning tier. This change lets a Team's routers use it too, and keeps a decision classifier working for requests with a long system prompt.Team routers with a decision model (first commit)
classifier.typetakesjevbesidesheuristicandllm;classifier.modelis required forllmandjev. Forjevit names a shared decision model: a shared model whosemodel_info.modeisevaluation. The comment that said LiteLLM's licence limit keeps other classifier types away from Teams is corrected: LiteLLM limits ajevclassifier only when it sets its own instructions.classifier_type: jev,jev_classifier_config: {deployment_name: <model>}andclassifier_fallback: default_model(second commit), and no instructions, so LiteLLM's own instructions apply and the router does not count against LiteLLM's licence limit. The router planner now sees every shared model, not only chat models, and refuses with a specific message:llmclassifier that names a shared model that answers no conversation;jevclassifier that names a shared model that is not a decision model;The classifier is granted as before: it must be a shared model, need not be listed by the AgentPolicy, is not put on the Agent's key, and its calls are charged to the Agent. A classifier change replaces the router's registration without changing Agents' configuration.
decisionModels), still apart from the shared models Agents are configured with, and seeds them on start like the shared models.jev. Agent creation options are unchanged.Decision classifier requests within the decision model's context (second commit)
Measured directly, Microsoft-Decision-1 refuses a request over its 32,768-token context with 422 ("Question prompt exceeds the 32768-token context limit including the decision token"), in any language: about 31,000 English words or 40,000 Chinese characters. LiteLLM sends a
jevclassifier the caller's whole system prompt and its latest user messages, however long they are, so every request of an Agent with a long system prompt was refused, and the router silently classified it with the heuristic scorer.model_info.max_input_tokensof the decision model's deployments, or 32,768 when none sets it, less the questions LiteLLM asks and 512 bytes for the service's own template. A token of a decision model stands for at least one byte of text, so the shortened request fits in any language. It keeps the newest user message whole where it fits, and the beginning and the end of the rest; a newest message that does not fit keeps its beginning and its end. The Gateway logs a warning with the decision model and the sizes, not the content. A client's own calls to the Decisions API, and classifier calls to a chat model, are left as they are.jevclassifier, Team routers and the Gateway chart's own alike, send a request whose classification failed anyway (for example while the decision model is unavailable) to their default model, the medium tier, instead of to the heuristic scorer. A chart router that setsclassifier_fallbackkeeps its value; one with its owntier_definitionskeeps itsfallback_tier.teams.md(smart routing, with ajevexample and the behaviour above),crds.md,models.md, and the Gateway chart README (the router defaults and the guard callback).Related issue
Follow-up to #263, which added Team model routers, and to #344. No separate issue.
Validation
Compatibility and operational impact
jevand the classifier rule now also requires a model forjev. Existing Teams stay valid. Upgrade the CRD with the operator, as the charts do.llmrouters keep their registration IDs, so an upgrade does not register them again.decisionModels; the Portal's Agent creation options do not include them.jevclassifier that do not setclassifier_fallbacksend a request whose classification failed to their default model after the upgrade, instead of to the heuristic scorer; on that path a request is not moved to another tier by its length. The Gateway pods roll once, as for any configuration change.llmtojev, replaces its registration in the Gateway and leaves legacy Agents' configuration unchanged. Adding a router, as before, adds a model to the Agents granted it, which restarts them once. Native Sandbox Agents take the whole Team spec as an execution input, so any router edit restarts them once.Checklist