model-hosting-container-standards
Python toolkit for standardized model hosting container implementations with Amazon SageMaker integration
What it is and what it does
This package standardizes how ML models are deployed to Amazon SageMaker by providing a framework-agnostic Python toolkit built on FastAPI. It handles the boilerplate of setting up `/ping` and `/invocations` endpoints that SageMaker expects, with support for framework integration (vLLM, TensorRT-LLM) via decorators and customer customization via environment variables or custom handler functions. The package also supports LoRA adapter injection, automatic dependency installation from model artifacts, and comprehensive logging and error handling.
Typical use: framework developers register default handlers using `@register_ping_handler` and `@register_invocation_handler` decorators; customers then override behavior by placing a `model.py` script in their model artifact folder with `@custom_ping_handler` or `@custom_invocation_handler` decorators, or by setting environment variables. Handler resolution follows a priority chain (environment variables → customer decorators → function discovery → framework decorators), so customization is straightforward without forking the framework.
Use it for:
- Deploy vLLM or TensorRT-LLM models to SageMaker endpoints with standardized health-check and invocation routes.
- Add LoRA adapter support to model inference by injecting adapter IDs from request headers into model calls.
- Customize model behavior per deployment (e.g., different preprocessing logic) by writing a simple `model.py` without modifying framework code.
- Automatically install and manage model-specific dependencies from a `requirements.txt` in model artifacts before server startup.
- Integrate multiple ML frameworks under a single SageMaker hosting standard without writing repetitive endpoint boilerplate.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides standardized FastAPI-based handlers and decorators for deploying ML models (vLLM, TensorRT-LLM) to Amazon SageMaker with unified `/ping` and `/invocations` endpoints.
Yes, if you are deploying ML models to Amazon SageMaker and want to avoid writing boilerplate FastAPI handlers. The package is actively maintained, has low install friction, carries a permissive license, and provides real value through decorator-based handler registration and priority-based customization. No known vulnerabilities. Install it as a dependency in your SageMaker container image or framework integration layer.
Install
model-hosting-container-standards on PyPI
pip
pip install model-hosting-container-standardsuv
uv add model-hosting-container-standardspoetry
poetry add model-hosting-container-standardsInstalling model-hosting-container-standards
Before you install
Low friction: pure Python wheel with no compiled dependencies. Active maintenance (released 60 days ago), supports current Python versions (3.10–3.14). Seven runtime dependencies (fastapi, httpx, jmespath, pydantic, setuptools, starlette, supervisor) are all widely used and stable.
License in practice
Apache-2.0 (permissive): you may use, modify, and distribute this package freely in commercial and open-source projects, provided you include a copy of the license and state any material changes.
Quickstart
# Install
pip install model-hosting-container-standards
# In your FastAPI/vLLM server code
import model_hosting_container_standards.sagemaker as sagemaker_standards
from fastapi import Request, Response
import json
@sagemaker_standards.register_ping_handler
async def ping(raw_request: Request) -> Response:
return Response(content='{"status": "healthy"}', media_type="application/json")
@sagemaker_standards.register_invocation_handler
async def invocations(raw_request: Request) -> Response:
body = json.loads(await raw_request.body())
return Response(content=json.dumps({"predictions": ["result"]}), media_type="application/json")
Requires Python >= 3.10 and FastAPI >= 0.117.1. Intended for use within a SageMaker container or FastAPI application; not a standalone server.
Verify before relying
- Whether the package is actively maintained beyond the single release 60 days ago (repo URL not provided in metadata).
- Whether all seven runtime dependencies are actually required at runtime or if some are optional/development-only.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — fastapi, httpx, jmespath, pydantic, setuptools, starlette, supervisor |
| Maintenance | actively maintained — 60 days since the last release |
| First released | |
| Downloads | 2,917,196/month — #2,824 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: model_hosting_container_standards-0.1.16-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
sagemaker-serveProvides model serving and deployment…
permissive · top 5,000 on PyPI
sagemaker-inferenceProvides a model serving stack for deploying…
permissive · top 15,000 on PyPI
sagemaker-trainingIntegrates training scripts into Docker…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-sagemakerAutomatically captures traces of Amazon…
permissive · top 5,000 on PyPI
sagemaker-schema-inference-artifactsProvides pre-built schema inference artifacts…
permissive · top 5,000 on PyPI
sagemaker-containersProvides tools to build Docker containers…
permissive · top 15,000 on PyPI
sagemaker-trainTrains and deploys machine learning models on…
unclear · top 5,000 on PyPI
tensorflow-serving-apiProvides Python client APIs to communicate with…
permissive · top 5,000 on PyPI
azure-ai-agentserver-invocationsProvides HTTP and WebSocket invocation protocol…
permissive · top 15,000 on PyPI
sagemaker-data-insightsComputes ML-relevant statistical summaries of…
unclear · top 15,000 on PyPI