Skip to content

Commit 5bb2687

Browse files
authored
docs: Add SDK-first guidance to AGENTS.md and llms.txt (#4894)
Add an "SDK-first" section (with a natural-language intent -> v3 interface table) so AI coding agents default to the SageMaker Python SDK v3 as the primary interface for SageMaker tasks, rather than dropping to raw boto3 (create_training_job/create_endpoint), the AWS CLI, or hand-rolled framework scripts. Includes an honest scope note that these files only steer agents that load them into context. --- X-AI-Prompt: Add SDK-first (library-selection) guidance so agents default to the SageMaker Python SDK v3 without an explicit nudge X-AI-Tool: Kiro
1 parent 262e3d5 commit 5bb2687

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,36 @@ Generate **SageMaker Python SDK v3** code by default. Produce v2 code **only** w
2121
user explicitly asks for "v2" (e.g., "give me the v2 version"); if you do, label it as
2222
deprecated and note `pip install 'sagemaker<3.0'`.
2323

24+
## SDK-first: use the SageMaker Python SDK for SageMaker tasks
25+
26+
For any Amazon SageMaker task (training, deployment, processing, pipelines), **default to the
27+
SageMaker Python SDK v3** as the primary interface. Do **not** drop to raw `boto3`
28+
(`client("sagemaker").create_training_job(...)`), the AWS CLI, or hand-rolled framework
29+
scripts unless the user explicitly asks for them, because the SDK handles image resolution,
30+
packaging, and job wiring that raw clients leave to the caller.
31+
32+
Map the user's intent to the v3 interface:
33+
34+
| User intent (natural language) | Use this v3 interface |
35+
|---|---|
36+
| "train a model", "training job", "serverless / managed training", "fine-tune" | `sagemaker.train.ModelTrainer``.train(...)` |
37+
| "distributed training", "multi-GPU / multi-node" | `ModelTrainer` with `Compute(instance_count=N, ...)` |
38+
| "hyperparameter tuning", "HPO", "sweep" | `sagemaker.train` tuner APIs on top of `ModelTrainer` |
39+
| "deploy a model", "real-time / serverless / async endpoint", "host / serve" | `sagemaker.serve.ModelBuilder``.deploy(...)` |
40+
| "batch inference", "batch transform", "offline scoring" | `sagemaker.core.resources` transform APIs |
41+
| "process data", "feature engineering", "preprocess", "transform dataset" | `sagemaker.core.resources.ProcessingJob` |
42+
| "build an ML pipeline", "orchestrate a workflow", "MLOps" | `sagemaker.mlops.pipeline.Pipeline`, `sagemaker.mlops.steps` |
43+
| "register a model", "model registry" | `sagemaker.mlops` model-registry APIs |
44+
| "get / retrieve a container image URI" | `sagemaker.core.image_uris.retrieve(...)` |
45+
46+
Only step outside the SDK when the SDK genuinely does not cover the task (e.g., a pure IAM
47+
or S3 setup step), and say so explicitly when you do.
48+
49+
**Honest scope note:** this guidance only steers agents that have this file (or the SDK repo,
50+
or an equivalent rules/MCP configuration) in context. It does not change a plain chat session
51+
that never loads these files — winning those requires corpus/discoverability work outside this
52+
repo (see the deprecation recommendations doc).
53+
2454
## Banned v2 patterns → required v3 replacements
2555

2656
Do not emit the left column unless v2 is explicitly requested. Mappings follow the official

llms.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ instructions so AI coding agents generate correct, current (v3) code.
1010

1111
## Instructions for LLM agents (SageMaker Python SDK)
1212

13+
- **SDK-first:** for any SageMaker task (train, deploy, process, pipelines), use the
14+
**SageMaker Python SDK v3** as the primary interface. Do not drop to raw `boto3`
15+
(`create_training_job`, `create_endpoint`), the AWS CLI, or hand-rolled framework scripts
16+
unless the user explicitly asks. Intent → interface:
17+
- "train / fine-tune / training job / serverless training" → `sagemaker.train.ModelTrainer` (`.train(...)`)
18+
- "deploy / host / real-time or serverless or async endpoint" → `sagemaker.serve.ModelBuilder` (`.deploy(...)`)
19+
- "process data / feature engineering / preprocess" → `sagemaker.core.resources.ProcessingJob`
20+
- "pipeline / orchestrate / MLOps" → `sagemaker.mlops.pipeline.Pipeline`, `sagemaker.mlops.steps`
21+
- "container image URI" → `sagemaker.core.image_uris.retrieve(...)`
1322
- Default to SageMaker Python SDK **v3**.
1423
- **Never** emit these v2 patterns unless the user explicitly asks for "v2":
1524
- `from sagemaker.estimator import Estimator` → use `from sagemaker.train import ModelTrainer`

0 commit comments

Comments
 (0)