Share via


AgentSessionStore.SaveSessionAsync Method

Definition

Saves a serialized agent session to persistent storage.

public abstract System.Threading.Tasks.ValueTask SaveSessionAsync(Microsoft.Agents.AI.AIAgent agent, string conversationId, Microsoft.Agents.AI.AgentSession session, System.Threading.CancellationToken cancellationToken = default);
abstract member SaveSessionAsync : Microsoft.Agents.AI.AIAgent * string * Microsoft.Agents.AI.AgentSession * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Public MustOverride Function SaveSessionAsync (agent As AIAgent, conversationId As String, session As AgentSession, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Parameters

agent
AIAgent

The agent that owns this session.

conversationId
String

The unique identifier for the conversation/session.

session
AgentSession

The session to save.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests.

Returns

A task that represents the asynchronous save operation.

Applies to