Skip to content

.NET: [PREVIEW BREAKING] Promote AgentSessionStore into Agents.AI.Abstractions - #7991

Draft
Roger Barreto (rogerbarreto) wants to merge 6 commits into
microsoft:mainfrom
rogerbarreto:rogerbarreto-agent-session-store
Draft

.NET: [PREVIEW BREAKING] Promote AgentSessionStore into Agents.AI.Abstractions#7991
Roger Barreto (rogerbarreto) wants to merge 6 commits into
microsoft:mainfrom
rogerbarreto:rogerbarreto-agent-session-store

Conversation

@rogerbarreto

@rogerbarreto Roger Barreto (rogerbarreto) commented Sep 1, 2026

Copy link
Copy Markdown
Member

Motivation & Context

Microsoft.Agents.AI.Hosting and Microsoft.Agents.AI.Foundry.Hosting expose incompatible AgentSessionStore abstractions. Storage implementations therefore depend on a specific hosting protocol package and cannot be reused consistently across hosting surfaces. Shared contracts belong beside AIAgent and ChatClientAgent rather than inside a protocol package.

Description & Review Guide

  • What are the major changes? Adds experimental AgentSessionStore and AgentSessionStoreKey abstractions. The immutable key contains a logical session id plus arbitrary named partitions. Every partition contributes to identity, independent of insertion order. Promotes DelegatingAgentSessionStore to the Microsoft.Agents.AI package beside ChatClientAgent. Removes duplicate Hosting and Foundry Hosting contracts. Updates Hosting, Foundry Hosting, A2A, AGUI, OpenAI, Azure Storage, samples, tests, specifications, and ADR 0039.
  • What is the impact of these changes? Preview consumers now use one reusable, storage-agnostic contract without privileging user identity or prescribing physical key encoding. Hosting may add isolation; Foundry adds user; applications may add tenant, chat, or other partitions. Each store maps the logical key to its own backend. Provider-specific metadata such as Foundry tags remains outside Abstractions. GetSessionAsync returns null when no value exists, GetOrCreateSessionAsync performs explicit creation, and each successful lookup returns an independent session.
  • What do you want reviewers to focus on? Please focus on the storage-agnostic AgentSessionStoreKey API shape, DelegatingAgentSessionStore package placement, the requirement that every partition affects identity, and mapping of hosted isolation into named partitions.

Related Issue

Fixes #7990

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings September 1, 2026 13:32
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible labels Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the .NET AgentSessionStore contract into Abstractions, unifying session persistence and user partitioning across hosting surfaces.

Changes:

  • Introduces shared nullable lookup and explicit get-or-create semantics.
  • Updates Hosting, Foundry, A2A, AGUI, OpenAI, and Azure Blob consumers.
  • Adds migration documentation and isolation/compatibility tests.

