Skip to content

[BREAKING] Add response filter for store input in *Providers#4327

Open
westey-m wants to merge 6 commits intomicrosoft:mainfrom
westey-m:add-store-input-response-filter
Open

[BREAKING] Add response filter for store input in *Providers#4327
westey-m wants to merge 6 commits intomicrosoft:mainfrom
westey-m:add-store-input-response-filter

Conversation

@westey-m
Copy link
Contributor

Motivation and Context

#4256

Description

  • Add filter for response messages when storing messages in ChatMessageProviders and AIContextProviders

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings February 26, 2026 17:21
@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Feb 26, 2026
@github-actions github-actions bot changed the title Add response filter for store input in *Providers .NET: Add response filter for store input in *Providers Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 StorageInputRequestMessageFilter and StorageInputResponseMessageFilter across 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.

@westey-m westey-m changed the title .NET: Add response filter for store input in *Providers [BREAKING] Add response filter for store input in *Providers Feb 26, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants