AIAgent.SerializeSessionCoreAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Core implementation of session serialization logic.
protected abstract System.Threading.Tasks.ValueTask<System.Text.Json.JsonElement> SerializeSessionCoreAsync(Microsoft.Agents.AI.AgentSession session, System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member SerializeSessionCoreAsync : Microsoft.Agents.AI.AgentSession * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Text.Json.JsonElement>
Protected MustOverride Function SerializeSessionCoreAsync (session As AgentSession, Optional jsonSerializerOptions As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of JsonElement)
Parameters
- session
- AgentSession
The AgentSession to serialize.
- jsonSerializerOptions
- JsonSerializerOptions
Optional settings to customize the serialization 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 JsonElement with the serialized session state.
Remarks
This is the primary session serialization method that implementations must override.