Skip to content

AgentPrismAgentSessionStore

Namespace AgentPrism · Assembly AgentPrism.AspNetCore.dll

Connects the Microsoft Agent Framework’s Hosting.AgentSessionStore abstraction to AgentPrism’s AgentSessionManager class.

public sealed class AgentPrismAgentSessionStore : AgentSessionStore

object ← AgentSessionStore ← AgentPrismAgentSessionStore

AgentSessionStore.SaveSessionAsync(AIAgent, string, AgentSession, CancellationToken), AgentSessionStore.GetSessionAsync(AIAgent, string, CancellationToken), AgentSessionStore.DeleteSessionAsync(AIAgent, string, CancellationToken), AgentSessionStore.GetService(Type, object?), AgentSessionStore.GetService<TService>(object?), object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Does not write its own persistence code; it only delegates. This way, sessions are written to the same store, with the same identity stamp, and with the same tenant isolation, no matter which path they come through (the management API, OpenAI-compatible endpoints, or MAF hosting constructs).

This class lives in AgentPrism.AspNetCore because Hosting.AgentSessionStore is in the prerelease Microsoft.Agents.AI.Hosting package, and AgentPrism.Core cannot depend on that package.

In multi-tenant setups, this instance can be wrapped with MAF’s IsolationKeyScopedAgentSessionStore class; to do so, the consumer registers its own Hosting.AgentSessionStore before calling MapAgentPrism.

AgentPrismAgentSessionStore(AgentSessionManager)

Section titled “ AgentPrismAgentSessionStore(AgentSessionManager)”

Creates a new bridge.

public AgentPrismAgentSessionStore(AgentSessionManager sessions)

sessions AgentSessionManager

The session manager to delegate to.

ArgumentNullException

sessions is null.

DeleteSessionAsync(AIAgent, string, CancellationToken)

Section titled “ DeleteSessionAsync(AIAgent, string, CancellationToken)”
public override ValueTask DeleteSessionAsync(AIAgent agent, string sessionStoreId, CancellationToken cancellationToken = default)

agent AIAgent

sessionStoreId string

cancellationToken CancellationToken

ValueTask

GetSessionAsync(AIAgent, string, CancellationToken)

Section titled “ GetSessionAsync(AIAgent, string, CancellationToken)”
public override ValueTask<AgentSession> GetSessionAsync(AIAgent agent, string sessionStoreId, CancellationToken cancellationToken = default)

agent AIAgent

sessionStoreId string

cancellationToken CancellationToken

ValueTask<AgentSession>

If no record exists, a new session is opened. The returned session is stamped with sessionStoreId in both cases.

SaveSessionAsync(AIAgent, string, AgentSession, CancellationToken)

Section titled “ SaveSessionAsync(AIAgent, string, AgentSession, CancellationToken)”
public override ValueTask SaveSessionAsync(AIAgent agent, string sessionStoreId, AgentSession session, CancellationToken cancellationToken = default)

agent AIAgent

sessionStoreId string

session AgentSession

cancellationToken CancellationToken

ValueTask