Freigeben über


Building agents with Agents SDK (preview)

[This article is prerelease documentation and is subject to change.]

This article goes into more detail about how agents in Agents SDK work and how to build them.

What is an agent?

In the past, conversational AI primarily answered frequently asked questions from employees or customers using natural language understanding (NLU) technology. NLU can understand, interpret, and direct logic to generate the right responses based on the identified utterance or intent.

Now, generative AI provides a quicker and simpler way to respond to questions using large language models. Generative AI generates outputs based on the input to the model and the nature of the underlying foundation model. You can tailor the output of generative AI through fine-tuning and prompt engineering.

This experience is illustrated in Microsoft 365 Copilot. Supported with business data via Microsoft Graph or internet sources, Microsoft 365 Copilot generates grounded answers to a user’s questions. Organizations can create copilot agents that extend the behavior and functionality of Microsoft 365 Copilot using the embedded builder or Microsoft Copilot Studio, or create standalone agents.

There are various routes to creating a standalone agent. One option is the Agents SDK.

The Agents SDK provides the scaffolding required to manage communication (typically via messages), channel management, and deployment capabilities using the activity protocol.

What is the activity protocol?

The activity protocol allows for agent logic and middleware logic to run agnostic to the channel it exists on. The protocol brokers communications and translates messages to a common set of libraries. Events and messages are routed to where they need to go, at the right time. For more information about the activity protocol, see How an agent works in the Microsoft 365 Agents SDK.

Agents SDK components

Agents built with the Agents SDK make use of several components:

  • Agents SDK for developing agents in C#
  • Bot Connector Service, which relays messages and events between agents and channels
  • Azure resources for agent management and configuration

Additionally, agents can use other Azure services, such as:

  • Azure AI services to build intelligent applications
  • Azure Storage for cloud storage solution

Add AI services to your agent with the Agents SDK

You can add AI services to your agent, such as Semantic Kernel and Azure OpenAI API. The Agents SDK provides samples to follow.

How to build an agent with the Agents SDK

You can start using the Agents SDK in C#. Python and Node.js support is coming soon. Start developing using Visual Studio or Visual Studio Code.

Plan your middleware and agent logic

Having a thorough understanding of goals, processes, and user needs helps you create a successful agent. You can create a basic agent or add more sophisticated capabilities such as speech, natural language understanding, and question answering using the services of your choosing.

Get started building with the Agents SDK

You can get started with the core files using the Agents SDK samples, which demonstrate the SDK's capabilities. For more information about creating and testing an agent, see Create and test a basic agent.

With Azure AI Bot Service and the Agents SDK, you can use other libraries and services to extend your agent's functionality.

Test your agent

Once you plan and build your agent, test it out. Initially, you can test locally, and then test it out in the planned channel of choice.

Agents can have many different parts working together. Before publishing, test your agent. We provide the following ways to test agents before they're released for use:

  • Unauthenticated testing using the Bot Framework Emulator.
  • Authenticated local testing using Dev Tunnels.
  • Test your agent in the chosen channel in a developer environment.

For more information about testing, see Test your agent. Once configured through the Azure portal, your agent can also be reached through a web chat interface. The web chat interface is a great way to grant access to your agent to testers and other people who don't have direct access to the agent's running code.

Connect to a channel to publish

Connect your agent to channels, such as Facebook, Messenger, Slack, Microsoft Teams, Telegram, and Short Messaging Service (SMS) via Twilio. The Agents SDK does most of the work necessary to send and receive messages from the different platforms. Your agent application receives a unified, normalized stream of messages regardless of how many channels you're connected to and what types.

Evaluate

Use the data collected in the Azure portal to identify opportunities to improve the capabilities and performance of your agent. You can get service-level and instrumentation data like traffic, latency, and integrations. Analytics also provides conversation-level reporting on user, message, and channel data.