Interface SagemakerJobRuntimeAsyncClient

All Superinterfaces:
AutoCloseable, AwsClient, SdkAutoCloseable, SdkClient

@Generated("software.amazon.awssdk:codegen") @SdkPublicApi @ThreadSafe public interface SagemakerJobRuntimeAsyncClient extends AwsClient
Service client for accessing Sagemaker Job Runtime Service asynchronously. This can be created using the static builder() method.The asynchronous client performs non-blocking I/O when configured with any SdkAsyncHttpClient supported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in some cases such as credentials retrieval and endpoint discovery as part of the async API call.

Agentic RFT Runtime Service - manages trajectory and transition data for reinforcement fine-tuning jobs.

  • Field Details

  • Method Details

    • completeRollout

      default CompletableFuture<CompleteRolloutResponse> completeRollout(CompleteRolloutRequest completeRolloutRequest)

      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.

      Parameters:
      completeRolloutRequest -
      Returns:
      A Java Future containing the result of the CompleteRollout operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • completeRollout

      default CompletableFuture<CompleteRolloutResponse> completeRollout(Consumer<CompleteRolloutRequest.Builder> completeRolloutRequest)

      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.


      This is a convenience which creates an instance of the CompleteRolloutRequest.Builder avoiding the need to create one manually via CompleteRolloutRequest.builder()

      Parameters:
      completeRolloutRequest - A Consumer that will call methods on CompleteRolloutRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the CompleteRollout operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • sample

      default CompletableFuture<SampleResponse> sample(SampleRequest sampleRequest)

      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.

      Parameters:
      sampleRequest -
      Returns:
      A Java Future containing the result of the Sample operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • sample

      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.


      This is a convenience which creates an instance of the SampleRequest.Builder avoiding the need to create one manually via SampleRequest.builder()

      Parameters:
      sampleRequest - A Consumer that will call methods on SampleRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the Sample operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • sampleWithResponseStream

      default <ReturnT> CompletableFuture<ReturnT> sampleWithResponseStream(SampleWithResponseStreamRequest sampleWithResponseStreamRequest, AsyncResponseTransformer<SampleWithResponseStreamResponse,ReturnT> asyncResponseTransformer)

      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.

      Parameters:
      sampleWithResponseStreamRequest -
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows '

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

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • sampleWithResponseStream

      default <ReturnT> CompletableFuture<ReturnT> sampleWithResponseStream(Consumer<SampleWithResponseStreamRequest.Builder> sampleWithResponseStreamRequest, AsyncResponseTransformer<SampleWithResponseStreamResponse,ReturnT> asyncResponseTransformer)

      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.


      This is a convenience which creates an instance of the SampleWithResponseStreamRequest.Builder avoiding the need to create one manually via SampleWithResponseStreamRequest.builder()

      Parameters:
      sampleWithResponseStreamRequest - A Consumer that will call methods on SampleWithResponseStreamRequest.Builder to create a request.
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows '

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

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • sampleWithResponseStream

      default CompletableFuture<SampleWithResponseStreamResponse> sampleWithResponseStream(SampleWithResponseStreamRequest sampleWithResponseStreamRequest, Path destinationPath)

      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.

      Parameters:
      sampleWithResponseStreamRequest -
      destinationPath - Path to file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows '

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

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • sampleWithResponseStream

      default CompletableFuture<SampleWithResponseStreamResponse> sampleWithResponseStream(Consumer<SampleWithResponseStreamRequest.Builder> sampleWithResponseStreamRequest, Path destinationPath)

      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.


      This is a convenience which creates an instance of the SampleWithResponseStreamRequest.Builder avoiding the need to create one manually via SampleWithResponseStreamRequest.builder()

      Parameters:
      sampleWithResponseStreamRequest - A Consumer that will call methods on SampleWithResponseStreamRequest.Builder to create a request.
      destinationPath - Path to file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows '

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

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • updateReward

      default CompletableFuture<UpdateRewardResponse> updateReward(UpdateRewardRequest updateRewardRequest)

      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.

      Parameters:
      updateRewardRequest -
      Returns:
      A Java Future containing the result of the UpdateReward operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • updateReward

      default CompletableFuture<UpdateRewardResponse> updateReward(Consumer<UpdateRewardRequest.Builder> updateRewardRequest)

      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.


      This is a convenience which creates an instance of the UpdateRewardRequest.Builder avoiding the need to create one manually via UpdateRewardRequest.builder()

      Parameters:
      updateRewardRequest - A Consumer that will call methods on UpdateRewardRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the UpdateReward operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ResourceNotFoundException The specified resource was not found.
      • InternalServiceErrorException 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.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • SagemakerJobRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • serviceClientConfiguration

      default SagemakerJobRuntimeServiceClientConfiguration serviceClientConfiguration()
      Description copied from interface: SdkClient
      The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration
      Specified by:
      serviceClientConfiguration in interface AwsClient
      Specified by:
      serviceClientConfiguration in interface SdkClient
      Returns:
      SdkServiceClientConfiguration
    • create

      Create a SagemakerJobRuntimeAsyncClient with the region loaded from the DefaultAwsRegionProviderChain and credentials loaded from the DefaultCredentialsProvider.
    • builder

      Create a builder that can be used to configure and create a SagemakerJobRuntimeAsyncClient.