Share via


AgentSessionStore.GetSessionAsync(AIAgent, String, CancellationToken) Method

Definition

Retrieves a serialized agent session from persistent storage.

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

Parameters

agent
AIAgent

The agent that owns this session.

conversationId
String

The unique identifier for the conversation/session to retrieve.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests.

Returns

A task that represents the asynchronous retrieval operation. The task result contains the serialized session state, or null if not found.

Applies to