Share via


Microsoft 365 Agents SDK JavaScript reference

Version 1.0.0

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

Name Description Location
Empty Agent Simplest agent basic/empty-agent/nodejs
AI: Weather Agent WeatherAgent with LangChain tools basic/weather-agent/nodejs
AI: Poem Agent Agent calling OpenAI with Vercel AI basic/azureai-streaming-poem-agent
Auth: Auto Signin Shows how to apply auth handlers to routes to integrate with ABS OAuth connections basic/authorization/auto-signin
Auth: On Behalf Of (OBO) Shows how to request a token on behalf of basic/authorization/auto-signin
Copilot Studio Client Consume Copilot Studio Agent from a console basic/authorization/obo-authorization
Copilot Studio WebClient Consume Copilot Studio Agent from WebChat basic/copilotstudio-webclient
Copilot Studio WebClient React Consume Copilot Studio Agent from WebChat with React basic/copilotstudio-webchat-react
Copilot Studio Skill Call the empty agent from a Copilot Studio skill complex/copilotstudio-skill/nodejs

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.