Documentation - v1.6.0-beta.24
    Preparing search index...

    Documentation - v1.6.0-beta.24

    Microsoft 365 Agents SDK - NodeJS /TypeScript

    Build Status NPM Downloads

    The Microsoft 365 Agent SDK simplifies building full stack, multichannel, trusted agents for platforms including M365, Teams, Copilot Studio, and Webchat. We also offer integrations with 3rd 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 responses, and collaborate with other agents.

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

    For more information please see the parent project information here Microsoft 365 Agents SDK

    The best to way to get started with these packages is to look at the samples available in https://github.com/microsoft/Agents

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

    Package Name NPM Version Description Replaces
    @microsoft/agents-activity npm Types and validators implementing the Activity protocol spec. botframework-schema
    @microsoft/agents-hosting npm Provides classes to host an Agent in express. botbuilder
    @microsoft/agents-hosting-extensions-teams npm Teams specific features, such as TaskModules and Messaging Extensions. botbuilder
    @microsoft/agents-hosting-express npm Configures express to run the Agent. N/A
    @microsoft/agents-hosting-dialogs npm Provides classes to host an Agent in express. botbuilder-dialogs
    @microsoft/agents-hosting-storage-blob npm Extension to use Azure Blob as storage. botbuilder-azure
    @microsoft/agents-hosting-storage-cosmos npm Extension to use CosmosDB as storage. botbuilder-azure

    Additionally we provide a Copilot Studio Client, to interact with Agents created in CopilotStudio

    Package Name NPM Version Description
    @microsoft/agents-copilotstudio-client npm Direct to Engine client to interact with Agents created in CopilotStudio

    Each package also has a nightly build, available via the @next tag on NPM. The nightly build contains the code from our main branch and may contain features that are still in development.

    The packages require Node.js 20 or greater, and can be used from JavaScript using CommonJS or ES6 modules, or from TypeScript.

    Note: We are using node 24 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.

    The packages include the source code in the src, along with the sourcemaps in the dist/src folder to allow VSCode to debug the typescript files.

    The packages use the debug library. Set the DEBUG environment variable to enable logging for specific subsystems.

    Each namespace in the tables below ends with :* to enable all log levels for that prefix.

    DEBUG filter What it logs
    agents:authorization:connections:* Auth connections loaded at startup (clientId, tenantId, authType); which connection is selected per request
    agents:authorization:manager:* Auth handlers configured at startup (type, scopes); which handler is invoked per request
    agents:authorization:azurebot:* Azure Bot sign-in flow detail (token exchange, magic code, SSO)
    agents:authorization:agentic:* Agentic auth flow detail (token acquisition, OBO)
    agents:authorization:* High-level authorization middleware decisions
    agents:msal:* MSAL token acquisition (token requests, cache hits, OBO)
    agents:jwt-middleware:* Incoming JWT validation
    agents:authConfiguration:* Auth configuration loading
    DEBUG filter What it logs
    agents:cloud-adapter:* Incoming request processing, activity dispatch
    agents:base-adapter:* Base adapter lifecycle
    agents:connector-client:* Outbound calls to the Bot Connector service
    agents:user-token-client:* User token client requests
    DEBUG filter What it logs
    agents:app:* AgentApplication routing and lifecycle
    agents:activity-handler:* ActivityHandler event dispatch
    agents:state:* State read/write operations
    agents:turnState:* Turn state access
    agents:memory-storage:* MemoryStorage read/write
    agents:middleware:* Middleware pipeline execution
    agents:proactive:* Proactive message sending to conversations
    agents:conversation-reference-builder:* Building and validating conversation references
    DEBUG filter What it logs
    agents:streamingResponse:* Streaming response lifecycle
    agents:attachmentDownloader:* Attachment download requests
    agents:M365AttachmentDownloader:* M365-specific attachment downloads
    agents:file-transcript-logger:* File transcript write operations
    agents:rest-client:* REST client calls (transcript middleware)
    DEBUG filter What it logs
    agents:agent-client:* Outbound agent client calls and response handling
    # Show all auth and connection logs
    DEBUG=agents:authorization:* node index.js

    # Show everything
    DEBUG=agents:* node index.js

    # Show auth connections + MSAL
    DEBUG=agents:authorization:connections:*,agents:msal:* node index.js

    We are using eslint configured with neostandard

    This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

    When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

    This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

    This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.