AgentAdministrationClient.CreateSession Method

Definition

Creates a new session for an agent endpoint. The endpoint resolves the backing agent version from version_indicator and enforces session ownership using the provided isolation key for session-mutating operations.

public virtual System.ClientModel.ClientResult<Azure.AI.Projects.Agents.ProjectAgentSession> CreateSession(string agentName, Azure.AI.Projects.Agents.VersionIndicator versionIndicator, string agentSessionId = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateSession : string * Azure.AI.Projects.Agents.VersionIndicator * string * System.Threading.CancellationToken -> System.ClientModel.ClientResult<Azure.AI.Projects.Agents.ProjectAgentSession>
override this.CreateSession : string * Azure.AI.Projects.Agents.VersionIndicator * string * System.Threading.CancellationToken -> System.ClientModel.ClientResult<Azure.AI.Projects.Agents.ProjectAgentSession>
Public Overridable Function CreateSession (agentName As String, versionIndicator As VersionIndicator, Optional agentSessionId As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ClientResult(Of ProjectAgentSession)

Parameters

agentName
String

The name of the agent to create a session for.

versionIndicator
VersionIndicator

Determines which agent version backs the session.

agentSessionId
String

Optional caller-provided session ID. If specified, it must be unique within the agent endpoint. Auto-generated if omitted.

cancellationToken
CancellationToken

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

Returns

Exceptions

agentName or versionIndicator is null.

agentName is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Applies to