sagemaker.train.rft.headers

sagemaker.train.rft.headers#

Header utilities for inference calls.

Provides functions to create the HTTP headers required by the AgenticRFTRuntimeService for each inference request.

The runtime service expects individual headers:
  • X-Amzn-SageMaker-Job-Arn: job ARN that identifies the training session

  • X-Amzn-SageMaker-Trajectory-Id: unique trajectory identifier

Functions

get_inference_headers()

Get headers from current rollout context.

make_inference_headers(metadata)

Create headers dict for inference calls.

sagemaker.train.rft.headers.get_inference_headers() dict[str, str][source]#

Get headers from current rollout context.

For use with set_rollout_context() when you need to retrieve headers deep in the call stack without passing them explicitly.

Returns:

Headers dict, or empty dict if no context set (with warning).

sagemaker.train.rft.headers.make_inference_headers(metadata: dict[str, Any] | RolloutMetadata) dict[str, str][source]#

Create headers dict for inference calls.

Produces the individual headers required by the RFT Runtime Service:
  • X-Amzn-SageMaker-Job-Arn: job ARN that identifies the training session

  • X-Amzn-SageMaker-Trajectory-Id: unique trajectory identifier

Parameters:

metadata – The metadata from the rollout request (dict or RolloutMetadata).

Returns:

Headers dict to add to inference calls.