Migrating from Teams AI v1
Welcome, fellow agent developer! You've made it through a full major release of Teams AI, and now you want to take the plunge into v2. In this guide, we'll walk you through everything you need to know, from migrating core features like message handlers and auth, to optional AI features.
Installing Teams AI v2โ
First, let's install Teams AI v2 into your project. Notably, this won't replace any existing installation of Teams AI v1. When you've completed your migration, you can safely remove the teams-ai
dependency from your pyproject.toml
file.
uv add microsoft-teams-apps
Migrate Application classโ
First, migrate your Application
class from v1 to the new App
class.
Teams AI v1 | Teams AI v2 |
|
|
Migrate activity handlersโ
Both Teams AI v1 and v2 are built atop incoming Activity
requests, which trigger handlers in your code when specific type of activities are received. The syntax for how you register different types of Activity
handlers differs slightly between the v1 and v2 versions of our SDK.
Message handlersโ
Teams AI v1 | Teams AI v2 |
|
|
Task modulesโ
Note that on Microsoft Teams, task modules have been renamed to dialogs.
Teams AI v1 | Teams AI v2 |
|
|
Learn more here.
Adaptive cardsโ
In Teams AI v2, cards have much more rich type validation than existed in v1. However, assuming your cards were valid, it should be easy to migrate to v2.
Teams AI v1 | Teams AI v2 (Option 1) | Teams AI v2 (Option 2) |
| For existing cards like this, the simplest way to convert that to Teams AI v2 is this:
| For a more thorough port, you could also do the following:
|
Learn more here.
Authenticationโ
Most agents feature authentication for user identification, interacting with APIs, etc. Whether your Teams AI v1 app used Entra SSO or custom OAuth, porting to v2 should be simple.
Teams AI v1 | Teams AI v2 |
|
|
AIโ
Feedbackโ
If you supported feedback for AI generated messages, migrating is simple.
Teams AI v1 | Teams AI v2 |
|
Note: In Teams AI v2, you do not need to opt into feedback at the |
You can learn more about feedback in Teams AI v2 here.