Amazon SageMaker AI の非同期推論にリクエストペイロードの直接送信がサポートされるように
Amazon SageMaker AI は非同期推論におけるインラインペイロードサポートを追加し、小規模データ処理時の S3 依存を解消してアーキテクチャを簡素化しました。
キーポイント
S3 依存の排除とワークフロー簡素化
新しい `Body` パラメータにより、推論リクエスト本体に直接ペイロードを含められるようになり、事前の S3 アップロードが不要になりました。
小規模データ処理への最適化
128,000 バイトまでの小規模入力(KB 単位)において、ネットワーク往復を削減し、クライアント側のコード複雑さを大幅に低減します。
パラメータの排他仕様
`Body` パラメータと従来の `InputLocation` は互いに排他的であり、両方を同時に指定するリクエストは API によって拒否されます。
インラインペイロードによる簡素化
新しい機能により、S3へのアップロードやバケット管理が不要になり、1 つの呼び出しで非同期エンドポイントを直接実行できるようになりました。
運用コストと複雑性の削減
S3 クライアントの用意、IAM 権限の付与、キー衝突回避のための命名規則、および不要なオブジェクトのクリーンアップ戦略が不要になります。
インラインペイロードの主な利点
S3 へのアップロードや追加の IAM 権限が不要となり、レイテンシの削減、アーキテクチャの単純化、コスト低減が可能になります。
使用场景の推奨基準
128,000 バイト以下のペイロードには `Body` パラメータを使用したインライン方式を、それ以上や監査目的の場合は S3 の `InputLocation` 方式を使用します。
影響分析・編集コメントを表示
影響分析
この機能追加により、特に小規模な入力データを扱うバッチ処理やバースト型ワークロードにおいて、開発者のコード実装が大幅に簡素化されます。S3 という外部ストレージへの依存を減らすことで、データ転送の遅延が解消され、システム全体のレスポンス性と運用コストの最適化が期待できます。
編集コメント
S3 を介さない直接送信が可能になることで、開発フローが劇的にシンプルになります。特に小規模データの非同期処理において、アーキテクチャの複雑さを下げる重要なアップデートです。
本日、Amazon SageMaker AI の非同期推論(Async Inference)において、リクエストペイロードをインラインで送信するサポートを開始したことをお知らせします。これにより、顧客は InvokeEndpointAsync API のリクエスト本体に直接推論ペイロードを送信できるようになり、各呼び出し前に Amazon Simple Storage Service (Amazon S3) に入力データをアップロードする必要がなくなりました。
128,000 バイトまでのペイロードの場合、この機能によりネットワークの往復ラウンドトリップが不要となり、クライアント側のコードが簡素化され、非同期推論ワークロードの運用上のリスク領域が縮小されます。
本稿では、この機能の背景にある動機を説明し、導入前後の顧客体験を追跡し、今日からインラインペイロードを使用する方法をご紹介します。
背景:従来の非同期推論の仕組み
Amazon SageMaker AI の非同期推論 を使用することで、推論リクエストをキューに格納し、非同期で処理することができます。これは、大規模なペイロードや変動するトラフィック、数秒から数分のレイテンシ許容度を持つワークロードに適しています。ゼロへの自動スケーリングをサポートしており、バースト型またはバッチスタイルのワークロードにおいてコスト効率に優れています。
これまで、各呼び出しには以下の 2 つの手順が必要でした:
- Amazon S3 バケットに入力ペイロードをアップロードします。
- エンドポイントを呼び出し、S3 オブジェクト URI を InputLocation として渡します。
エンドポイントはリクエストを非同期で処理し、出力を設定された S3 出力場所(Output Location)に書き込みます。クライアントはポーリングを行うか、Amazon Simple Notification Service (Amazon SNS) の通知を受け取ることで結果を取得します。
この 2 ステップのパターンは、大規模なペイロード(画像、音声、数 MB のドキュメントなど)にはよく機能します。しかし、入力ペイロードが小さく(KB 単位)、リアルタイム推論では許容できないほど長い処理時間を必要とする顧客にとっては、必須の S3 依存関係が不要な複雑さを追加してしまいました。
新しい機能:Body パラメータによるインラインペイロード
今回のリリースにより、InvokeEndpointAsync に新しい Body パラメータが追加されました。このパラメータが存在する場合、ペイロードは API リクエスト自体にインラインで送信され、S3 へのアップロードは不要になります。
主な詳細:
| アスペクト | 詳細 |
|---|---|
| 新パラメータ | Body(生バイト)、最大 128,000 バイトに制限。 |
| インライン最大サイズ | 128,000 バイト(生ペイロード)。 |
| 排他性 | Body と InputLocation は排他的です。両方を設定するリクエストは API で拒否されます。 |
| 出力動作 | 変更なし。出力は S3 Output Location に書き込まれます。 |
| エンドポイント互換性 | 既存の非同期エンドポイントで動作するように設計されており、モデルやコンテナの変更は不要です。
エラーハンドリング
サイズ違反および排他性違反は、同期の ValidationError 応答を返します。
可用性
31 の商用 AWS リージョンで利用可能です *(BOM, PDX, YUL, IAD, CMH, SFO, LHR, ICN, SYD, HKG, YYC, GRU, QRO, DUB, CDG, FRA, ZRH, ARN, ZAZ, NRT, KIX, SIN, CGK, MEL, KUL, BKK, HYD, TPE, CPT, MXP, TLV)*。
変更前後:顧客体験
この変化はコードにおいて最も明確に現れます。以下に示す 2 つの例は、同じエンドポイントに対して非同期呼び出しを実行するものであり、最初の例ではこれまで必要だった S3 アップロードステップを使用し、2 つ目の例ではそれを置き換えるインライン Body パラメータを使用します。
変更前:まず S3 にアップロードしてから呼び出す
import boto3, json, uuid
s3 = boto3.client("s3")
sagemaker_runtime = boto3.client("sagemaker-runtime")
payload = json.dumps({"inputs": "your prompt here"}).encode("utf-8")
# 1. リクエストペイロードを S3 にアップロード(追加のレイテンシとコストが発生)
input_key = f"async-input/{uuid.uuid4()}.json"
s3.put_object(Bucket="my-async-bucket", Key=input_key, Body=payload)
input_location = f"s3://my-async-bucket/{input_key}"
# 2. エンドポイントを呼び出す
response = sagemaker_runtime.invoke_endpoint_async(
EndpointName="my-async-endpoint",
InputLocation=input_location,
ContentType="application/json",
)
print(response["OutputLocation"])このアプローチには以下の要件があります:
- S3 クライアントと入力用バケットの用意。
- 呼び出し元に対する AWS Identity and Access Management (IAM) の s3:PutObject 権限。
- キー衝突を避けるための命名スキーム(UUID または同等のもの)。
- 古くなった入力オブジェクトのクリーンアップ戦略。
After: Send the payload inline
import boto3, json
sagemaker_runtime = boto3.client("sagemaker-runtime")
payload = json.dumps({"inputs": "your prompt here"}).encode("utf-8")
One call, no S3 upload, no input bucket needed
response = sagemaker_runtime.invoke_endpoint_async(
EndpointName="my-async-endpoint",
Body=payload,
ContentType="application/json",
)
print(response["OutputLocation"])
S3 クライアント不要、UUID 不要、入力バケット不要、入力パスへの IAM 権限不要、古くなったオブジェクトのクリーンアップ不要。
Customer benefits
ペイロードをインラインで送信することで、各リクエストにおけるネットワークホップと依存関係が1つ削減されます。これにより、5 つの具体的なメリットが得られます:
- レイテンシの削減。1 つのリクエストあたり、ネットワーク往復と S3 PUT が 1 つずつ不要になるためです。ファンアウトワークロードでは、このレイテンシ削減効果が累積して大きな意味を持ちます。
- アーキテクチャの単純化。入力バケットのプロビジョニング、ライフサイクルポリシー、アカウント間アクセスパターン、および呼び出し元が入力パスに対して持つ IAM の s3:PutObject 権限を回避できます。
- エラー経路の削減。リクエストは単一の API コールです。キューに追加されるか、そうでないかのどちらかです。
- コストの低下。各インライン呼び出しにおける入力アップロードに対する S3 PUT 課金が不要になります。
- 即時の検証フィードバック。サイズエラーや排他性エラーは同期して返されます。
各アプローチの使用タイミング
インラインペイロードは、小規模なペイロードの場合に通常はよりシンプルな選択肢ですが、InputLocation(入力場所)にもその役割があります。以下の表を使用して、特定のワークロードに適したパスを決定してください:
| シナリオ | 推奨されるアプローチ |
|---|---|
| ペイロード | インラインボディ。シンプル。ネットワーク往復と S3 PUT 課金を 1 つずつ回避できます。 |
| ペイロード > 128,000 バイト(画像、音声、大規模ドキュメント) | InputLocation。まず S3 にアップロードしてください。 |
| 可変サイズのペイロードを伴う混合ワークロード | サイズに基づいて分岐。小規模には Body を、大規模には InputLocation を使用します。 |
|監査や再生のために S3 に入力データを保持する必要がある場合 | InputLocation。入力データをバケット内に保持します。
はじめに
完全な手順については、例のコードノートブック をご覧ください。
開始する前に、以下の準備が整っていることを確認してください:
- 既存の Amazon SageMaker AI 非同期推論エンドポイント(
aws sagemaker describe-endpoint --endpoint-name my-async-endpointコマンドで確認)。
- 最新の AWS SDK for Python (Boto3) がインストールされ、認証情報で設定されていること。
sagemaker:InvokeEndpointAsync権限を持つ IAM ポリシーが割り当てられていること。
- 非同期エンドポイント用の S3 出力バケットが構成されていること(例:my-output-bucket)。
注意: このガイドに従うと、課金対象となる AWS リソースを使用することになります。SageMaker AI 非同期推論エンドポイントはインスタンス使用時間に対して課金され、S3 バケットはストレージおよびリクエスト数に対して課金されます。継続的な課金を避けるために、チュートリアル完了後にクリーンアップ手順を実行してください。
手順
インラインペイロードのサポートは本日利用可能です。これを使用するには:
- AWS SDK を更新してください。Boto3 を最新バージョンにインストールまたはアップグレードします:pip install --upgrade boto3。
- インストールを確認します:pip show boto3。
- 呼び出しコードを置き換えてください。アプリケーション内では、S3 アップロード + InputLocation パターンを、直前のコード例に示されているように直接の Body パラメータに置換してください。
- Body パラメータを指定して InvokeEndpointAsync API を呼び出すことで、呼び出しをテストしてください。
- 応答に OutputLocation フィールドが含まれていることを確認してください。
- S3 の OutputLocation をポーリングまたは監視し、推論結果が正常に書き込まれたことを確認してください。
エンドポイント設定、モデルコンテナ、出力用 S3 セットアップに変更は不要です。
クリーンアップ
継続的な課金を避けるために、このウォークスルーで使用したリソースを削除してください:
- テスト用に作成された SageMaker AI エンドポイントを削除します:
aws sagemaker delete-endpoint --endpoint-name my-async-endpoint
- 出力用 S3 バケットを削除します(不要になった場合)。警告:S3 バケットを削除すると、その中のオブジェクトは永久的に消去されます。保持が必要な推論結果のバックアップがあるか確認してください。
aws s3 rb s3://my-output-bucket --force
- このチュートリアル用に作成された IAM ポリシーをすべて削除してください。
結論
SageMaker AI の非同期推論におけるインラインペイロードサポートは、非同期推論ワークフローにおける一般的な摩擦要因である「すべてのリクエストに対する必須の S3 アップロード」を解消します。128,000 バイト以内の大部分の推論ペイロードについては、単一の API 呼び出しを実行するだけでよく、残りの処理は SageMaker AI が担当してくれます。
この機能は後方互換性を維持するように設計されています。既存の InputLocation ワークフローは変更されません。リクエストが受け付けられた後は、インライン入力と S3 入力の両方が同一に処理され、モデルは入力ソースに関わらず同一のリクエストを受け取ります。
AWS SDK を更新し、SageMaker AI InvokeEndpointAsync API の Body パラメータを使用することで、今日から利用を開始できます。非同期推論の詳細については、Amazon SageMaker AI 非同期推論ドキュメントをご覧ください。
著者について

