Uh oh!
There was an error while loading. Please reload this page.
.NET: Add Azure Blob Storage session persistence - #1893
Conversation
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull Request Overview
This PR adds Azure Blob Storage integration for agent thread persistence to the Microsoft Agent Framework. It introduces a new project Microsoft.Agents.AI.Hosting.AzureStorage that provides an implementation of AgentThreadStore using Azure Blob Storage, along with corresponding unit tests.
Key Changes:
- New
AzureBlobAgentThreadStoreimplementation for persisting agent threads to Azure Blob Storage - Extension methods to configure agents with Azure Blob thread store
- Unit tests with Azurite emulator support for local testing
- CI/CD workflow updates to start Azurite for running tests
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Hosting.AzureStorage/Blob/AzureBlobAgentThreadStore.cs | Core implementation for Azure Blob Storage thread persistence |
| dotnet/src/Microsoft.Agents.AI.Hosting.AzureStorage/Blob/AzureBlobAgentThreadStoreOptions.cs | Configuration options for the blob store |
| dotnet/src/Microsoft.Agents.AI.Hosting.AzureStorage/HostedAgentBuilderExtensions.Blob.cs | Extension methods for configuring agents with blob storage |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AzureStorage.UnitTests/AzureBlobAgentThreadStoreTests.cs | Unit tests for the blob store implementation |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AzureStorage.UnitTests/TestRunner.cs | Test helper for running agent scenarios |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AzureStorage.UnitTests/Mock/MockChatClient.cs | Mock chat client for testing |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AzureStorage.UnitTests/AzureStorageEmulatorAvailabilityHelper.cs | Helper for checking Azurite availability |
| dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/Program.cs | Sample code demonstrating blob storage usage |
| .github/workflows/dotnet-build-and-test.yml | CI workflow updated to start Azurite |
Comments suppressed due to low confidence (1)
dotnet/tests/Microsoft.Agents.AI.Hosting.AzureStorage.UnitTests/Mock/MockChatClient.cs:28
- This assignment to lastUserMessage is useless, since its value is never read.
ChatMessage lastUserMessage = messageList.LastOrDefault(m => m.Role == ChatRole.User)
?? new ChatMessage(ChatRole.User, "No user message");
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Motivation & Context
Hosted agents need durable session state to continue conversations across HTTP requests, process restarts, and multiple application instances. In-memory storage is useful for development, but it loses state when the process stops. This change adds Azure Blob Storage as an opt-in durable session store for hosted .NET agents.
Description & Review Guide
Microsoft.Agents.AI.Hosting.AzureStoragepackage withAzureBlobAgentSessionStore, configuration options, andWithAzureBlobSessionStoreregistration helpers.AgentSessionJSON using stable, bounded SHA-256 blob names partitioned by the hosted agent registration name.AZURE_STORAGE_BLOB_CONNECTION_STRINGandAZURE_STORAGE_BLOB_CONTAINER_NAMEare configured, with in-memory storage as the development fallback.Related Issue
No related issue or overlapping open pull request was found.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix), and a workflow keeps the label and title prefix in sync automatically.