Edit

Share via


Debug in Teams desktop client

Microsoft 365 Agents Toolkit (previously known as Teams Toolkit) helps you to debug and preview your Microsoft Teams app in desktop client. During the debug process, Agents Toolkit automatically starts app services, opens debuggers, and uploads Teams app. You can preview your Teams app in Teams desktop client after debugging.

The following are the advantages of Teams desktop client:

  • Improves performance.
  • Reduces time-to-F5.
  • Improves coverage of debug targets.

Capabilities of Teams desktop client

Teams desktop client incorporates debugging capabilities in the following app templates scaffolded by Agents Toolkit:

  • Bot.
  • Agent.
  • Custom engine agent.
  • Message extension.

Prerequisites

Ensure you install the following tools for building and deploying your app in Teams desktop client:

  Install For using...
  Microsoft 365 Agents Toolkit A Microsoft Visual Studio Code extension that creates a project scaffolding for your app. Use the latest prerelease version.
  Node.js Back-end JavaScript runtime environment. For more information, see node.js version compatibility table for project type.
  Visual Studio Code JavaScript, TypeScript, or SharePoint Framework (SPFx) build environments. Use the latest version.
  Microsoft 365 developer account Access to Teams account with the appropriate permissions to install an app.

Debug in Teams desktop client

To debug your custom engine agent app in Teams desktop client

  1. Open Visual Studio Code (VS Code) and log into your Microsoft 365 account through Agents Toolkit.

  2. Select the Agents Toolkit icon in the VS Code Activity Bar and then select Create a New Agent/App.

    Screenshot shows the ___location of the Create New Project link in the Teams Toolkit sidebar.

  3. Select Custom Engine Agent.

    Screenshot shows the Teams Toolkit app templates.

  4. Select Basic Custom Engine Agent.

    Screenshot shows the app capabilities to add to your new app.

  5. Select JavaScript.

    Screenshot shows the option to select the programming language.

  6. Select OpenAI.

    Screenshot shows LLM in Visual Studio Code.

  7. Enter the OpenAI service key.

    Screenshot shows to enter openai service key in Visual Studio Code.

  8. Select JavaScript.

    Screenshot shows the option to select the programming language.

  9. Select Default folder.

    Screenshot shows the selection of default ___location.

    To change the default ___location, follow these steps:

    1. Select Browse.

      Screenshot shows the option to browse and select the ___location.

    2. Select the ___location for the project workspace.

    3. Select Select Folder.

      Screenshot shows the folder to select.

  10. Enter a suitable name for your app and then select the Enter key.

    Screenshot shows where to enter the app name.

  11. From the left pane, select Run and Debug (Ctrl+Shift+D) and select Debug in Teams (Desktop) from the dropdown list.

    Screenshot shows the option to select debug in Teams (Desktop).

  12. Ensure your Teams desktop login matches your Microsoft 365 account used in Agents Toolkit and then select Continue.

    Screenshot shows the desktop login.

    Teams desktop client requests to add your app.

  13. Select Add.

    Screenshot shows the add button to add the app to Teams desktop client.

    A chat window opens.

  14. From the message compose area, send a message to invoke the bot.

    Screenshot shows the app added to Teams desktop client.

    Note

    The system level notification for account matching appears only once per project. In subsequent debug sessions, Agents Toolkit sends reminders about the account through VS Code notifications.

    Screenshot shows the subsequent desktop login notification in vs code.

  15. You can add breakpoints and hot reload your changes. In the following example, the breakpoint is highlighted with the red dot next to the row number.

    Screenshot shows an example of the breakpoints in app.

    Screenshot shows an example after hot reload of an app.

You can continue to debug your custom engine agent app in Teams desktop client.

See also