Skip to content

Commit e3f2e3f

Browse files
authored
Merge pull request #757 from agentgateway/docs/vllm-semantic-router-integration
docs: update vLLM Semantic Router integration
2 parents 3397ef2 + 1f6be3a commit e3f2e3f

6 files changed

Lines changed: 142 additions & 18 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[vLLM Semantic Router (vSR)](https://vllm-sr.ai/) classifies LLM requests and selects a model based on prompt content. With agentgateway, you can make this semantic decision before routing while continuing to apply gateway policies and record model, token, latency, and cost telemetry. See the [vSR Router API reference](https://vllm-sr.ai/docs/api/router/) for supported frontend and backend API types.
2+
3+
This integration is distinct from using [vLLM as an inference provider]({{< link-hextra path="/llm/providers/vllm/" >}}). vSR provides the model-selection policy. Your configured provider, Kubernetes Service, or InferencePool serves the selected model.
4+
5+
## How the integration works
6+
7+
The following diagram shows the [cost-based routing example](/blog/2026-07-17-semantic-routing-llm-costs/). A coding agent requests the stable `auto` model, vSR selects a lower-cost or higher-capability model, and agentgateway forwards the request and records the result.
8+
9+
{{< reuse-image-light src="img/integrations/vllm-semantic-router-cost-routing.svg" alt="A coding agent sends model auto to agentgateway. Agentgateway asks vLLM Semantic Router to select a model, routes the request to a lower-cost or higher-capability model, and records catalog-priced telemetry." >}}
10+
{{< reuse-image-dark srcDark="img/integrations/vllm-semantic-router-cost-routing.svg" alt="A coding agent sends model auto to agentgateway. Agentgateway asks vLLM Semantic Router to select a model, routes the request to a lower-cost or higher-capability model, and records catalog-priced telemetry." >}}
11+
12+
The request follows these component boundaries:
13+
14+
1. A client sends a supported request to agentgateway.
15+
2. An AgentgatewayPolicy calls vSR as an external processor during the `PreRouting` phase.
16+
3. vSR evaluates its semantic, complexity, keyword, context, and structure signals. It returns the selected model in its processing response.
17+
4. Agentgateway applies the routing decision and forwards the request to the configured provider or inference workload.
18+
5. Agentgateway records the requested and selected models alongside usage, latency, and optional catalog-priced cost data.
19+
20+
`PreRouting` is important when the vSR decision changes the model or adds a header that an HTTPRoute uses for matching. It makes the result available before agentgateway evaluates the route.
21+
22+
## Choose an integration path
23+
24+
The vSR and agentgateway projects provide complementary guides. Choose the one that matches the models and outcome that you want to evaluate.
25+
26+
{{< cards >}}
27+
{{< card link="https://vllm-sr.ai/docs/installation/k8s/agentgateway/" title="Deploy vSR with agentgateway" icon="external-link" description="Follow the vSR project guide to deploy the components on Kubernetes and route to vLLM-compatible inference workloads.">}}
28+
{{< card link="https://github.com/agentgateway/agentgateway/tree/main/examples/llm-semantic-routing" title="Evaluate cost-based routing" icon="external-link" description="Use the agentgateway example to select between hosted model tiers and measure the result with a model cost catalog and OpenTelemetry.">}}
29+
{{< /cards >}}
30+
31+
The vSR deployment guide owns the installation, Helm values, and semantic-router configuration. The agentgateway example owns the cost-routing policy and runnable gateway resources. Keeping those details with their projects avoids version drift in this integration overview.
32+
33+
{{< callout type="info" >}}
34+
Current vSR examples require agentgateway 1.3.0 or later for the external-processing options that control request streaming and mode overrides.
35+
{{< /callout >}}
36+
37+
## Integration considerations
38+
39+
- **Client model selection:** The cost-based example uses `model: "auto"` to opt in to semantic selection. This value is an example policy convention, not a reserved agentgateway model. You can let clients request model tiers directly or [validate the request body]({{< link-hextra path="/traffic-management/transformations/validate/" >}}) to require the automatic path.
40+
- **Backend choice:** vSR can select models served by hosted providers or Kubernetes inference workloads. Configure the corresponding [LLM provider]({{< link-hextra path="/llm/providers/" >}}) or routing backend in agentgateway.
41+
- **Model names:** Keep the names returned by vSR aligned with the models in your agentgateway routes, provider configuration, and cost catalog. You can expose stable client-facing names with [model aliases]({{< link-hextra path="/llm/alias/" >}}).
42+
- **Cost and observability:** vSR makes the semantic decision. Agentgateway remains the source for completed-request telemetry and can calculate realized cost when you configure a [model cost catalog]({{< link-hextra path="/llm/cost-controls/costs/" >}}). Use [LLM metrics and logs]({{< link-hextra path="/llm/observability/" >}}) or the [OpenTelemetry stack]({{< link-hextra path="/observability/otel-stack/" >}}) to evaluate the result.
43+
44+
Before a broad rollout, compare routed traffic with a fixed higher-capability-model baseline. Confirm that the policy uses both tiers, then evaluate task completion, user feedback, retries, and escalation rates alongside cost and latency.
Lines changed: 80 additions & 0 deletions
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: vLLM Semantic Router
3+
weight: 10
4+
description: Route LLM requests by prompt semantics with vLLM Semantic Router and agentgateway.
5+
aliases:
6+
- vllm
7+
---
8+
9+
{{< reuse "agw-docs/pages/integrations/vllm-semantic-router.md" >}}

content/docs/kubernetes/latest/integrations/vllm.md

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: vLLM Semantic Router
3+
weight: 10
4+
description: Route LLM requests by prompt semantics with vLLM Semantic Router and agentgateway.
5+
aliases:
6+
- vllm
7+
---
8+
9+
{{< reuse "agw-docs/pages/integrations/vllm-semantic-router.md" >}}

content/docs/kubernetes/main/integrations/vllm.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)