Before you start
You need:- a running Hivenet Router router
- an NVIDIA GPU with CUDA support
- SGLang installed or available as a Docker image
- network access between the agent host and router
- the Hivenet Router agent binary or Docker image
- the same JWT secret used by the router
- access to the model you want to serve
Start SGLang
- Docker
- Bare metal
Start SGLang with host networking:Follow the startup logs:
200.
List the models reported by SGLang:
Prepare the Hivenet Router agent
- Docker
- Bare metal
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
- Docker
- Bare metal
/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. SGLang continues to run as a separate process or container.Understand the agent settings
You can also add comma-separated routing tags:
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:
Explicit model selection
Use--model to pin the agent to a particular model:
The model registered by the agent must match the model name clients send to Hivenet Router.
Set agent capacity
--capacity controls how many concurrent requests Hivenet Router may assign to the agent.
It does not change SGLang’s own scheduler or memory configuration.
Start with a conservative value based on:
- available VRAM
- model size
- tensor-parallel configuration
- expected context length
- request concurrency
- acceptable latency
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 SGLang concurrency under sustained streaming load.Verify the connection
On the router, check agent health:SGLang metrics
The agent scrapes SGLang’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.
SGLang does not expose an inter-token-latency histogram through this integration. Hivenet Router therefore does not populate average or P90 ITL values for SGLang agents.
SGLang also has no preemption metric equivalent to the one collected from vLLM.
View engine metrics on the router:
Use SGLang metrics in routing policies
Exclude agents whose token cache is under pressure:Tune SGLang
Use more than one GPU
Set the tensor-parallel size:Enable RadixAttention
Start SGLang with:Increase the static memory fraction
Set:Troubleshooting
SGLang is not ready
Check the health endpoint:- Docker
- Bare metal
Metrics are missing
Confirm that SGLang was started with:404.
A metrics scrape failure does not stop the agent from forwarding requests.
The wrong model is registered
Automatic discovery selects the first model returned by/v1/models.
Pin the correct model:
The agent does not register
Check the agent logs:- Docker
- systemd
- the router and agent use the same JWT secret
- the router’s libp2p interface is reachable
- the router advertises a libp2p address the agent can reach
- SGLang is healthy and exposes a model
The peer ID changes after restart
Make sure--identity-path points to persistent storage.
For Docker:
Requests time out
The agent’s backend HTTP timeout defaults to two minutes. Increase it for long-running requests:GPU metrics are missing
Check that NVIDIA tools work on the host:Next steps
llama.cpp agent
Connect a llama.cpp server and enable its Prometheus metrics.
Routing concepts
Learn how Hivenet Router filters and ranks matching agents.
Engine metrics
Understand the metrics collected from SGLang and other engines.

