SDK for PHP V3

Client: Aws\SagemakerJobRuntime\SagemakerJobRuntimeClient
Service ID: sagemakerjobruntime
Version: 2026-02-01

This page describes the parameters and results for the operations of the Sagemaker Job Runtime Service (2026-02-01), and shows how to use the Aws\SagemakerJobRuntime\SagemakerJobRuntimeClient object to call the described operations. This documentation is specific to the 2026-02-01 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

CompleteRollout ( array $params = [] )
Marks a rollout as complete, indicating that no further turns will be appended to the trajectory.
Sample ( array $params = [] )
Sends an inference request to the model during a job execution.
SampleWithResponseStream ( array $params = [] )
Sends a streaming inference request to the model during a job execution.
UpdateReward ( array $params = [] )
Updates the reward values for a trajectory and transitions it to reward-received status, signaling that it is eligible for processing.

Operations

CompleteRollout

$result = $client->completeRollout([/* ... */]);
$promise = $client->completeRolloutAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->completeRollout([
    'ClientToken' => '<string>',
    'JobArn' => '<string>', // REQUIRED
    'Status' => 'ready|failed',
    'TrajectoryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientToken
Type: string

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

JobArn
Required: Yes
Type: string

The job ARN.

Status
Type: string

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.

TrajectoryId
Required: Yes
Type: string

The trajectory ID to mark as complete.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified resource was not found.

InternalServiceError:

An internal service error occurred. Retry the request.

ValidationException:

The request is not valid. Check the request syntax and parameters

ConflictException:

The request conflicts with the current state of the resource.

ServiceQuotaExceededException:

You have exceeded a service quota.

ThrottlingException:

The request was throttled. Retry the request after a brief wait.

AccessDeniedException:

You do not have permission to perform this operation.

Examples

Example 1: Invoke CompleteRollout

Marks a rollout as complete so the trajectory is sealed and eligible for reward submission.

$result = $client->completeRollout([
    'JobArn' => 'arn:aws:sagemaker:us-east-1:123456789012:job/AgentRFT/my-training-job',
    'Status' => 'ready',
    'TrajectoryId' => 'trajectory-001',
]);

Result syntax:

[
]

Sample

$result = $client->sample([/* ... */]);
$promise = $client->sampleAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->sample([
    'Body' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED
    'JobArn' => '<string>', // REQUIRED
    'TrajectoryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Body
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

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

JobArn
Required: Yes
Type: string

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

TrajectoryId
Required: Yes
Type: string

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

Result Syntax

[
    'Body' => <string || resource || Psr\Http\Message\StreamInterface>,
    'ContentType' => '<string>',
]

Result Details

Members
Body
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The raw inference response body from the model.

ContentType
Type: string

MIME type of the inference result.

Errors

ResourceNotFoundException:

The specified resource was not found.

InternalServiceError:

An internal service error occurred. Retry the request.

ValidationException:

The request is not valid. Check the request syntax and parameters

ServiceQuotaExceededException:

You have exceeded a service quota.

ThrottlingException:

The request was throttled. Retry the request after a brief wait.

AccessDeniedException:

You do not have permission to perform this operation.

Examples

Example 1: Invoke Sample

Sends an inference request to the model and receives the response.

$result = $client->sample([
    'Body' => <BLOB>,
    'JobArn' => 'arn:aws:sagemaker:us-east-1:123456789012:job/AgentRFT/my-training-job',
    'TrajectoryId' => 'trajectory-001',
]);

SampleWithResponseStream

$result = $client->sampleWithResponseStream([/* ... */]);
$promise = $client->sampleWithResponseStreamAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->sampleWithResponseStream([
    'Body' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED
    'JobArn' => '<string>', // REQUIRED
    'TrajectoryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
Body
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

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

JobArn
Required: Yes
Type: string

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

TrajectoryId
Required: Yes
Type: string

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

Result Syntax

[
    'Body' => <string || resource || Psr\Http\Message\StreamInterface>,
    'ContentType' => '<string>',
]

Result Details

Members
Body
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

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

ContentType
Type: string

MIME type of the streaming inference result.

Errors

ResourceNotFoundException:

The specified resource was not found.

InternalServiceError:

An internal service error occurred. Retry the request.

ValidationException:

The request is not valid. Check the request syntax and parameters

ServiceQuotaExceededException:

You have exceeded a service quota.

ThrottlingException:

The request was throttled. Retry the request after a brief wait.

AccessDeniedException:

You do not have permission to perform this operation.

Examples

Example 1: Invoke SampleWithResponseStream

Sends a streaming inference request and receives the response as a stream of payload chunks.

$result = $client->sampleWithResponseStream([
    'Body' => <BLOB>,
    'JobArn' => 'arn:aws:sagemaker:us-east-1:123456789012:job/AgentRFT/my-training-job',
    'TrajectoryId' => 'trajectory-001',
]);

UpdateReward

$result = $client->updateReward([/* ... */]);
$promise = $client->updateRewardAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->updateReward([
    'ClientToken' => '<string>',
    'JobArn' => '<string>', // REQUIRED
    'Rewards' => [<float>, ...], // REQUIRED
    'TrajectoryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientToken
Type: string

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

JobArn
Required: Yes
Type: string

The job ARN.

Rewards
Required: Yes
Type: Array of doubles

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

TrajectoryId
Required: Yes
Type: string

The trajectory ID to update with reward values.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified resource was not found.

InternalServiceError:

An internal service error occurred. Retry the request.

ValidationException:

The request is not valid. Check the request syntax and parameters

ConflictException:

The request conflicts with the current state of the resource.

ServiceQuotaExceededException:

You have exceeded a service quota.

ThrottlingException:

The request was throttled. Retry the request after a brief wait.

AccessDeniedException:

You do not have permission to perform this operation.

Examples

Example 1: Invoke UpdateReward

Updates the reward values for a completed trajectory.

$result = $client->updateReward([
    'JobArn' => 'arn:aws:sagemaker:us-east-1:123456789012:job/AgentRFT/my-training-job',
    'Rewards' => [
        0.85,
        0.92,
        0.78,
    ],
    'TrajectoryId' => 'trajectory-001',
]);

Result syntax:

[
]

Shapes

AccessDeniedException

Description

You do not have permission to perform this operation.

Members
Message
Required: Yes
Type: string

ConflictException

Description

The request conflicts with the current state of the resource.

Members
Message
Required: Yes
Type: string

InternalServiceError

Description

An internal service error occurred. Retry the request.

Members
Message
Required: Yes
Type: string

ResourceNotFoundException

Description

The specified resource was not found.

Members
Message
Required: Yes
Type: string

ServiceQuotaExceededException

Description

You have exceeded a service quota.

Members
Message
Required: Yes
Type: string

ThrottlingException

Description

The request was throttled. Retry the request after a brief wait.

Members
Message
Required: Yes
Type: string

ValidationException

Description

The request is not valid. Check the request syntax and parameters

Members
Message
Required: Yes
Type: string