Reviewed changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
IsolationKeyScopedAgentSessionStoreTests.cs Tests user-partition forwarding.
InMemoryAgentSessionStoreTests.cs Tests missing sessions and isolation.
DelegatingAgentSessionStoreTests.cs Updates delegation tests.
ClaimsIdentityAgentIsolationKeyProviderTests.cs Tests blank claims.
OpenAIResponsesHostingTests.cs Uses explicit session creation.
OpenAIResponsesHostingLiveTests.cs Updates live session calls.
AnthropicResponsesHostingLiveTests.cs Updates live session calls.
AzureBlobHostedAgentBuilderExtensionsTests.cs Updates registration assertions.
AzureBlobAgentSessionStoreTests.cs Tests isolation and legacy keys.
A2AServerServiceCollectionExtensionsTests.cs Updates store mocks.
A2AAgentHandlerTests.cs Verifies partition forwarding.
AgentSessionStoreTests.cs Tests the shared contract.
NoopAgentSessionStore.cs Returns null on lookup.
Microsoft.Agents.AI.Hosting.csproj Enables experimental API support.
Local/InMemoryAgentSessionStore.cs Adds user-partitioned storage.
IsolationKeyScopedAgentSessionStoreOptions.cs Updates non-strict semantics.
IsolationKeyScopedAgentSessionStore.cs Forwards isolation as userId.
HostedAgentBuilderExtensions.cs Updates isolation wrapping.
DelegatingAgentSessionStore.cs Delegates the shared API.
AIHostAgent.cs Uses get-or-create semantics.
Hosting/AgentSessionStore.cs Removes duplicate contract.
Hosting.AzureStorage.csproj Enables experimental API support.
AzureBlobAgentSessionStore.cs Adds partitioned Blob keys.
AzureBlobHostedAgentBuilderExtensions.cs Updates isolation documentation.
ClaimsIdentityAgentIsolationKeyProvider.cs Rejects blank claims.
Hosting.AGUI.AspNetCore.csproj Suppresses experimental warning.
AGUIEndpointRouteBuilderExtensions.cs Updates isolation handling.
Hosting.A2A.csproj Suppresses experimental warning.
A2AServerServiceCollectionExtensions.cs Updates A2A partition handling.
Foundry.Hosting/InMemoryAgentSessionStore.cs Adds argument validation.
FoundryAgentSessionStore.cs Validates user partitions.
FileSystemAgentSessionStore.cs Validates user partitions.
Foundry.Hosting/AgentSessionStore.cs Removes duplicate contract.
PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt Records shared API.
PublicAPI/net9.0/PublicAPI.Unshipped.txt Records shared API.
PublicAPI/net8.0/PublicAPI.Unshipped.txt Records shared API.
PublicAPI/net472/PublicAPI.Unshipped.txt Records shared API.
PublicAPI/net10.0/PublicAPI.Unshipped.txt Records shared API.
Abstractions/AgentSessionStore.cs Defines the shared contract.
local_responses/Server/README.md Documents new semantics.
local_responses/Server/Program.cs Migrates the sample.
003-dotnet-hosting-protocol-helpers.md Updates the hosting specification.
0039-shared-agent-session-store.md Adds the architectural decision.
0032-dotnet-hosting-protocol-helpers.md Marks the old decision superseded.
0031-hosted-per-user-session-storage-isolation.md Documents contract promotion.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread dotnet/src/Microsoft.Agents.AI.Abstractions/AgentSessionStore.cs

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 21d1ee9617d8
Model: gpt-5.6-sol

Overview

The review found 2 verified inline finding(s).

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
2 verified findings remained after source verification (2 medium) across 2 files. Details are attached to the affected lines below.

Affected areas: dotnet/src/Microsoft.Agents.AI.Hosting.AzureStorage/Blob/AzureBlobAgentSessionStore.cs, dotnet/src/Microsoft.Agents.AI.Hosting/DelegatingAgentSessionStore.cs

Comment thread dotnet/src/Microsoft.Agents.AI.Hosting/DelegatingAgentSessionStore.cs Outdated
@rogerbarreto Roger Barreto (rogerbarreto) changed the title [BREAKING] .NET: Share AgentSessionStore through Abstractions .NET: [BREAKING] Promote AgentSessionStore into Agents.AI.Abstractions Sep 1, 2026
@rogerbarreto Roger Barreto (rogerbarreto) changed the title .NET: [BREAKING] Promote AgentSessionStore into Agents.AI.Abstractions .NET: [BREAKING PREVIEW] Promote AgentSessionStore into Agents.AI.Abstractions Sep 1, 2026
Comment thread dotnet/src/Microsoft.Agents.AI.Abstractions/AgentSessionStore.cs Outdated
@rogerbarreto Roger Barreto (rogerbarreto) changed the title .NET: [BREAKING PREVIEW] Promote AgentSessionStore into Agents.AI.Abstractions .NET: [PREVIEW BREAKING] Promote AgentSessionStore into Agents.AI.Abstractions Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Feature]: Share AgentSessionStore through Abstractions

3 participants