Share via


Test your agent locally in Agents Playground

The details of how to test your agent locally depend on how you created your agent.

You can create an agent using the Microsoft 365 Agents SDK in three ways:

  • Start with the Microsoft 365 Agents Toolkit in C#, JS, or Python using Visual Studio or Visual Studio Code
  • Clone from a sample and open in your IDE
  • Use the CLI, as shown in the quickstart

Using the Agents Playground

You started your project with the toolkit

If you start with the toolkit, you have everything set up to test using the Agents Playground straight away. You can test in the Agents Playground either locally, or in Microsoft 365 Copilot or Microsoft Teams. This scenario is covered in the Visual Studio Code walkthrough and the Visual Studio walkthrough, respectively.

You started your project by cloning or CLI

If you start your project using the CLI or by cloning a sample and opening the sample in your IDE, you can use the local Agents Playground to test. The Agents Playground connects to your local code.

  1. Once your quickstart agent is created or a sample is cloned from the repo, you can use it with the test tool from the Agents Toolkit.

  2. Make sure you download and install Agents Toolkit before beginning on Visual Studio or Visual Studio Code

  3. Ensure you have your config settings in the right project folder and that they're referenced in your agent to be used when the app is built.

    For example, in .NET:

    var config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
    
  4. Configure your ports correctly in your app. For example, currently, port must be 3978, the port the local test app tool is listening on.

  5. Your configuration settings need to be configured with the Connections and ConnectionsMap set with a valid client ID and secret, app ID, and tenant.

  6. Run your code.

  7. Open the test tool. It should open as seen in the following image. You can ask questions and test your agent.

    Teams App Test Tool

Wherever possible, we recommend that you start with the Microsoft 365 Agents Toolkit. The toolkit makes getting started, testing locally, and deploying easier and quicker. It abstracts much the manual setup of the Azure Bot Service and Azure App Registrations so you don't have to. By starting manually, you must perform these manual steps yourself.

Summary

You have successfully tested your Microsoft 365 Agents SDK locally using the Agents Playground when starting with a cloned sample from the GitHub repo or from the CLI.