sagemaker-python-sdk
AGENTS.md2.3k starsChanged 3 months agoApache-2.0View on GitHub
Guidance for AI coding agents (Cursor, GitHub Copilot, Claude Code, Amazon Q Developer, Kiro, Codex, Gemini CLI, etc.) working in this repository — the source of the Amazon SageMaker Python SDK. Follows the AGENTS.md convention (https://agents.md). This file has two audiences: 1. Contributors' agents editing SDK source, tests, and docs in this repo. 2. Any agent that reads this repo as a reference for how to use the SDK — so the usage guidance (v3 by default) is stated here…
- Installs packages
Trending
Quiet since September.about the whole repository
Who's talking about aws/sagemaker-python-sdk
- numpy/numpy“Ecosystem compatibility with numpy 2.0”GitHub · Apr 1, 2024 · 42 reactions
- aws/sagemaker-training-toolkit“Publish wheels to PyPI”GitHub · Feb 15, 2023 · 7 reactions
- aws/sagemaker-inference-toolkit“JVM detect the CPU count as 1 when more CPUs are available for the container. ”GitHub · Mar 15, 2021 · 6 reactions
- aws/amazon-sagemaker-feedback“Allow singleton interval for integer or continuous range hyperparameter and duplicate values for …”GitHub · Jul 17, 2025 · 5 reactions
- aws/amazon-sagemaker-feedback“State of amazon-sagemaker-feedback Repository”GitHub · Oct 14, 2025 · 2 reactions
The biggest 5 of 21 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 21
Talked about on GitHub (21 times).
On GitHub · 21
- Apr 1, 2024Ecosystem compatibility with numpy 2.0 — numpy/numpy42 reactions · 167 comments
- Feb 15, 2023Publish wheels to PyPI — aws/sagemaker-training-toolkit7 reactions
- Mar 15, 2021JVM detect the CPU count as 1 when more CPUs are available for the container. — aws/sagemaker-inference-toolkit6 reactions · 2 comments
- Jul 17, 2025Allow singleton interval for integer or continuous range hyperparameter and duplicate values for categorical range parameter of tuning job. — aws/amazon-sagemaker-feedback5 reactions · 3 comments
- Oct 14, 2025State of amazon-sagemaker-feedback Repository — aws/amazon-sagemaker-feedback2 reactions · 4 comments
16 more on GitHub
- Mar 19, 2024feature: add python module entrypoint type, add python module support… — aws/sagemaker-training-toolkit2 reactions · 1 comment
- Jul 21, 2020Support ModelPackage in the ModelStep — aws/aws-step-functions-data-science-sdk-python2 reactions
- Apr 30, 2019add support for recordio and sparse matrices — aws/sagemaker-scikit-learn-container2 reactions · 3 comments
- May 21, 2026chore(deps): bump sagemaker from 2.243.2 to 3.8.0 in /models/sagemaker — langgenius/dify-official-plugins1 reaction · 1 comment
- Aug 20, 2022Support for features / optional dependencies — repo-helper/hatch-requirements-txt1 reaction · 3 comments
- Jan 26, 2022[Bug Report] with Instance_type = "local_gpu", SageMaker unable to find PyTorch inference container image. — aws/amazon-sagemaker-examples1 reaction
- Jul 28, 2021`environment` argument to sklearn estimator does not pass environment variables into training job — aws/sagemaker-scikit-learn-container1 reaction · 3 comments
- Jun 22, 2021Custom `model_fn` function not found when extending the PyTorch inference container — aws/sagemaker-inference-toolkit1 reaction
- Jul 24, 2020Feature request: support SageMaker SDK 2.0 — aws/aws-step-functions-data-science-sdk-python1 reaction · 6 comments
- Jun 28, 2018Add Stale config — aws/sagemaker-pytorch-training-toolkit1 reaction
- Dec 22, 2017ResNet CIFAR 10 generates scalar data faster — aws/amazon-sagemaker-examples1 reaction
- Sep 28, 2026Update sagemaker requirement from <3,>=2 to >=3.23.0,<4 — gradientsky/deep-learning-containers0 reactions
- Sep 28, 2026Update sagemaker requirement from <3,>=2 to >=3.23.0,<4 — nikhil-sk/deep-learning-containers0 reactions
- Sep 28, 2026Update sagemaker requirement from <3,>=2 to >=3.23.0,<4 — shantanutrip/deep-learning-containers0 reactions
- Sep 28, 2026Update sagemaker requirement from <3,>=2 to >=3.23.0,<4 — Arrmlet/deep-learning-aws-containers0 reactions
- Sep 15, 2026Bump sagemaker from 2.225.0 to 3.8.0 in / inference/sm-app_autoscaling_realtime_endpoints_inference_components — CATHLEEN-ANN-TICO/amazon-sagemaker-examples0 reactions
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
When generating or editing example code, docstrings, tests, or documentation, use v3 patterns by default.
- Distinctive: line 35
When writing usage examples, docstrings, or answering "how do I ..." for a SageMaker task,
- Distinctive: line 53
Only step outside the SDK when it genuinely does not cover the task, and say so when you do.
- Very specific: line 57
Do not introduce the left column into new code, docstrings, or examples unless v2 is explicitly in scope.
- Very specific: line 75
Setup: create a virtualenv, then install the package with test extras (see CONTRIBUTING.md and setup.py/pyproject.toml for the …
- Very specific: line 78
Format & lint: run the repo's configured tools (e.g.
- Very specific: line 81
Tests: add or update unit tests under tests/unit/ for any code change.
- Very specific: line 84
Public API changes: update migration.md and any affected docstrings/examples so v3 guidance stays consistent across the repo.
- Very specific: line 86
PRs: keep them focused; follow CONTRIBUTING.md and the PR template.
- Distinctive: line 90
Write the code using v3 patterns from the table above.
- Distinctive: line 93
If a v2 pattern is found, fix it to v3 and re-check until clean.
- Distinctive: line 94
Only then present the code.
- Very specific: line 98
No hardcoded account IDs, role ARNs, regions, subnets, or bucket names.
- Distinctive: line 100
Prefer minimal, runnable snippets that show the v3 flow end to end.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — Amazon SageMaker Python SDK
Guidance for AI coding agents (Cursor, GitHub Copilot, Claude Code, Amazon Q Developer, Kiro, Codex, Gemini CLI, etc.) working in this repository — the source of the Amazon SageMaker Python SDK. Follows the AGENTS.md convention (https://agents.md).
This file has two audiences:
- Contributors' agents editing SDK source, tests, and docs in this repo.
- Any agent that reads this repo as a reference for how to use the SDK — so the usage guidance (v3 by default) is stated here too.
Project context
This repository is the Amazon SageMaker Python SDK. The current major version is v3;
pip install sagemaker installs v3. SDK v3 is a modular redesign and is not backward
compatible with v2. Packages:
sagemaker-core— foundation primitives and the low-level, resource-oriented APIsagemaker-train— training (ModelTrainer)sagemaker-serve— model building & deployment (ModelBuilder)sagemaker-mlops— pipelines and workflow orchestration
master is the v3 development branch. v2 is maintained on its maintenance branch and receives
security/bug fixes only (no new features) per the version-support policy.
Golden rule: v3 by default
When generating or editing example code, docstrings, tests, or documentation, use v3
patterns by default. Produce v2 code only when the task is explicitly about v2 (e.g., a v2
maintenance fix on the v2 branch, or the user asks for "the v2 version"). When you do, label it
deprecated and note pip install 'sagemaker<3.0'.
SDK-first: use the SageMaker Python SDK for SageMaker tasks
When writing usage examples, docstrings, or answering "how do I ..." for a SageMaker task,
default to the SageMaker Python SDK v3 as the primary interface. Do not drop to raw
boto3 (client("sagemaker").create_training_job(...)), the AWS CLI, or hand-rolled
framework scripts unless the user explicitly asks — the SDK handles image resolution,
packaging, and job wiring that raw clients leave to the caller. Map intent to interface:
| User intent (natural language) | Use this v3 interface |
| "train a model", "training job", "serverless / managed training", "fine-tune" | sagemaker.train.ModelTrainer → .train(...) |
| "distributed training", "multi-GPU / multi-node" | ModelTrainer with Compute(instance_count=N, ...) |
| "hyperparameter tuning", "HPO", "sweep" | sagemaker.train tuner APIs on top of ModelTrainer |
| "deploy a model", "real-time / serverless / async endpoint", "host / serve" | sagemaker.serve.ModelBuilder → .deploy(...) |
| "batch inference", "batch transform", "offline scoring" | sagemaker.core.resources transform APIs |
| "process data", "feature engineering", "preprocess" | sagemaker.core.resources.ProcessingJob |
| "build an ML pipeline", "orchestrate a workflow", "MLOps" | sagemaker.mlops.pipeline.Pipeline, sagemaker.mlops.steps |
| "register a model", "model registry" | sagemaker.mlops model-registry APIs |
| "get / retrieve a container image URI" | sagemaker.core.image_uris.retrieve(...) |
Only step outside the SDK when it genuinely does not cover the task, and say so when you do.
Banned v2 patterns → required v3 replacements
Do not introduce the left column into new code, docstrings, or examples unless v2 is explicitly
in scope. Mappings follow migration.md.
| v2 (do NOT use) | v3 (use instead) |
from sagemaker.estimator import Estimator | from sagemaker.train import ModelTrainer |
framework estimator classes — from sagemaker.pytorch import PyTorch (also TensorFlow, SKLearn, XGBoost, HuggingFace) | ModelTrainer + from sagemaker.core import image_uris → image_uris.retrieve(...) |
estimator.fit(...) | model_trainer.train(...) |
from sagemaker.model import Model / model.deploy(...) | from sagemaker.serve import ModelBuilder; ModelBuilder(...).deploy(...) |
from sagemaker.predictor import Predictor / predictor.predict(...) | Predictor is replaced by Endpoint (sagemaker-core); use the predictor returned by ModelBuilder.deploy(...) |
from sagemaker.processing import Processor / ScriptProcessor / SKLearnProcessor | sagemaker.core.resources.ProcessingJob |
from sagemaker.workflow... (old paths) | from sagemaker.mlops... (sagemaker.mlops.pipeline.Pipeline, sagemaker.mlops.steps) |
Removed in v3 with no direct replacement (do not invent shims): MXNet, Chainer, RLEstimator, Training Compiler.
Contributing workflow
- Setup: create a virtualenv, then install the package with test extras (see
CONTRIBUTING.mdandsetup.py/pyproject.tomlfor the authoritative extras). - Format & lint: run the repo's configured tools (e.g.
black,flake8,pylint) before committing. Match existing style; do not reformat unrelated files. - Docs: build docs under
doc/with Sphinx if you change public APIs or docstrings. - Tests: add or update unit tests under
tests/unit/for any code change; run the relevant subset locally (pytest tests/unit/<area>). Integration tests undertests/integ/hit AWS and are generally run in CI — do not require them to pass locally. - Public API changes: update
migration.mdand any affected docstrings/examples so v3 guidance stays consistent across the repo. - PRs: keep them focused; follow
CONTRIBUTING.mdand the PR template.
Required workflow when writing SageMaker usage code
- Write the code using v3 patterns from the table above.
- Self-check the output for any banned v2 pattern (if a migration MCP tool such as
sagemaker-sdk-helperis available, call its validate/transform tools). - If a v2 pattern is found, fix it to v3 and re-check until clean.
- Only then present the code.
Code conventions (examples & docstrings)
- No hardcoded account IDs, role ARNs, regions, subnets, or bucket names. Use
get_execution_role()andSession().default_bucket(). - Prefer minimal, runnable snippets that show the v3 flow end to end.
- Target the latest v3; do not pin
sagemaker<3.0in new examples without an explicit exception.
Canonical v3 example (train + deploy)
Grounded in migration.md; verify exact signatures against the installed SDK.
from sagemaker.core import image_uris
from sagemaker.train import ModelTrainer
from sagemaker.train.configs import SourceCode, Compute, InputData
from sagemaker.serve import ModelBuilder
from sagemaker.serve.configs import InferenceSpec
# Training
training_image = image_uris.retrieve(
framework="pytorch", region="us-west-2", version="2.0.0",
py_version="py310", instance_type="ml.p3.2xlarge", image_scope="training",
)
model_trainer = ModelTrainer(
training_image=training_image,
role=role,
source_code=SourceCode(source_dir="./src", entry_script="train.py"),
compute=Compute(instance_type="ml.p3.2xlarge", instance_count=1),
)
model_trainer.train(input_data_config=[InputData(channel_name="train", data_source="s3://<bucket>/train")])
# Inference
model_builder = ModelBuilder(
inference_spec=InferenceSpec(
image_uri="<inference-image-uri>",
model_data_url="s3://<bucket>/model.tar.gz",
),
role=role,
)
predictor = model_builder.deploy(instance_type="ml.m5.large", initial_instance_count=1)References
- V2 → V3 migration guide: ./migration.md
- Contributing guide: ./CONTRIBUTING.md
- SageMaker Python SDK docs: https://sagemaker.readthedocs.io/
- Example notebooks: https://github.com/aws/amazon-sagemaker-examples
- Curated index for agents: ./llms.txt
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

