Share via


InMemoryAgentSessionStore Class

Definition

Provides an in-memory implementation of AgentSessionStore for development and testing scenarios.

public sealed class InMemoryAgentSessionStore : Microsoft.Agents.AI.Hosting.AgentSessionStore
type InMemoryAgentSessionStore = class
    inherit AgentSessionStore
Public NotInheritable Class InMemoryAgentSessionStore
Inherits AgentSessionStore
Inheritance
InMemoryAgentSessionStore

Remarks

This implementation stores threads in memory using a concurrent dictionary and is suitable for:

  • Single-instance development scenarios
  • Testing and prototyping
  • Scenarios where session persistence across restarts is not required

Warning: All stored threads will be lost when the application restarts. For production use with multiple instances or persistence across restarts, use a durable storage implementation such as Redis, SQL Server, or Azure Cosmos DB.

Constructors

Name Description
InMemoryAgentSessionStore()

Methods

Name Description
GetSessionAsync(AIAgent, String, CancellationToken)

Retrieves a serialized agent session from persistent storage.

SaveSessionAsync(AIAgent, String, AgentSession, CancellationToken)

Saves a serialized agent session to persistent storage.

Applies to