Share via


Microsoft 365 Agents SDK JavaScript reference

Version 1.0.13

The Microsoft 365 Agent SDK simplifies building full stack, multichannel, trusted agents for platforms including Microsoft 365, Teams, Copilot Studio, and Web chat. We also offer integrations with third parties such as Facebook Messenger, Slack, or Twilio. The SDK provides developers with the building blocks to create agents that handle user interactions, orchestrate requests, reason about responses, and collaborate with other agents.

The Agents SDK is a comprehensive framework for building enterprise-grade agents, enabling developers to integrate components from the Azure AI Foundry SDK, Semantic Kernel, and AI components from other vendors.

For more information, see the Microsoft 365 Agents SDK documentation.

Getting started

Sample code is a great way to get started. Look at these samples located at https://github.com/microsoft/Agents/samples/nodejs

Name Description Location
QuickStart/Empty Agent Simplest agent samples/nodejs/quickstart
AutoSignIn Simple OAuth agent using Graph samples/nodejs/auto-signin
OBOAuthorization OBO to Copilot Studio Agent samples/nodejs/obo-authorization
Integrate LangChain WeatherAgent with LangChain samples/nodejs/langchain-multiturn
Streaming Agent Streams OpenAI responses samples/nodejs/azure-ai-streaming
Copilot Studio Client Console app to consume a Copilot Studio Agent samples/nodejs/copilotstudio-client
Copilot Studio Client - React Webchat App to consume a Copilot Studio Agent integrated with a Webchat Client samples/nodejs/copilotstudio-webchat-react
Copilot Studio Webclient Webclient for Copilot Studio integration samples/nodejs/copilotstudio-webclient
Cards Agent Agent that uses rich cards to enhance conversation design samples/nodejs/cards
Multi-turn Prompt Multi-turn dialog flow using prompts and state management samples/nodejs/multi-turn-prompt
Copilot Studio Skill Call the echo bot from a Copilot Studio skill samples/nodejs/copilotstudio-skill

Packages Overview

We offer the following NPM packages to create conversational experiences based on agents:

Package Description
@microsoft/agents-activity Types and validators implementing the Activity protocol spec.
@microsoft/agents-copilotstudio-client Direct to Engine client to interact with Agents created in Copilot Studio.
@microsoft/agents-hosting Provides classes to implement and host agents.
@microsoft/agents-hosting-express Provides a startServer method to host an agent in express.
@microsoft/agents-hosting-dialogs Provides classes to host an Agent in express.
@microsoft/agents-hosting-storage-blob Extension to use Azure Blob as storage.
@microsoft/agents-hosting-storage-cosmos Extension to use Cosmos DB as storage.

Environment requirements

The packages should target node20 or greater, and can be used from JavaScript using CommonJS or ES6 modules, or from TypeScript.

Note

We're using node 22 to be able to initialize the process from a .env file without adding the dependency to dotenv by using the --env-file flag. Previous node versions should set the env vars explicitly before running.