[BREAKING] Add response filter for store input in *Providers#4327
Open
westey-m wants to merge 6 commits intomicrosoft:mainfrom
Open
[BREAKING] Add response filter for store input in *Providers#4327westey-m wants to merge 6 commits intomicrosoft:mainfrom
westey-m wants to merge 6 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds separate filtering for request vs. response messages when providers store/learn from an invocation, enabling scenarios like excluding tool/function-call messages from persisted chat history (Issue #4256).
Changes:
- Split “store input” filtering into
StorageInputRequestMessageFilterandStorageInputResponseMessageFilteracross chat-history and AI-context provider pipelines. - Update concrete providers/options (TextSearch, ChatHistoryMemory, Mem0, FoundryMemory, Cosmos/InMemory chat history) to pass the new filters through.
- Update unit tests and samples to use the new request/response filter APIs.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Abstractions/AIContextProvider.cs | Introduces request/response store filters in the base provider invocation pipeline. |
| dotnet/src/Microsoft.Agents.AI.Abstractions/ChatHistoryProvider.cs | Introduces request/response store filters for chat history storage. |
| dotnet/src/Microsoft.Agents.AI.Abstractions/MessageAIContextProvider.cs | Threads new request/response store filters through message-based context providers. |
| dotnet/src/Microsoft.Agents.AI.Abstractions/InMemoryChatHistoryProviderOptions.cs | Adds request/response storage filter options for in-memory chat history. |
| dotnet/src/Microsoft.Agents.AI.Abstractions/InMemoryChatHistoryProvider.cs | Wires new options into the base ChatHistoryProvider constructor. |
| dotnet/src/Microsoft.Agents.AI/TextSearchProviderOptions.cs | Adds request/response storage filters for TextSearchProvider state updates. |
| dotnet/src/Microsoft.Agents.AI/TextSearchProvider.cs | Passes the new filters into the base class. |
| dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProviderOptions.cs | Adds request/response storage filters for chat-history-backed memory. |
| dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs | Passes the new filters into the base class. |
| dotnet/src/Microsoft.Agents.AI.Mem0/Mem0ProviderOptions.cs | Adds request/response storage filters for Mem0 extraction. |
| dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs | Passes the new filters into the base class. |
| dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProviderOptions.cs | Adds request/response storage filters for Foundry memory extraction. |
| dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProvider.cs | Passes the new filters into the base class. |
| dotnet/src/Microsoft.Agents.AI.CosmosNoSql/CosmosChatHistoryProvider.cs | Adds request/response storage filter parameters and forwards them to the base class. |
| dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowChatHistoryProvider.cs | Removes now-stale base ctor call; relies on new default ctor parameters. |
| dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIContextProviderTests.cs | Adds/updates tests validating request/response filter behavior. |
| dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/ChatHistoryProviderTests.cs | Updates tests to validate filtered response storage behavior. |
| dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/InMemoryChatHistoryProviderTests.cs | Updates tests to use the renamed request filter option. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/Data/TextSearchProviderTests.cs | Updates tests to use the renamed request filter option. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs | Updates tests to use the renamed request filter option. |
| dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Mem0ProviderTests.cs | Updates tests to use the renamed request filter option. |
| dotnet/tests/Microsoft.Agents.AI.CosmosNoSql.UnitTests/CosmosChatHistoryProviderTests.cs | Updates tests for renamed ctor parameter and new semantics. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_ChatHistoryManagementTests.cs | Updates mocks due to updated base ctor signatures. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_BackgroundResponsesTests.cs | Updates mocks due to updated base ctor signatures. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentTests.cs | Updates mocks due to updated base ctor signatures. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentOptionsTests.cs | Updates mocks due to updated base ctor signatures. |
| dotnet/samples/02-agents/Agents/Agent_Step17_AdditionalAIContext/Program.cs | Updates sample to use the renamed request filter option. |
| dotnet/samples/02-agents/Agents/Agent_Step04_3rdPartyChatHistoryStorage/Program.cs | Removes stale base ctor call after signature change. |
| dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/Program.cs | Updates sample to use the renamed request filter option. |
| dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/Program.cs | Updates sample to use the renamed request filter option. |
| dotnet/samples/01-get-started/04_memory/Program.cs | Removes stale base ctor call after signature change. |
dotnet/src/Microsoft.Agents.AI.Abstractions/AIContextProvider.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Abstractions/InMemoryChatHistoryProviderOptions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Abstractions/InMemoryChatHistoryProviderOptions.cs
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProviderOptions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Abstractions/AIContextProvider.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.CosmosNoSql/CosmosChatHistoryProvider.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
SergeyMenshykh
approved these changes
Feb 27, 2026
dotnet/src/Microsoft.Agents.AI.Abstractions/ChatHistoryProvider.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.CosmosNoSql/CosmosChatHistoryProvider.cs
Outdated
Show resolved
Hide resolved
westey-m
commented
Feb 27, 2026
dotnet/src/Microsoft.Agents.AI.CosmosNoSql/CosmosChatHistoryProvider.cs
Outdated
Show resolved
Hide resolved
westey-m
commented
Feb 27, 2026
dotnet/src/Microsoft.Agents.AI.CosmosNoSql/CosmosChatHistoryProvider.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
#4256
Description
Contribution Checklist