Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Deploy an open-weight LLM to a SageMaker AI real-time endpoint as an Inference Component, using the latest vLLM Deep Learning Container, a GPU instance sized to the model, tensor-parallel set to the GPU count, and model weights staged in S3. Use when the user asks to deploy / host / serve an open-weight model (e.g. GPT-OSS-20B) on SageMaker for inference or benchmarking. Works for any HuggingFace SafeTensor model the vLLM container supports — nothing here is model-specific.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 21% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 20% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 25% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 22% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 60% | 0% |
The portable contract that makes a non-deterministic agent definitive. Agents improvise; this SKILL.md constrains what must hold (the APIs, the ordering, the compatibility rules) while leaving how open as explicit, bounded options. The IDE is interchangeable — this contract is what travels.
Deploy a HuggingFace SafeTensor OSS model from S3 to a SageMaker AI real-time endpoint via an Inference Component (IC). Plain deploy — measurement is the sagemaker-benchmark skill, and optimization is the sagemaker-optimize skill. Path is fixed: CreateModel → CreateEndpointConfig → CreateEndpoint → CreateInferenceComponent → smoke test.
This skill is model-agnostic. Deploy whatever open-weight model the user names; you only need three facts about it, which then drive Decisions 2–4:
| Property | Why it matters | Drives | |---|---|---| | Weights size (GB) + dtype | must fit in GPU memory alongside the KV cache | instance choice (Decision 2) | | vLLM support | the DLC serves models with a native vLLM implementation | instance + go/no-go | | Context length needed | longer context = more KV-cache memory | max_model_len (Decision 4) |
Default running example: GPT-OSS-20B (openai/gpt-oss-20b, ~13 GB mxfp4, text + reasoning) — a strong open model that is not one-click in JumpStart, i.e. the exact "raw weights → production" case this skill is for. If the user names another model, deploy that one; if unspecified, ask. The same path works for Llama, Mistral, Qwen, etc.
Rule: pick the smallest instance whose GPU memory comfortably holds weights + KV cache, then set tensor_parallel_size = GPU count.
| Instance | GPU | GPU mem | Good for | |---|---|---|---| | ml.g6.16xlarge | 1× L4 | 24 GB | ≤13B, or ~20B quantized (GPT-OSS-20B mxfp4 fits); reliable capacity | | ml.g6.24xlarge | 4× L4 | 96 GB | larger / TP=4; recommendation-job target | | ml.g6e.16xlarge | 1× L40S | 48 GB | single big GPU — ~30B or long context | | ml.g6e.12xlarge | 4× L40S | 192 GB | larger, TP=4 | | ml.g7e.2xlarge | 1× RTX PRO 6000 Blackwell | 96 GB | newest; capacity scarce (see guard) | | ml.g7e.12xlarge | 2× RTX PRO 6000 Blackwell | 192 GB | 30B+ / FP8; quota often 0 |
(Families: g6 = L4 24 GB, g6e = L40S 48 GB, g5 = A10G 24 GB, g7e = RTX PRO 6000 Blackwell 96 GB.)
Capacity guard (non-negotiable): quota ≠ available capacity. A deploy can sit in Creating then fail with InsufficientInstanceCapacity even at nonzero quota. Always:
<instance> for endpoint usage quota ≥ 1 (Service Quotas),Observed: g7e.2xlarge failed after ~30 min; g6.16xlarge came up in ~4 min.
Resolve the newest SageMaker vLLM DLC live — do NOT hardcode a stale tag:
aws ecr describe-images --registry-id 763104351884 --repository-name vllm --region <REGION> \
--query 'imageDetails[].imageTags' --output jsonPick the tag with the highest vLLM semantic version (X.Y.Z) matching X.Y.Z-gpu-py312-cuNNN-ubuntu22.04-sagemaker — sort by the version triple, not by push date (a backport patch to an older line can be pushed after a newer release). Ignore the -ec2, -soci, and server-* variants. (scripts/deploy.py does exactly this.) CUDA rule: Blackwell (g7e) needs cu129+ (latest is cu130); Ada (g6/g6e) ok on cu129/cu130; Ampere (g5) needs cu128. Mismatch = container won't start.
Base (same for every model — only the values change):
pythonenv = { "SM_VLLM_MODEL": "/opt/ml/model", "SM_VLLM_TENSOR_PARALLEL_SIZE": str(num_gpu), "SM_VLLM_MAX_NUM_SEQS": "32", "SM_VLLM_MAX_MODEL_LEN": "16384", # cap; a model's huge native context won't fit KV on 1 GPU "SM_VLLM_ENFORCE_EAGER": "true", # faster cold start; drop for max throughput }
Optional, only if a given model needs it:
max_model_len modest (8k–16k) so the KV cache fits the GPU.SM_VLLM_GPU_MEMORY_UTILIZATION (e.g. "0.85").SM_VLLM_TRUST_REMOTE_CODE="" only if the model requires it.reasoning field with content:null.Fine for serving; matters for benchmark validity (see sagemaker-benchmark).
Use the SageMaker default bucket (sagemaker-<region>-<account>) so the execution role already has access. Layout: s3://<bucket>/models/<model>/ (HuggingFace SafeTensor files, uncompressed). Resolve the bucket from the environment — never hardcode an account.
PrimaryContainer.ModelDataSource.S3DataSource (S3Prefix, CompressionType None) + env.InitialInstanceCount=1,download + health-check timeouts ≥ 900s.
describe_endpoint until InService (~4–8 min). OnInsufficientInstanceCapacity, switch to the fallback instance and retry.
ComputeResourceRequirements (MinMemory sized to model,NumberOfAcceleratorDevicesRequired = num_gpu), CopyCount=1. Poll until InService.
invoke_endpoint(..., InferenceComponentName=ic) with an OpenAI-style{"messages":[...]}; confirm a completion (check choices[0].message).
scripts/deploy.py implements this contract exactly (dry-run by default, --deploy to create). Region / account / execution-role / bucket are auto-detected from the environment (scripts/config.py) — the same code runs unchanged in any account. scripts/smoke_test.py covers step 6 on its own.
Pass endpoint_name + ic_name to sagemaker-benchmark. Tear down with scripts/teardown.py (delete IC → endpoint → config → model) when done — endpoints bill while InService.
Other measured skills in the registry, with their headline benchmark lift.