AGENT SKILL

packaging-and-containerization

Build BentoML Services into Bentos, author bentofile.yaml or equivalent build options, configure runtime images/dependencies, manage local Bento stores, and containerize safely.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
packaging-and-containerization
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Build BentoML Services into Bentos, author bentofile.yaml or equivalent build options, configure runtime images/dependencies, manage local Bento stores, and containerize safely.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Packaging and Containerization

Use this sub-skill when the task is about turning a BentoML Service into a Bento artifact or OCI image: bentoml build, bentoml.build(...), bentofile.yaml, pyproject.toml [tool.bentoml.build], dependency/runtime image settings, file inclusion, local Bento store operations, or bentoml containerize.

Do not use this sub-skill for writing the Service/API itself, running clients or servers, BentoCloud deployment, or framework-specific model import/export details. Route those to service-authoring, serving-and-clients, cli-and-cloud, or model-management.

Fast Path

  1. Identify the entry Service import path, usually service:ClassName for a class decorated with @bentoml.service or module:svc for an exported service object.
  2. Prefer runtime image configuration in Python with bentoml.images.Image(...) attached to @bentoml.service(image=...) for new SDK Services.
  3. Use bentofile.yaml or [tool.bentoml.build] when the project needs declarative build metadata, file patterns, models, or compatibility with existing workflows.
  4. Run safe local validation before building: parse the YAML, check required files, inspect include/exclude patterns, and confirm dependency files exist.
  5. Build with bentoml build, bentoml build -f path/to/bentofile.yaml BUILD_CTX, or bentoml.build(...).
  6. Containerize only when Docker or another OCI backend is available: bentoml containerize BENTO_TAG or bentoml build --containerize.

Safe Local Checks

  • python scripts/validate_bentofile.py bentofile.yaml --project-dir . validates field shapes, required paths, and common packaging mistakes without running BentoML, Docker, network access, or dependency resolution.
  • python scripts/create_minimal_bentofile.py --service service:MyService --package numpy --include service.py prints a starter bentofile.yaml to stdout or writes it with --output bentofile.yaml.
  • bentoml build --bentofile bentofile.yaml --name NAME --version VERSION . creates a Bento in the local Bento store and may resolve dependencies; treat it as more expensive than static validation.
  • bentoml containerize BENTO_TAG --platform linux/amd64 requires a container backend and may pull base images or run Docker/BuildKit.

Core Workflows

  • Authoring field-level build files: see references/bentofile-reference.md.
  • Choosing CLI/API/container commands and build contexts: see references/workflows.md.
  • Diagnosing build and image failures: see references/troubleshooting.md.

Minimal Examples

A minimal bentofile.yaml:

service: "service:MyService"
include:
  - "service.py"
python:
  packages:
    - "numpy"
docker:
  python_version: "3.11"

Equivalent direct build API shape:

import bentoml

bento = bentoml.build(
    service="service:MyService",
    include=["service.py"],
    python={"packages": ["numpy"]},
    docker={"python_version": "3.11"},
)

A modern runtime image in service.py:

import bentoml

image = bentoml.images.Image(python_version="3.11").python_packages("numpy")

@bentoml.service(image=image)
class MyService:
    pass

Build Context Rules

  • Relative paths in include, exclude, requirements_txt, environment_yml, setup_script, dockerfile_template, wheels, and descriptions using file: are resolved relative to the build context.
  • If include is absent, BentoML includes all files under the build context, then applies exclude, .bentoignore, and built-in ignores such as .git/, virtualenvs, __pycache__/, and .DS_Store.
  • exclude always applies after include; use it to remove secrets, tests, training data, notebooks, and large artifacts.
  • For src/ layout projects, pyproject.toml auto-detection can mark python.is_src_layout, and explicit python: {is_src_layout: true} strips the leading src/ when packaging code.

Side-Effect Boundaries

  • Static YAML checks and file existence checks are safe.
  • bentoml build writes to the local Bento store and can run package locking; it may access package indexes or local model stores.
  • bentoml build --containerize, bentoml containerize, and bentoml.container.build require an OCI builder and may pull or build images.
  • bentoml push, bentoml pull, and bentoml deploy are cloud/network operations and belong in cloud/deployment workflows.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351