Quickstart: Create and test a basic agent (preview)
[This article is prerelease documentation and is subject to change.]
This article describes how to build your first agent with the Microsoft 365 Agents SDK for C#. It also describes how to test your agent locally with the Bot Framework Emulator.
Note
You might see both agent and bot used in the documentation. Bot is the legacy term. An agent is what you build with the Microsoft 365 Agents SDK.
To create your first agent with the Microsoft 365 Agents SDK, you don't need an Azure subscription or Azure Bot Service (ABS) resource. This quickstart focuses on creating and testing your first agent locally. When you get beyond initial exploration, we recommend you try other methods such as dev tunnels. You can learn more about testing in Test your agent.
Note
The Microsoft 365 Agents SDK is currently in Public Preview supporting C# only. Support for Python and node.js is coming soon.
This example and template do not support authentication of either incoming or outgoing communication. The example simply echoes the user's input message in the emulator to display the two-way communication and to help developers started with the SDK. It is not intended for use in production scenarios.
Prerequisites
- .NET 8.0 SDK
- Bot Framework Emulator
- Knowledge of ASP.NET Core and asynchronous programming in C#
- Echobot agent sample downloaded from GitHub
Perform the following steps in Visual Studio or Visual Studio Code / CLI to create a new agent using the Echobot agent sample.
Download sample files
Download the Echobot agent sample from the Agents-for-net GitHub repo. The Echobot agent sample is in the /echobot subfolder. The sample has all the files you need to configure an Echobot agent.
Start your agent
- Open the solution file, EchoBot.sln, from the Echobot agent sample folder in Visual Studio.
- Run the project without debugging. You can use Ctrl+F5 or select Start Without Debugging from the Debug menu.
- Visual Studio builds the application, deploys it to localhost, opens an application page in a browser. The application page should be blank, with some text. You should also see a Windows Terminal window open with messages indicating that the application is running.
At this point, your agent is running locally on the port specified in the terminal window (53083, by default).
Test your agent locally
You can now test your agent locally using Bot Framework Emulator:
- Open Bot Framework Emulator.
- Ensure you have your code open and select Run without debugging.
- Select Open Bot.
- For Bot URL, enter the address http://localhost:53083/api/messages.
- Select Connect.
Your agent opens and you can now enter a message. The code you built is running and echoes back the messages you send to the agent.
Summary
The Echobot agent sample is built and runs locally. To learn more about the sample see Structure of an Echobot agent.