Skip to content

.Net: Add StateExtensions ADR, Abstractions, update AgentThread and add Unit tests. #11632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: feature-conversation-state-extensions
Choose a base branch
from

Conversation

westey-m
Copy link
Contributor

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

@westey-m westey-m requested a review from a team as a code owner April 17, 2025 16:25
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core documentation labels Apr 17, 2025
@github-actions github-actions bot changed the title Add StateExtensions ADR, Abstractions, update AgentThread and add Unit tests. .Net: Add StateExtensions ADR, Abstractions, update AgentThread and add Unit tests. Apr 17, 2025
/// Extension methods for <see cref="ConversationStateExtensionsManager"/>.
/// </summary>
[Experimental("SKEXP0001")]
public static class ConversationStateExtensionsManagerExtensions

Choose a reason for hiding this comment

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

Naming needs so work, using Extensions twice in the same name seems like a bad code smell

/// the AI model in use just before invocation.
/// </remarks>
[Experimental("SKEXP0001")]
public abstract class ConversationStateExtension

Choose a reason for hiding this comment

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

Do we need Extension in the name?

/// Gets or sets the container for conversation state extension components that manages their lifecycle and interactions.
/// </summary>
[Experimental("SKEXP0110")]
public virtual ConversationStateExtensionsManager StateExtensions { get; init; } = new ConversationStateExtensionsManager();
Copy link
Member

Choose a reason for hiding this comment

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

The property seems a little bit broad in meaning and might be a limiting factor later when there is a need to add another type of state extension. A narrower name could be ConversationStateExtensions.

I am also entertaining the idea that the concept of context might be a better alternative here instead of state. It seems that context is something more flexible and fluid compared to state. The context can eventually be saved as a state or might not.

Another idea is to not use either context or state, and instead have just extensions and an extensions manager. This way, it will be up to the specific implementation of an extension to decide how to handle the On* methods calls: whether to persist messages to the state, send them for analysis, telemetry, fact extraction, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants