.Net: Add AIContextProvider support to Semantic Kernel#11689
Merged
Conversation
…dd Unit tests. (#11632) ### Motivation and Context #10100 #10712 ### Description This is the first PR of a number of PRs and adds 1. A base abstraction for creating a conversation state extension 2. A class to manage multiple extensions 3. Updates to the AgentThread to use extensions 4. Unit tests 5. ADR document In follow up PRs I'll add: - Updates to Agents to use extensions on AgentThread - Individual Extension implementations ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
… tests (#11690) ### Motivation and Context #10100 #10712 Other agents and actual state components to follow in future PRs. ### Description - Add code to integrate conversation state with ChatCompletionAgent - Add integration tests for the integration ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
### Motivation and Context #10100 #10712 ### Description - Add a new `mem0` conversation state part - Add integration tests for the new component ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
…on state (#11711) ### Motivation and Context #10100 #10712 ### Description - Update OpenAIAssistantAgent to support conversation state - Update AzureAIAgent to support conversation state - Update tests and add integration tests. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
### Motivation and Context #10100 #10712 ### Description - Add unit tests for the mem0 memory component - Allow context prompt to be configurable ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
…tests. (#11737) ### Motivation and Context #10100 #10712 ### Description - Add support to BedrockAgent for conversation state parts - Fix issue in AzureAIAgent with instructions merging - Add more integration tests ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
### Motivation and Context #10100 #10712 ### Description Adding a rag component for easily adding RAG to an agent. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
### Motivation and Context We should have a simple way of uploading text and doing RAG over that text. This branch is not up to date with the latest MEVD changes, but will be updated after this PR with changes to make use of the new features. ### Description Adding a store that allows easy uploading of text or links to text and exposing that text via the TextRagComponent ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
…11862) ### Description - Rename TextRagComponent to TextSearchBehavior - Add Prompt tests - Improve prompts ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
…re tests (#11877) ### Motivation and Context #10100 #10712 ### Description - Adds a sample that shows how to use the rag components with an agent - Adds support for text only uploads - Adds some bug fixes - Adds additional tests ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
### Description - Add a sample to show how to use the mem0 component - Fix some bugs and add more tests - Removed the clear memory tool, since it is flakey and getting invoked when it shouldn't be. - Can reintroduce later if we find a way to do this safely ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
### Motivation and Context Making the context behavior manager an aggregate context behavior that is itself a behavior, allows users to reuse this and build their own context behavior hierarchies enabling more complex scenarios. ### Description - Rename and update AIContextBehaviorManager as discussed - Rename event names as discussed - Update branch with changes required after latest breaking change from main ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
SergeyMenshykh
approved these changes
May 20, 2025
…#12218) ### Motivation and Context As discussed, naming changes to improve clarity and align with MEAI naming. ### Description Rename AIContextBehavior to Provider and thread to conversation ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
SergeyMenshykh
approved these changes
May 22, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 25, 2025
### Motivation and Context - Fixes #12534 - This regression seems to be part of #11689 where `kernel` instance was is cloned prior agent iterations, as I didn't captured any failing unit tests for the added `AIContext` providers considering this as a valid fix. - Added UT covering the expected `Kernel` mutability. --------- Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
jcruzmot-te
pushed a commit
to thousandeyes/aia-semantic-kernel
that referenced
this pull request
Sep 15, 2025
### Motivation and Context Adding support for AI context behaviors to Semantic Kernel. These allow creating plugins that are able to listen to messages being added to the chat history and contribute to the AI context on each invocation. This PR also integrates support for these with Agents and AgentThreads. microsoft#10100 microsoft#10712 --------- Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com> Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
jcruzmot-te
pushed a commit
to thousandeyes/aia-semantic-kernel
that referenced
this pull request
Sep 15, 2025
…2538) ### Motivation and Context - Fixes microsoft#12534 - This regression seems to be part of microsoft#11689 where `kernel` instance was is cloned prior agent iterations, as I didn't captured any failing unit tests for the added `AIContext` providers considering this as a valid fix. - Added UT covering the expected `Kernel` mutability. --------- Co-authored-by: westey <164392973+westey-m@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
Adding support for AI context behaviors to Semantic Kernel.
These allow creating plugins that are able to listen to messages being added to the chat history and contribute to the AI context on each invocation. This PR also integrates support for these with Agents and AgentThreads.
#10100
#10712