Dan Ferguson
Dan は、米国ニューヨークを拠点とする AWS のソリューションアーキテクトです。機械学習サービスの専門家として、顧客が ML ワークフローを効率的かつ効果的、そして持続可能に統合するための旅をサポートしています。

Bruce Wang
Bruce は AWS の SageMaker AI Inference DataPlane チームに所属するソフトウェア開発エンジニアです。SageMaker AI の顧客向けに、リアルタイム推論と非同期推論を支えるインフラストラクチャの構築を行っています。
原文を表示
Today, we’re announcing inline payload support for Amazon SageMaker AI Async Inference. Customers can now send inference payloads directly in the request body of the InvokeEndpointAsync API, removing the need to upload input data to Amazon Simple Storage Service (Amazon S3) before each invocation.
For payloads up to 128,000 bytes, this removes an entire network round-trip, simplifies client-side code, and reduces the operational surface area of asynchronous inference workloads.
In this post, we explain the motivation behind this feature, walk through the customer experience before and after, and show you how to start using inline payloads today.
Background: How async inference worked before
You can use Amazon SageMaker AI Async Inference to queue inference requests and process them asynchronously. It’s a good fit for workloads with large payloads, variable traffic, or tolerance for seconds-to-minutes latency. It supports automatic scaling to zero, making it cost-efficient for bursty or batch-style workloads.
Until now, the workflow required two steps on every invocation:
- Upload the input payload to an Amazon S3 bucket.
- Invoke the endpoint, passing the S3 object URI as InputLocation.
The endpoint processes the request asynchronously and writes the output to a configured S3 output location, which the client polls or receives via Amazon Simple Notification Service (Amazon SNS) notification.
This two-step pattern works well for large payloads (images, audio, multi-MB documents). But for customers with small input payloads (in KB) who need longer processing times than real-time inference allows, the mandatory S3 dependency added unnecessary complexity.
What’s new: Inline payload via the Body parameter
With today’s launch, InvokeEndpointAsync accepts a new Body parameter. When present, the payload is sent inline in the API request itself, with no S3 upload required.
Key details:
Aspect
Details
New parameter
Body, raw bytes, capped at 128,000 bytes.
Max inline size
128,000 bytes (raw payload).
Mutual exclusivity
Body and InputLocation are mutually exclusive. The API rejects requests that set both.
Output behavior
Unchanged. Output is written to the S3 OutputLocation.
Endpoint compatibility
Designed to work with existing async endpoints; no model or container changes expected.
Error handling
Size and mutual-exclusivity violations return synchronous ValidationError responses.
Availability
Available in 31 commercial AWS Regions *(BOM, PDX, YUL, IAD, CMH, SFO, LHR, ICN, SYD, HKG, YYC, GRU, QRO, DUB, CDG, FRA, ZRH, ARN, ZAZ, NRT, KIX, SIN, CGK, MEL, KUL, BKK, HYD, TPE, CPT, MXP, TLV)*.
Before and after: The customer experience
The change is clearest in code. The two examples that follow perform the same async invocation against the same endpoint. The first uses the S3 upload step that was required until now, and the second uses the inline Body parameter that replaces it.
Before: Upload to S3 first, then invoke
import boto3, json, uuid
s3 = boto3.client("s3")
sagemaker_runtime = boto3.client("sagemaker-runtime")
payload = json.dumps({"inputs": "your prompt here"}).encode("utf-8")
# 1. Upload the request payload to S3 (extra latency + cost)
input_key = f"async-input/{uuid.uuid4()}.json"
s3.put_object(Bucket="my-async-bucket", Key=input_key, Body=payload)
input_location = f"s3://my-async-bucket/{input_key}"
# 2. Invoke the endpoint
response = sagemaker_runtime.invoke_endpoint_async(
EndpointName="my-async-endpoint",
InputLocation=input_location,
ContentType="application/json",
)
print(response["OutputLocation"])This approach requires:
- An S3 client and input bucket provisioned.
- AWS Identity and Access Management (IAM) s3:PutObject permission on the caller.
- A naming scheme (UUID or similar) to avoid key collisions.
- A cleanup strategy for stale input objects.
After: Send the payload inline
import boto3, json
sagemaker_runtime = boto3.client("sagemaker-runtime")
payload = json.dumps({"inputs": "your prompt here"}).encode("utf-8")
# One call, no S3 upload, no input bucket needed
response = sagemaker_runtime.invoke_endpoint_async(
EndpointName="my-async-endpoint",
Body=payload,
ContentType="application/json",
)
print(response["OutputLocation"])No S3 client, no uuid, no input bucket, no IAM grants on the input path, no stale-object cleanup.
Customer benefits
Sending the payload inline removes a network hop and a dependency from each request. That translates into five concrete benefits:
- Reduced latency. One network round-trip and one S3 PUT removed per request. For fan-out workloads, this latency savings compounds meaningfully.
- Simpler architecture. Avoids the input bucket provisioning, lifecycle policies, cross-account access patterns, and the caller’s IAM s3:PutObject permission on the input path.
- Fewer error paths. The request is a single API call. It either enqueues or it doesn’t.
- Lower cost. Removes the S3 PUT charge for the input upload on every inline invocation.
- Immediate validation feedback. Size and mutual-exclusivity errors are returned synchronously.
When to use each approach
Inline payloads are typically the simpler choice for small payloads, but InputLocation still has its place. Use the following table to decide which path fits a given workload:
Scenario
Recommended approach
Payload
Inline Body. Simpler. Avoids one network round-trip and S3 PUT charges.
Payload > 128,000 bytes (images, audio, large documents)
InputLocation. Upload to S3 first.
Mixed workload with variable payload sizes
Branch on size. Use Body for small, InputLocation for large.
Need to retain input data in S3 for audit or replay
InputLocation. Keeps inputs in your bucket.
Getting started
See the example code notebook for a full walkthrough.
Before you begin, make sure you have:
- An existing Amazon SageMaker AI Async Inference endpoint (verify with aws sagemaker describe-endpoint --endpoint-name my-async-endpoint).
- The latest AWS SDK for Python (Boto3) installed and configured with credentials.
- IAM permissions for sagemaker:InvokeEndpointAsync.
- An S3 output bucket configured for your async endpoint (for example, my-output-bucket).
Note: Following this guide uses billable AWS resources. SageMaker AI async inference endpoints incur charges for instance hours, and S3 buckets incur charges for storage and requests. Follow the cleanup steps after completing the tutorial to avoid ongoing charges.
Steps
Inline payload support is available today. To use it:
- Update your AWS SDK. Install or upgrade Boto3 to the latest version: pip install --upgrade boto3.
- Verify the installation: pip show boto3.
- Replace your invocation code. In your application, substitute the S3 upload + InputLocation pattern with a direct Body parameter, as shown in the preceding code example.
- Test your invocation by calling the InvokeEndpointAsync API with the Body parameter.
- Verify the response contains an OutputLocation field.
- Poll or monitor the S3 OutputLocation to confirm your inference result was written successfully.
No changes are needed to your endpoint configuration, model container, or output S3 setup.
Clean up
To avoid ongoing charges, delete the resources used in this walkthrough:
- Delete the SageMaker AI endpoint if it was created for testing:
aws sagemaker delete-endpoint --endpoint-name my-async-endpoint- Delete the output S3 bucket (if no longer needed). Warning: Deleting an S3 bucket permanently removes the objects within it. Verify you have backed up any inference results you need to retain.
aws s3 rb s3://my-output-bucket --force- Remove any IAM policies created specifically for this tutorial.
Conclusion
Inline payload support for SageMaker AI Async Inference removes a common friction point in asynchronous inference workflows: the mandatory S3 upload for every request. For the majority of inference payloads that fit within 128,000 bytes, you can now make a single API call and let SageMaker AI handle the rest.
The feature is designed to be backward-compatible. Existing InputLocation workflows continue unchanged. Both inline and S3 inputs are processed identically once the request is accepted, and models receive identical requests regardless of input source.
Get started today by updating your AWS SDK and using the Body parameter on the SageMaker AI InvokeEndpointAsync API. To learn more about asynchronous inference, see the Amazon SageMaker AI Async Inference documentation.
About the authors

Dan Ferguson
Dan is a Solutions Architect at AWS, based in New York, USA. As a machine learning services expert, Dan works to support customers on their journey to integrating ML workflows efficiently, effectively, and sustainably.

Bruce Wang
Bruce is a Software Development Engineer on the SageMaker AI Inference DataPlane team at AWS. He builds the infrastructure that powers real-time and asynchronous inference for SageMaker AI customers.
関連記事
Amazon SageMaker Feature Store の新機能で ML 特徴パイプラインを加速
AWS は、機械学習モデルの特徴値を保存・共有・管理する完全マネージドリポジトリ「Amazon SageMaker Feature Store」に、Apache Iceberg テーブル形式のサポートを追加し、開発速度の向上を図りました。
AI エージェント向けの生産環境インフラストラクチャ(19 分読)
TLDR AI が、AI エージェントを実際の運用環境で安定稼働させるための基盤整備や設計手法について解説している。
2026 年に LLM エンジニアになるためのロードマップ
KDnuggets が、2026 年までに大規模言語モデルエンジニアとして活躍するための学習経路と必要なスキルを提示した。
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み