Share via


AIAgent.DeserializeSessionCoreAsync Method

Definition

Core implementation of session deserialization logic.

protected abstract System.Threading.Tasks.ValueTask<Microsoft.Agents.AI.AgentSession> DeserializeSessionCoreAsync(System.Text.Json.JsonElement serializedState, System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DeserializeSessionCoreAsync : System.Text.Json.JsonElement * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Agents.AI.AgentSession>
Protected MustOverride Function DeserializeSessionCoreAsync (serializedState As JsonElement, Optional jsonSerializerOptions As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of AgentSession)

Parameters

serializedState
JsonElement

A JsonElement containing the serialized session state.

jsonSerializerOptions
JsonSerializerOptions

Optional settings to customize the deserialization process.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

A value task that represents the asynchronous operation. The task result contains a restored AgentSession instance with the state from serializedState.

Remarks

This is the primary session deserialization method that implementations must override.

Applies to