Bento service with SGLang Router included
Project description
bento-sgl-router
Helper utilities for bundling an SGLang Router inside a BentoML service. It exposes a drop-in replacement for bentoml.service that starts the router sidecar, keeps it in sync with your LLM workers, and surfaces router metrics alongside your Bento.
Overview
- Wraps an existing BentoML service definition and injects an
sglang-routerprocess. - Automatically syncs worker hosts discovered from your
llmdependency during readiness probes. - Exposes router Prometheus metrics by merging them into the Bento service metrics endpoint.
Installation
pip install bento-sgl-router
Python 3.10 or newer is required. The package installs bentoml>=1.4.25 and sglang-router>=0.1.9 as dependencies.
Quickstart
Decorate an existing BentoML LLM service to bundle it with an SGLang Router:
import bentoml
from bento_sgl_router import service
@service(name="chat-router")
class ChatLLM:
...
Any keyword arguments supported by bentoml.service (such as image, labels, or resource configs) can be passed through the decorator.
Router configuration
Control router behaviour via environment variables:
| Variable | Default | Description |
|---|---|---|
ROUTER_POLICY |
cache_aware |
Scheduling policy passed to sglang_router.launch_router. |
Set the variable in your deployment environment or via envs=[...] when declaring the service.
Development
pdm install
pdm run pytest
The project keeps the code in bento_sgl_router.py and lightweight tests under tests/.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bento_sgl_router-0.0.6.tar.gz.
File metadata
- Download URL: bento_sgl_router-0.0.6.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2b1769598c46db3bfaef8725560820b9f07d0613e7628e09aa458a9ce2fee7b
|
|
| MD5 |
30a605203ab6087638153df0aa71922f
|
|
| BLAKE2b-256 |
b4fe53e77d2df4ab545bfb03648f8578d82627490584709211b1928b198368b7
|
Provenance
The following attestation bundles were made for bento_sgl_router-0.0.6.tar.gz:
Publisher:
release.yml on bentoml/bento-sglang-router
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bento_sgl_router-0.0.6.tar.gz -
Subject digest:
e2b1769598c46db3bfaef8725560820b9f07d0613e7628e09aa458a9ce2fee7b - Sigstore transparency entry: 566623945
- Sigstore integration time:
-
Permalink:
bentoml/bento-sglang-router@efa46d6fee6c32412da4ac5cb1470e46fea6505a -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/bentoml
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@efa46d6fee6c32412da4ac5cb1470e46fea6505a -
Trigger Event:
push
-
Statement type:
File details
Details for the file bento_sgl_router-0.0.6-py3-none-any.whl.
File metadata
- Download URL: bento_sgl_router-0.0.6-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9770552f21323c36881e8057426da5480ebd471d51099a80bc0855d8b936c0d1
|
|
| MD5 |
b6725e52a945d36f23aca394c246efa5
|
|
| BLAKE2b-256 |
dfb5493131f0ec237c6451e8e21dc840ea12936c0fb25d8969115f62f5088520
|
Provenance
The following attestation bundles were made for bento_sgl_router-0.0.6-py3-none-any.whl:
Publisher:
release.yml on bentoml/bento-sglang-router
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bento_sgl_router-0.0.6-py3-none-any.whl -
Subject digest:
9770552f21323c36881e8057426da5480ebd471d51099a80bc0855d8b936c0d1 - Sigstore transparency entry: 566623947
- Sigstore integration time:
-
Permalink:
bentoml/bento-sglang-router@efa46d6fee6c32412da4ac5cb1470e46fea6505a -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/bentoml
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@efa46d6fee6c32412da4ac5cb1470e46fea6505a -
Trigger Event:
push
-
Statement type: