Sagemaker Job Runtime Service

2026/06/02 - Sagemaker Job Runtime Service - 4 new api methods

Changes  Amazon SageMaker Job Runtime is a new service for managing trajectory data during multi-turn customization jobs. It provides APIs to send inference requests to models during job execution, mark rollouts as complete, and submit reward values for training trajectories.

UpdateReward (new) Link ¶

Updates the reward values for a trajectory and transitions it to reward-received status, signaling that it is eligible for processing. Call this operation after CompleteRollout to provide the computed reward scores.

See also: AWS API Documentation

Request Syntax

client.update_reward(
    JobArn='string',
    TrajectoryId='string',
    Rewards=[
        123.0,
    ],
    ClientToken='string'
)
type JobArn:

string

param JobArn:

[REQUIRED]

The job ARN.

type TrajectoryId:

string

param TrajectoryId:

[REQUIRED]

The trajectory ID to update with reward values.

type Rewards:

list

param Rewards:

[REQUIRED]

The list of reward values to assign to this trajectory. Provide one reward value per turn in the trajectory.

  • (float) --

type ClientToken:

string

param ClientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

CompleteRollout (new) Link ¶

Marks a rollout as complete, indicating that no further turns will be appended to the trajectory. After calling this operation, the trajectory is sealed and eligible for reward submission via the UpdateReward operation.

See also: AWS API Documentation

Request Syntax

client.complete_rollout(
    JobArn='string',
    TrajectoryId='string',
    Status='ready'|'failed',
    ClientToken='string'
)
type JobArn:

string

param JobArn:

[REQUIRED]

The job ARN.

type TrajectoryId:

string

param TrajectoryId:

[REQUIRED]

The trajectory ID to mark as complete.

type Status:

string

param Status:

The target status for the trajectory. Defaults to READY if not specified. Set to FAILED if the rollout encountered an error and the trajectory should not be used for processing.

type ClientToken:

string

param ClientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

SampleWithResponseStream (new) Link ¶

Sends a streaming inference request to the model during a job execution. Returns the response as a stream of payload chunks. Each turn is captured for later use.

See also: AWS API Documentation

Request Syntax

client.sample_with_response_stream(
    JobArn='string',
    TrajectoryId='string',
    Body=b'bytes'|file
)
type JobArn:

string

param JobArn:

[REQUIRED]

The job ARN that identifies which model session to route the inference request to.

type TrajectoryId:

string

param TrajectoryId:

[REQUIRED]

The trajectory ID for grouping turns into a single rollout. Each turn is captured for later use.

type Body:

bytes or seekable file-like object

param Body:

[REQUIRED]

The raw inference request body in OpenAI-compatible JSON format.

rtype:

dict

returns:

Response Syntax

{
    'ContentType': 'string',
    'Body': StreamingBody()
}

Response Structure

  • (dict) --

    • ContentType (string) --

      MIME type of the streaming inference result.

    • Body (:class:`.StreamingBody`) --

      The streaming response body, delivered as a series of PayloadPart events.

Sample (new) Link ¶

Sends an inference request to the model during a job execution. The request and response bodies are forwarded to and from the model without modification. Each turn (prompt and response) is captured for later use.

See also: AWS API Documentation

Request Syntax

client.sample(
    JobArn='string',
    TrajectoryId='string',
    Body=b'bytes'|file
)
type JobArn:

string

param JobArn:

[REQUIRED]

The job ARN that identifies which model session to route the inference request to.

type TrajectoryId:

string

param TrajectoryId:

[REQUIRED]

The trajectory ID for grouping turns into a single rollout. Each turn (prompt and response) is captured for later use.

type Body:

bytes or seekable file-like object

param Body:

[REQUIRED]

The raw inference request body in OpenAI-compatible JSON format.

rtype:

dict

returns:

Response Syntax

{
    'ContentType': 'string',
    'Body': StreamingBody()
}

Response Structure

  • (dict) --

    • ContentType (string) --

      MIME type of the inference result.

    • Body (:class:`.StreamingBody`) --

      The raw inference response body from the model.