Skip to main content
Connect a vLLM inference server to Hivenet Router by running an agent beside the backend. The agent discovers the model served by vLLM, registers it with the router, forwards requests, and reports engine and hardware metrics that Hivenet Router can use for routing and observability.
Each Hivenet Router agent registers one model. If a backend exposes several models, run a separate agent for each model and use --model to select the model that agent represents.

Before you start

You need:
  • a running Hivenet Router router
  • an NVIDIA GPU with CUDA support
  • network access between the agent host and the router
  • access to the model you want to serve
  • either Docker or a Python environment supported by vLLM
  • the Hivenet Router agent binary or Docker image
  • the same JWT secret used by the router
The examples use:
Replace these values with addresses and model names from your deployment.

Start vLLM

Start vLLM with host networking:
If the model requires authentication or license acceptance, provide the required credentials through your normal secrets-management process.Follow the startup logs:
Wait for the model to load, then check the backend:
A ready vLLM server returns HTTP status 200. List the models reported by vLLM:
The model ID returned here is the value clients must use when sending requests through Hivenet Router.

Prepare the Hivenet Router agent

From the Hivenet Router repository, build the agent image if you have not already done so:
Create a directory for the shared secret and persistent agent identity:
Place the router’s JWT secret at:
Protect it:

Start the agent

The /app/data mount preserves the agent’s peer identity across container replacement and restarts.The agent container receives GPU access so it can collect NVIDIA hardware metrics. Inference still runs in the separate vLLM process or container.
The agent waits for vLLM to become healthy before registering. If vLLM is still loading, the agent continues polling rather than exiting permanently.

Understand the agent settings

You can also add comma-separated routing tags:
Tags can be matched in routing policies.

Select the model

The agent can discover the model automatically or use an explicit model name.

Automatic discovery

When --model is omitted, the agent requests:
It registers the first model in the response. For a vLLM server exposing one model, automatic discovery is usually sufficient.

Explicit model selection

Use --model when you want to pin the agent to a specific model:
The explicit value overrides automatic discovery.
The model name registered by the agent must match the model name clients send to Hivenet Router.

Connect multiple models

Each agent registers as an independent peer and represents one model. If one backend exposes multiple models, start one agent process for each model:
Start the second agent with a different model and identity:
When several agents run on the same host, each one needs a separate --identity-path so every process keeps a distinct peer identity.

Set agent capacity

Set --capacity to the number of concurrent requests the backend can safely accept. For vLLM, start by matching it to --max-num-seqs:
You may set the Hivenet Router capacity slightly lower to preserve headroom:
When an agent reaches its declared capacity, the router stops assigning new requests to it and considers other matching agents or configured fallback steps. Capacity does not change vLLM’s own scheduler limit. It tells Hivenet Router how much work the agent is prepared to accept.
For streaming responses, Hivenet Router releases the agent capacity slot when response headers arrive, while backend generation can continue. Treat --capacity as a routing-admission setting rather than a hard limit on ongoing streams, and verify vLLM concurrency under sustained streaming load.

Verify the connection

On the router, check agent health:
List the models available to clients:
Inspect detailed routing state:
Send an inference request:

vLLM metrics

The agent scrapes vLLM’s /metrics endpoint every 500 milliseconds by default. It sends the resulting engine data to the router, which exposes it through the router’s Prometheus endpoint. The agent does not expose a separate Prometheus port. View all engine metrics on the router:
Useful exported metrics include:
View live values through the routing table:

Use vLLM metrics in routing policies

You can exclude agents whose KV cache is under pressure:
Or exclude agents with queued work:
When a metric is unavailable for an agent, Hivenet Router skips that gate for the agent rather than excluding it. See Policy YAML reference for the full policy schema.

Troubleshooting

The agent cannot discover a model

Check vLLM health:
Check model discovery:
The agent waits and retries if vLLM is healthy but no model is available yet.

The wrong model is registered

Automatic discovery selects the first model returned by /v1/models. Pin the correct one:
Restart the agent after changing the setting.

The agent does not register

Check the agent logs:
Confirm connectivity:
Check that the router and agent use the same JWT secret.

KV cache utilization remains high

Reduce the amount of work Hivenet Router assigns to the agent:
Or reduce vLLM’s scheduler limit:
You can also use a routing gate to stop selecting the agent above a chosen threshold.

Preemptions keep increasing

Rising preemptions indicate that vLLM is evicting in-flight KV-cache data under memory pressure. Reduce:
  • --capacity on the Hivenet Router agent
  • --max-num-seqs on vLLM
  • model context or batch pressure, where appropriate for your workload

Backend requests time out

The agent’s backend HTTP timeout defaults to two minutes. Increase it for longer requests:

The peer ID changes after restart

Make sure --identity-path points to persistent storage. For Docker, confirm the volume is mounted:
For bare metal:

Metrics are missing

Check vLLM’s metrics endpoint:
Check the agent logs for scrape errors. Metrics are scraped in the background. A scrape failure does not stop the agent from forwarding requests.

Next steps

Ollama agent

Connect an Ollama backend for local or edge inference.

Routing concepts

Learn how Hivenet Router filters and ranks matching agents.

Engine metrics

Understand the metrics collected from vLLM and other engines.