AgentSessionFiles.UploadSessionFileAsync Method

Definition

Upload a file to the session sandbox via binary stream. Maximum file size is 50 MB. Uploads exceeding this limit return 413 Payload Too Large.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<System.ClientModel.ClientResult<Azure.AI.Projects.Agents.SessionFileWriteResponse>> UploadSessionFileAsync(string agentName, string sessionId, string sessionStoragePath, string localPath, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadSessionFileAsync : string * string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.ClientModel.ClientResult<Azure.AI.Projects.Agents.SessionFileWriteResponse>>
override this.UploadSessionFileAsync : string * string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.ClientModel.ClientResult<Azure.AI.Projects.Agents.SessionFileWriteResponse>>
Public Overridable Function UploadSessionFileAsync (agentName As String, sessionId As String, sessionStoragePath As String, localPath As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ClientResult(Of SessionFileWriteResponse))

Parameters

agentName
String

The name of the agent.

sessionId
String

The session ID.

sessionStoragePath
String

The destination file path within the sandbox, relative to the session home directory.

localPath
String

The path to the local file to be uploaded.

cancellationToken
CancellationToken

The cancellation token that can be used to cancel the operation.

Returns

The response returned from the service.

Exceptions

agentName, sessionId, localPath or sessionStoragePath is null.

agentName, sessionId, localPath or sessionStoragePath is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Applies to