MCPcopy Index your code
hub / github.com/bentoml/BentoML

github.com/bentoml/BentoML @v1.4.39

repository ↗ · DeepWiki ↗ · release v1.4.39 ↗ · Ask this repo → · + Follow
8,023 symbols 27,583 edges 436 files 588 documented · 7% 1 cross-repo links updated 13d agov1.4.39 · 2026-05-07★ 8,706142 open issues
README
<img alt="BentoML: Unified Model Serving Framework" src="https://github.com/bentoml/BentoML/assets/489344/de4da660-6aeb-4e5a-bf76-b7177435444d" width="370" style="max-width: 100%;">

Unified Model Serving Framework

🍱 Build model inference APIs and multi-model serving systems with any open-source or custom AI models. 👉 Join our forum!

License: Apache-2.0 Releases CI Twitter

What is BentoML?

BentoML is a Python library for building online serving systems optimized for AI apps and model inference.

  • 🍱 Easily build APIs for Any AI/ML Model. Turn any model inference script into a REST API server with just a few lines of code and standard Python type hints.
  • 🐳 Docker Containers made simple. No more dependency hell! Manage your environments, dependencies and model versions with a simple config file. BentoML automatically generates Docker images, ensures reproducibility, and simplifies how you deploy to different environments.
  • 🧭 Maximize CPU/GPU utilization. Build high performance inference APIs leveraging built-in serving optimization features like dynamic batching, model parallelism, multi-stage pipeline and multi-model inference-graph orchestration.
  • 👩‍💻 Fully customizable. Easily implement your own APIs or task queues, with custom business logic, model inference and multi-model composition. Supports any ML framework, modality, and inference runtime.
  • 🚀 Ready for Production. Develop, run and debug locally. Seamlessly deploy to production with Docker containers or BentoCloud.

Getting started

Install BentoML:

# Requires Python≥3.9
pip install -U bentoml

Define APIs in a service.py file.

import bentoml

@bentoml.service(
    image=bentoml.images.Image(python_version="3.11").python_packages("torch", "transformers"),
)
class Summarization:
    def __init__(self) -> None:
        import torch
        from transformers import pipeline

        device = "cuda" if torch.cuda.is_available() else "cpu"
        self.pipeline = pipeline('summarization', device=device)

    @bentoml.api(batchable=True)
    def summarize(self, texts: list[str]) -> list[str]:
        results = self.pipeline(texts)
        return [item['summary_text'] for item in results]

💻 Run locally

Install PyTorch and Transformers packages to your Python virtual environment.

pip install torch transformers  # additional dependencies for local run

Run the service code locally (serving at http://localhost:3000 by default):

bentoml serve

You should expect to see the following output.

[INFO] [cli] Starting production HTTP BentoServer from "service:Summarization" listening on http://localhost:3000 (Press CTRL+C to quit)
[INFO] [entry_service:Summarization:1] Service Summarization initialized

Now you can run inference from your browser at http://localhost:3000 or with a Python script:

import bentoml

with bentoml.SyncHTTPClient('http://localhost:3000') as client:
    summarized_text: str = client.summarize([bentoml.__doc__])[0]
    print(f"Result: {summarized_text}")

🐳 Deploy using Docker

Run bentoml build to package necessary code, models, dependency configs into a Bento - the standardized deployable artifact in BentoML:

bentoml build

Ensure Docker is running. Generate a Docker container image for deployment:

bentoml containerize summarization:latest

Run the generated image:

docker run --rm -p 3000:3000 summarization:latest

☁️ Deploy on BentoCloud

BentoCloud provides compute infrastructure for rapid and reliable GenAI adoption. It helps speed up your BentoML development process leveraging cloud compute resources, and simplify how you deploy, scale and operate BentoML in production.

Sign up for BentoCloud for personal access; for enterprise use cases, contact our team.

# After signup, run the following command to create an API token:
bentoml cloud login

# Deploy from current directory:
bentoml deploy

bentocloud-ui

For detailed explanations, read the Hello World example.

Examples

Check out the full list for more sample code and usage.

Advanced topics

See Documentation for more tutorials and guides.

Community

Get involved and join our Community Forum 💬, where thousands of AI/ML engineers help each other, contribute to the project, and talk about building AI products.

To report a bug or suggest a feature request, use GitHub Issues.

Contributing

There are many ways to contribute to the project:

Thanks to all of our amazing contributors!

Usage tracking and feedback

The BentoML framework collects anonymous usage data that helps our community improve the product. Only BentoML's internal API calls are being reported. This excludes any sensitive information, such as user code, model data, model names, or stack traces. Here's the code used for usage tracking. You can opt-out of usage tracking by the --do-not-track CLI option:

bentoml [command] --do-not-track

Or by setting the environment variable:

export BENTOML_DO_NOT_TRACK=True

License

Apache License 2.0

Core symbols most depended-on inside this repo

u
called by 1333
src/bentoml/_internal/server/static_content/swagger-ui-bundle.js
get
called by 1025
src/bentoml/_internal/server/static_content/swagger-ui-bundle.js
push
called by 823
src/bentoml/_internal/server/static_content/swagger-ui-bundle.js
call
called by 544
src/bentoml/_internal/client/__init__.py
set
called by 544
src/bentoml/_internal/server/static_content/swagger-ui-bundle.js
r
called by 460
src/bentoml/_internal/server/static_content/swagger-ui-bundle.js
concat
called by 394
src/bentoml/_internal/server/static_content/swagger-ui-bundle.js
_
called by 361
src/bentoml/_internal/server/static_content/swagger-ui-bundle.js

Shape

Function 3,588
Method 2,921
Class 1,410
Route 104

Languages

TypeScript53%
Python47%

Modules by API surface

src/bentoml/_internal/server/static_content/swagger-ui-bundle.js3,886 symbols
src/bentoml/_internal/server/static_content/swagger-ui-standalone-preset.js373 symbols
src/bentoml/_internal/cloud/client.py75 symbols
src/bentoml/_internal/runner/container.py74 symbols
src/bentoml/_internal/cloud/deployment.py58 symbols
src/bentoml/_internal/io_descriptors/pandas.py54 symbols
src/_bentoml_impl/client/proxy2.py53 symbols
src/_bentoml_sdk/service/factory.py51 symbols
src/_bentoml_impl/client/http.py51 symbols
src/bentoml/_internal/models/model.py49 symbols
src/bentoml/_internal/cloud/schemas/schemasv1.py49 symbols
tests/e2e/bento_server_http/service.py48 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

Jinja23.0.1 · 1×
PyYAML5.0 · 1×
a2wsgi1.10.7 · 1×
aiohttp-asgi-connector1.1.2 · 1×
aiosqlite0.20.0 · 1×
attrs22.2.0 · 1×
click7.0 · 1×
click-option-group
cloudpickle2.0.0 · 1×
fsspec2025.7.0 · 1×
httpx

For agents

$ claude mcp add BentoML \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact