Repository navigation
Conversation
Tanguille
force-pushed
the
feat/agentgateway-model-routing
branch
from
October 22, 2026 22:45
5210f68 to
8701523
Compare
agentGatewayRef.routing: Model compiles a ModelRouter onto agentgateway's own model router (agentgateway v1.6.0+): one HTTPRoute whose single rule at "/" hands requests to AgentgatewayModel "*", and one AgentgatewayModel per inferenceServiceRef backend that matches the backend's served name and points a custom provider at the InferenceService's Service. For single-replica backends this drops the Inference Extension CRDs, the Endpoint Picker and the Gateway-wide PreRouting policy, and with them the MultipleInferencePoolsUnsupported and ConflictingPreRoutingPolicy refusals. routing defaults to InferencePool, so existing routers compile as before. Model mode requires sectionName or hostnames, so its catch-all rule cannot take over a shared Gateway. It refuses inputs it cannot express (rules, defaultRoute, external backends, resolution: endpoint, pickers, unmapped runtimes) and gates on the AgentgatewayModel CRD. It never adopts objects it did not create, prunes the models of removed backends, and cleans up the other mode's objects when routing changes. Part of defilantech#2151 (phase 1). Signed-off-by: Tanguille <91473554+Tanguille@users.noreply.github.com>
Tanguille
force-pushed
the
feat/agentgateway-model-routing
branch
from
October 22, 2026 23:17
8701523 to
1a72ad3
Compare
2 tasks done
This branch has not been deployed
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.
What
This adds a second way for
dataPlane: AgentGatewayrouters to work:agentGatewayRef.routing: Model.Today an AgentGateway router creates an InferencePool for every model, needs an Endpoint Picker, and puts a body-parsing policy on the whole Gateway. With
routing: Modelit uses agentgateway's built-in model router instead (agentgateway v1.6.0 or later). The router creates:AgentgatewayModelper backend, which points a model name at the InferenceService's Serviceagentgateway reads the model from the request body, answers
GET /v1/modelsitself, and returns a 404 for unknown models. You don't need the Inference Extension CRDs or an Endpoint Picker.The default stays
InferencePool, so existing routers don't change.Why
Part of #2151 (phase 1), following the plan in the maintainer's comment. Phase 2 (fallback between backends, aliases with request defaults) will be a separate PR.
How
Going through the points in that comment:
routingdefaults toInferencePool, andendpointPickeris rejected inModelmode. Since feat(router): per-backend Endpoint Picker for dataPlane: AgentGateway #2157, InferencePool mode already checks for a picker in the webhook and the reconciler, so I left that check there instead of adding a CEL rule.displayName, elsename) goes intomatch.model. The object name comes from the router and the backend (<router>-<backend>), so names likeQwen3.5-2Bororg/modelwork.routing.Modelmode requiressectionNameorhostnames, so it can't take over a whole Gateway.AgentgatewayModelCRD is missing, the router reportsAgentgatewayModelCRDNotInstalledand doesn't fail.The API formats come from the InferenceService:
Completions.Completions,Messages,AnthropicTokenCountandResponses.Embeddings, and rerankersRerank.Anything
Modelmode can't do yet is rejected at apply time and by the reconciler (UnsupportedInModelRouting): rules,defaultRoute, external backends,resolution: endpoint, per-backend pickers, and duplicate or wildcard model names.Testing
make test-e2e-rbacpasses. Therouting: Modelfixture goes Ready and creates its route and model under the generated RBAC.AI assistance
Checklist
make testpasses locallymake lintpasses locallygit commit -s) per DCO