InMemoryAgentSessionStore Class
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.
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
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. |