Class RunsAsyncClient

java.lang.Object
com.azure.ai.agents.persistent.RunsAsyncClient

public final class RunsAsyncClient extends Object
Initializes a new instance of the asynchronous PersistentAgentsAdministrationClient type.
  • Method Details

    • createRunWithResponse

      public Mono<com.azure.core.http.rest.Response<com.azure.core.util.BinaryData>> createRunWithResponse(String threadId, com.azure.core.util.BinaryData createRunRequest, com.azure.core.http.rest.RequestOptions requestOptions)
      Creates a new run for an agent thread.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      include[]List<String>NoA list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. In the form of "," separated string.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Request Body Schema

       
       {
           assistant_id: String (Required)
           model: String (Optional)
           instructions: String (Optional)
           additional_instructions: String (Optional)
           additional_messages (Optional): [
                (Optional){
                   role: String(user/assistant) (Required)
                   content: BinaryData (Required)
                   attachments (Optional): [
                        (Optional){
                           file_id: String (Optional)
                           data_source (Optional): {
                               uri: String (Required)
                               type: String(uri_asset/id_asset) (Required)
                           }
                           tools (Required): [
                               BinaryData (Required)
                           ]
                       }
                   ]
                   metadata (Optional): {
                       String: String (Required)
                   }
               }
           ]
           tools (Optional): [
                (Optional){
                   type: String (Required)
               }
           ]
           stream: Boolean (Optional)
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Optional)
           max_completion_tokens: Integer (Optional)
           truncation_strategy (Optional): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Optional)
           response_format: BinaryData (Optional)
           parallel_tool_calls: Boolean (Optional)
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
               type: String (Required)
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
                   type: String (Required)
               }
           ]
           created_at: long (Required)
           expires_at: Long (Required)
           started_at: Long (Required)
           completed_at: Long (Required)
           cancelled_at: Long (Required)
           failed_at: Long (Required)
           incomplete_details (Required): {
               reason: String(max_completion_tokens/max_prompt_tokens) (Required)
           }
           usage (Required): {
               completion_tokens: long (Required)
               prompt_tokens: long (Required)
               total_tokens: long (Required)
           }
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Required)
           max_completion_tokens: Integer (Required)
           truncation_strategy (Required): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Required)
           response_format: BinaryData (Required)
           metadata (Required): {
               String: String (Required)
           }
           tool_resources (Optional): {
               code_interpreter (Optional): {
                   file_ids (Optional): [
                       String (Optional)
                   ]
                   data_sources (Optional): [
                        (Optional){
                           uri: String (Required)
                           type: String(uri_asset/id_asset) (Required)
                       }
                   ]
               }
               file_search (Optional): {
                   vector_store_ids (Optional): [
                       String (Optional)
                   ]
                   vector_stores (Optional): [
                        (Optional){
                           name: String (Required)
                           configuration (Required): {
                               data_sources (Required): [
                                   (recursive schema, see above)
                               ]
                           }
                       }
                   ]
               }
               azure_ai_search (Optional): {
                   indexes (Optional): [
                        (Optional){
                           index_connection_id: String (Optional)
                           index_name: String (Optional)
                           query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
                           top_k: Integer (Optional)
                           filter: String (Optional)
                           index_asset_id: String (Optional)
                       }
                   ]
               }
           }
           parallel_tool_calls: boolean (Required)
       }
       
       
      Parameters:
      threadId - Identifier of the thread.
      createRunRequest - The createRunRequest parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an agent thread along with Response on successful completion of Mono.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getRunWithResponse

      public Mono<com.azure.core.http.rest.Response<com.azure.core.util.BinaryData>> getRunWithResponse(String threadId, String runId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets an existing run from an existing thread.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
               type: String (Required)
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
                   type: String (Required)
               }
           ]
           created_at: long (Required)
           expires_at: Long (Required)
           started_at: Long (Required)
           completed_at: Long (Required)
           cancelled_at: Long (Required)
           failed_at: Long (Required)
           incomplete_details (Required): {
               reason: String(max_completion_tokens/max_prompt_tokens) (Required)
           }
           usage (Required): {
               completion_tokens: long (Required)
               prompt_tokens: long (Required)
               total_tokens: long (Required)
           }
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Required)
           max_completion_tokens: Integer (Required)
           truncation_strategy (Required): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Required)
           response_format: BinaryData (Required)
           metadata (Required): {
               String: String (Required)
           }
           tool_resources (Optional): {
               code_interpreter (Optional): {
                   file_ids (Optional): [
                       String (Optional)
                   ]
                   data_sources (Optional): [
                        (Optional){
                           uri: String (Required)
                           type: String(uri_asset/id_asset) (Required)
                       }
                   ]
               }
               file_search (Optional): {
                   vector_store_ids (Optional): [
                       String (Optional)
                   ]
                   vector_stores (Optional): [
                        (Optional){
                           name: String (Required)
                           configuration (Required): {
                               data_sources (Required): [
                                   (recursive schema, see above)
                               ]
                           }
                       }
                   ]
               }
               azure_ai_search (Optional): {
                   indexes (Optional): [
                        (Optional){
                           index_connection_id: String (Optional)
                           index_name: String (Optional)
                           query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
                           top_k: Integer (Optional)
                           filter: String (Optional)
                           index_asset_id: String (Optional)
                       }
                   ]
               }
           }
           parallel_tool_calls: boolean (Required)
       }
       
       
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      an existing run from an existing thread along with Response on successful completion of Mono.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • updateRunWithResponse

      public Mono<com.azure.core.http.rest.Response<com.azure.core.util.BinaryData>> updateRunWithResponse(String threadId, String runId, com.azure.core.util.BinaryData updateRunRequest, com.azure.core.http.rest.RequestOptions requestOptions)
      Modifies an existing thread run.

      Request Body Schema

       
       {
           metadata (Optional): {
               String: String (Required)
           }
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
               type: String (Required)
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
                   type: String (Required)
               }
           ]
           created_at: long (Required)
           expires_at: Long (Required)
           started_at: Long (Required)
           completed_at: Long (Required)
           cancelled_at: Long (Required)
           failed_at: Long (Required)
           incomplete_details (Required): {
               reason: String(max_completion_tokens/max_prompt_tokens) (Required)
           }
           usage (Required): {
               completion_tokens: long (Required)
               prompt_tokens: long (Required)
               total_tokens: long (Required)
           }
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Required)
           max_completion_tokens: Integer (Required)
           truncation_strategy (Required): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Required)
           response_format: BinaryData (Required)
           metadata (Required): {
               String: String (Required)
           }
           tool_resources (Optional): {
               code_interpreter (Optional): {
                   file_ids (Optional): [
                       String (Optional)
                   ]
                   data_sources (Optional): [
                        (Optional){
                           uri: String (Required)
                           type: String(uri_asset/id_asset) (Required)
                       }
                   ]
               }
               file_search (Optional): {
                   vector_store_ids (Optional): [
                       String (Optional)
                   ]
                   vector_stores (Optional): [
                        (Optional){
                           name: String (Required)
                           configuration (Required): {
                               data_sources (Required): [
                                   (recursive schema, see above)
                               ]
                           }
                       }
                   ]
               }
               azure_ai_search (Optional): {
                   indexes (Optional): [
                        (Optional){
                           index_connection_id: String (Optional)
                           index_name: String (Optional)
                           query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
                           top_k: Integer (Optional)
                           filter: String (Optional)
                           index_asset_id: String (Optional)
                       }
                   ]
               }
           }
           parallel_tool_calls: boolean (Required)
       }
       
       
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      updateRunRequest - The updateRunRequest parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an agent thread along with Response on successful completion of Mono.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • submitToolOutputsToRunWithResponse

      public Mono<com.azure.core.http.rest.Response<com.azure.core.util.BinaryData>> submitToolOutputsToRunWithResponse(String threadId, String runId, com.azure.core.util.BinaryData submitToolOutputsToRunRequest, com.azure.core.http.rest.RequestOptions requestOptions)
      Submits outputs from tools as requested by tool calls in a run.

      Request Body Schema

       
       {
           tool_outputs (Required): [
                (Required){
                   tool_call_id: String (Optional)
                   output: String (Optional)
               }
           ]
           stream: Boolean (Optional)
       }
       
       

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
               type: String (Required)
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
                   type: String (Required)
               }
           ]
           created_at: long (Required)
           expires_at: Long (Required)
           started_at: Long (Required)
           completed_at: Long (Required)
           cancelled_at: Long (Required)
           failed_at: Long (Required)
           incomplete_details (Required): {
               reason: String(max_completion_tokens/max_prompt_tokens) (Required)
           }
           usage (Required): {
               completion_tokens: long (Required)
               prompt_tokens: long (Required)
               total_tokens: long (Required)
           }
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Required)
           max_completion_tokens: Integer (Required)
           truncation_strategy (Required): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Required)
           response_format: BinaryData (Required)
           metadata (Required): {
               String: String (Required)
           }
           tool_resources (Optional): {
               code_interpreter (Optional): {
                   file_ids (Optional): [
                       String (Optional)
                   ]
                   data_sources (Optional): [
                        (Optional){
                           uri: String (Required)
                           type: String(uri_asset/id_asset) (Required)
                       }
                   ]
               }
               file_search (Optional): {
                   vector_store_ids (Optional): [
                       String (Optional)
                   ]
                   vector_stores (Optional): [
                        (Optional){
                           name: String (Required)
                           configuration (Required): {
                               data_sources (Required): [
                                   (recursive schema, see above)
                               ]
                           }
                       }
                   ]
               }
               azure_ai_search (Optional): {
                   indexes (Optional): [
                        (Optional){
                           index_connection_id: String (Optional)
                           index_name: String (Optional)
                           query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
                           top_k: Integer (Optional)
                           filter: String (Optional)
                           index_asset_id: String (Optional)
                       }
                   ]
               }
           }
           parallel_tool_calls: boolean (Required)
       }
       
       
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      submitToolOutputsToRunRequest - The submitToolOutputsToRunRequest parameter.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an agent thread along with Response on successful completion of Mono.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • cancelRunWithResponse

      public Mono<com.azure.core.http.rest.Response<com.azure.core.util.BinaryData>> cancelRunWithResponse(String threadId, String runId, com.azure.core.http.rest.RequestOptions requestOptions)
      Cancels a run of an in‐progress thread.

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
               type: String (Required)
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
                   type: String (Required)
               }
           ]
           created_at: long (Required)
           expires_at: Long (Required)
           started_at: Long (Required)
           completed_at: Long (Required)
           cancelled_at: Long (Required)
           failed_at: Long (Required)
           incomplete_details (Required): {
               reason: String(max_completion_tokens/max_prompt_tokens) (Required)
           }
           usage (Required): {
               completion_tokens: long (Required)
               prompt_tokens: long (Required)
               total_tokens: long (Required)
           }
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Required)
           max_completion_tokens: Integer (Required)
           truncation_strategy (Required): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Required)
           response_format: BinaryData (Required)
           metadata (Required): {
               String: String (Required)
           }
           tool_resources (Optional): {
               code_interpreter (Optional): {
                   file_ids (Optional): [
                       String (Optional)
                   ]
                   data_sources (Optional): [
                        (Optional){
                           uri: String (Required)
                           type: String(uri_asset/id_asset) (Required)
                       }
                   ]
               }
               file_search (Optional): {
                   vector_store_ids (Optional): [
                       String (Optional)
                   ]
                   vector_stores (Optional): [
                        (Optional){
                           name: String (Required)
                           configuration (Required): {
                               data_sources (Required): [
                                   (recursive schema, see above)
                               ]
                           }
                       }
                   ]
               }
               azure_ai_search (Optional): {
                   indexes (Optional): [
                        (Optional){
                           index_connection_id: String (Optional)
                           index_name: String (Optional)
                           query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
                           top_k: Integer (Optional)
                           filter: String (Optional)
                           index_asset_id: String (Optional)
                       }
                   ]
               }
           }
           parallel_tool_calls: boolean (Required)
       }
       
       
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      data representing a single evaluation run of an agent thread along with Response on successful completion of Mono.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • createRun

      public Mono<ThreadRun> createRun(CreateRunOptions options)
      Creates a new run for an agent thread.
      Parameters:
      options - Options for createRun API.
      Returns:
      data representing a single evaluation run of an agent thread on successful completion of Mono.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • createRunStreaming

      public Mono<Flux<StreamUpdate>> createRunStreaming(CreateRunOptions options)
      Creates a new streaming run for an agent thread.
      Parameters:
      options - Options for createRun API.
      Returns:
      A flux streaming updates from the run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRuns

      public com.azure.core.http.rest.PagedFlux<ThreadRun> listRuns(String threadId, Integer limit, ListSortOrder order, String after, String before)
      Gets a list of runs for a specified thread.
      Parameters:
      threadId - Identifier of the thread.
      limit - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      order - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
      after - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      before - A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      Returns:
      a list of runs for a specified thread as paginated response with PagedFlux.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRuns

      public com.azure.core.http.rest.PagedFlux<ThreadRun> listRuns(String threadId)
      Gets a list of runs for a specified thread.
      Parameters:
      threadId - Identifier of the thread.
      Returns:
      a list of runs for a specified thread as paginated response with PagedFlux.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getRun

      public Mono<ThreadRun> getRun(String threadId, String runId)
      Gets an existing run from an existing thread.
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      Returns:
      an existing run from an existing thread on successful completion of Mono.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • updateRun

      public Mono<ThreadRun> updateRun(String threadId, String runId, Map<String,String> metadata)
      Modifies an existing thread run.
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      metadata - A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
      Returns:
      data representing a single evaluation run of an agent thread on successful completion of Mono.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • updateRun

      public Mono<ThreadRun> updateRun(String threadId, String runId)
      Modifies an existing thread run.
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      Returns:
      data representing a single evaluation run of an agent thread on successful completion of Mono.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • submitToolOutputsToRun

      public Mono<ThreadRun> submitToolOutputsToRun(String threadId, String runId, List<ToolOutput> toolOutputs, Boolean stream)
      Submits outputs from tools as requested by tool calls in a run.
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      toolOutputs - A list of tools for which the outputs are being submitted.
      stream - If true, returns a stream of events that happen during the Run as SSE, terminating at `[DONE]`.
      Returns:
      data representing a single evaluation run of an agent thread on successful completion of Mono.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • submitToolOutputsToRun

      public Mono<ThreadRun> submitToolOutputsToRun(String threadId, String runId, List<ToolOutput> toolOutputs)
      Submits outputs from tools as requested by tool calls in a run.
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      toolOutputs - A list of tools for which the outputs are being submitted.
      Returns:
      data representing a single evaluation run of an agent thread on successful completion of Mono.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • submitToolOutputsToRunStreaming

      public Mono<Flux<StreamUpdate>> submitToolOutputsToRunStreaming(String threadId, String runId, List<ToolOutput> toolOutputs)
      Submits outputs from tools as requested by tool calls in a run with streaming updates. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      toolOutputs - A list of tools for which the outputs are being submitted.
      Returns:
      A mono of flux of streaming updates from the run.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • cancelRun

      public Mono<ThreadRun> cancelRun(String threadId, String runId)
      Cancels a run of an in‐progress thread.
      Parameters:
      threadId - Identifier of the thread.
      runId - Identifier of the run.
      Returns:
      data representing a single evaluation run of an agent thread on successful completion of Mono.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • listRuns

      public com.azure.core.http.rest.PagedFlux<com.azure.core.util.BinaryData> listRuns(String threadId, com.azure.core.http.rest.RequestOptions requestOptions)
      Gets a list of runs for a specified thread.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      limitIntegerNoA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
      orderStringNoSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Allowed values: "asc", "desc".
      afterStringNoA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
      beforeStringNoA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Response Body Schema

       
       {
           id: String (Required)
           object: String (Required)
           thread_id: String (Required)
           assistant_id: String (Required)
           status: String(queued/in_progress/requires_action/cancelling/cancelled/failed/completed/expired) (Required)
           required_action (Optional): {
               type: String (Required)
           }
           last_error (Required): {
               code: String (Required)
               message: String (Required)
           }
           model: String (Required)
           instructions: String (Required)
           tools (Required): [
                (Required){
                   type: String (Required)
               }
           ]
           created_at: long (Required)
           expires_at: Long (Required)
           started_at: Long (Required)
           completed_at: Long (Required)
           cancelled_at: Long (Required)
           failed_at: Long (Required)
           incomplete_details (Required): {
               reason: String(max_completion_tokens/max_prompt_tokens) (Required)
           }
           usage (Required): {
               completion_tokens: long (Required)
               prompt_tokens: long (Required)
               total_tokens: long (Required)
           }
           temperature: Double (Optional)
           top_p: Double (Optional)
           max_prompt_tokens: Integer (Required)
           max_completion_tokens: Integer (Required)
           truncation_strategy (Required): {
               type: String(auto/last_messages) (Required)
               last_messages: Integer (Optional)
           }
           tool_choice: BinaryData (Required)
           response_format: BinaryData (Required)
           metadata (Required): {
               String: String (Required)
           }
           tool_resources (Optional): {
               code_interpreter (Optional): {
                   file_ids (Optional): [
                       String (Optional)
                   ]
                   data_sources (Optional): [
                        (Optional){
                           uri: String (Required)
                           type: String(uri_asset/id_asset) (Required)
                       }
                   ]
               }
               file_search (Optional): {
                   vector_store_ids (Optional): [
                       String (Optional)
                   ]
                   vector_stores (Optional): [
                        (Optional){
                           name: String (Required)
                           configuration (Required): {
                               data_sources (Required): [
                                   (recursive schema, see above)
                               ]
                           }
                       }
                   ]
               }
               azure_ai_search (Optional): {
                   indexes (Optional): [
                        (Optional){
                           index_connection_id: String (Optional)
                           index_name: String (Optional)
                           query_type: String(simple/semantic/vector/vector_simple_hybrid/vector_semantic_hybrid) (Optional)
                           top_k: Integer (Optional)
                           filter: String (Optional)
                           index_asset_id: String (Optional)
                       }
                   ]
               }
           }
           parallel_tool_calls: boolean (Required)
       }
       
       
      Parameters:
      threadId - Identifier of the thread.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      a list of runs for a specified thread as paginated response with PagedFlux.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.