Skip to main content

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-router process.
  • Automatically syncs worker hosts discovered from your llm dependency 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

bento_sgl_router-0.0.4.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bento_sgl_router-0.0.4-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file bento_sgl_router-0.0.4.tar.gz.

File metadata

  • Download URL: bento_sgl_router-0.0.4.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

Hashes for bento_sgl_router-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8b0257c69f718ed5950f2eef28de6f3f2b1968997f1d94164d603f1e843c4619
MD5 da4b1364562e2b0b5f253e2728e3cc09
BLAKE2b-256 92d746f29f6b92696c14574fcec19a4c438c49a4bfed6ea4a262e4cd905a0958

See more details on using hashes here.

Provenance

The following attestation bundles were made for bento_sgl_router-0.0.4.tar.gz:

Publisher: release.yml on bentoml/bento-sglang-router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bento_sgl_router-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for bento_sgl_router-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7a67eee2f1b1e367f8ae1d251e3f460dbe0b5cbbe43873b07ee40d0b7995195e
MD5 629597e918c9c0d828e6f7cf50244c53
BLAKE2b-256 9fd69ea3191e5e5e32d74af12215ac9a1ea290d711294acac99d2f67bec391e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for bento_sgl_router-0.0.4-py3-none-any.whl:

Publisher: release.yml on bentoml/bento-sglang-router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page