Skip to content

TeamsAgentExtension using Teams SDK models and ApiClient#740

Open
tracyboehrer wants to merge 212 commits into
mainfrom
users/tracyboehrer/teams-api-int
Open

TeamsAgentExtension using Teams SDK models and ApiClient#740
tracyboehrer wants to merge 212 commits into
mainfrom
users/tracyboehrer/teams-api-int

Conversation

@tracyboehrer

@tracyboehrer tracyboehrer commented Mar 9, 2026

Copy link
Copy Markdown
Member

Fixes #774
Fixes #288
Fixes #177
Fixes #323

This is a breaking change for existing users of the TeamsAgentExtension. This would include both AgentApplication and TeamsActivityHandler based agents.

TLDR;

  • TeamsAgentExtension now uses the models and clients from Teams SDK. This eliminates almost all Teams related models and client code in Agents SDK.
  • Adds IRouteAttributes for Teams specific AgentApplication routes.
  • Adds new BotBuilder IRouteAttributes in a way consistent with the Teams version.
  • Adds a new AgentExtensionAttribute + Analyzer to automatically create and register an AgentExtension and make it available as a property on the AgentApplication subclass.

Details

  • A significant number of file changes are related to removed code
    • Removed Teams Extension models and related unit tests
    • Removed TeamsConnectorClient and related unit tests
    • Removed Microsoft.Agents.Extensions.Teams.AI
    • Removed existing Teams serialization converters
      • Had to modify DialogInstance.State to use a different type since the DictionaryOfObjectConverter conflicted with Teams serialization. That type was changed to PersistedState and the converter moved to Dialogs.
  • Using Teams SDK models in TeamsActivityHandler and TeamsAgentExtension
  • Adding Teams ApiClient to ITurnState.Services at beginning of turn
    • TeamsAgentExtension adds an OnBeforeTurn to set this
    • TeamsActivityHandler-based agents would require SetTeamsApiClientMiddleware
    • In either case, the ApiClient would be available from ITurnContext.Services within a handler and TeamsInfo gets the client internally.
    • Added extension for ITurnContext.GetTeamsApiClient
  • Added Teams Compat and AgentApplication samples
    • Ported Samples.MessageExtensions from Teams SDK for comparison purposes.
  • The following operations do not seem to be supported via Teams SDK and removed from Agents SDK
    • SendMeetingNotificationAsync
    • SendMessageToListOfUsersAsync
    • SendMessageToAllUsersInTenantAsync
    • SendMessageToAllUsersInTeamAsync
    • SendMessageToListOfChannelsAsync
    • GetOperationStateAsync
    • GetPagedFailedEntriesAsync
    • CancelOperationAsync
  • Targeted messages support
    • ITurnContext extensions: SendTargetedActivityAsync
    • Modified ConversationsRestClient to append query arg for targeted messages when needed
    • This relies on the ActivityTreatment Entity
  • Extensions to support conversion to/from key models
    • ChannelAccount
    • MessageReaction
    • Activity
    • ProtocolJsonSerializer.ToObject<T> will properly handle Teams SDK models
  • Added RouteBuilders for Teams routes. These can be used directly by the user via AgentApplication.AddRoute. They are used internally to implement the various route helper methods. ex. MessageExtensions.OnQuery uses the QueryRouteBuilder to add the route.
  • Added IRouteAttributes for all Teams route. Created matching AgentApplication versions for consistency.

Cross-SDK compatibility

  • Teams SDK 2.0.9, Agents SDK 1.7-beta
  • ReadReceipt Activity value does not appear to be defined. Previously this was ReadReceiptInfo in BF SDK and Agents SDK. Agents SDK retained this model for back-compat. This is used by TeamsAgentExtension and TeamsActivityHandler.
  • Teams ChannelData (aka TeamsChannelData) does not appear to contain information for Meeting as before
    • Reading this value from ChannelData.Properties

To resolve

  • The following models did not have a corresponding Teams SDK model and were retained for supporting functionality
    • MeetingParticipantsEventDetails - Activity.Value for application/vnd.microsoft.meetingParticipantJoin and application/vnd.microsoft.meetingParticipantLeave
    • ReadReceiptInfo - read receipt Activity.Value

Tracy Boehrer added 27 commits February 2, 2026 15:45
# Conflicts:
#	src/libraries/Extensions/Microsoft.Agents.Extensions.Teams/App/TeamsAgentExtension.cs
# Conflicts:
#	src/libraries/Extensions/Microsoft.Agents.Extensions.Teams/App/TeamsAgentExtension.cs
@github-actions github-actions Bot added ML: Samples Tags changes to samples ML: Core Tags changes to core libraries ML: Tests Tags changes to tests labels Mar 9, 2026
Tracy Boehrer and others added 4 commits June 1, 2026 09:13
…multi-dimensional arrays

- Add Array2DConverterTests exercising roundtrip of int[,], string[,], bool[,]
- Fix PersistedStateConverter.Write to skip SerializeJsonArray for rank > 1 arrays
  (prevents ArgumentException when a 2D array is stored in PersistedState)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	Directory.Packages.props
#	src/Microsoft.Agents.SDK.sln
# Conflicts:
#	CLAUDE.md
#	src/libraries/Extensions/Microsoft.Agents.Extensions.Teams/App/Builders/TeamsConversationUpdateRouteBuilder.cs
#	src/tests/Microsoft.Agents.Model.Tests/DictionaryOfObjectConverterTests.cs
@github-actions github-actions Bot added the Build: Automation Tags changes to Build Automation area label Jun 15, 2026
Tracy Boehrer and others added 25 commits June 15, 2026 16:11
TeamsTurnContext and ITeamsTurnContext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build: Automation Tags changes to Build Automation area ML: Core Tags changes to core libraries ML: Packages ML: Samples Tags changes to samples ML: Tests Tags changes to tests Teams This is related to Microsoft Teams

Projects

None yet

3 participants