Building and customizing solutions using Microsoft 365 Copilot APIs and tools
Teams messages can be added as a knowledge source for declarative agents, but the mechanism differs between Microsoft 365 Copilot “Agent Builder”/Agents Toolkit and Copilot Studio.
From the provided information, Teams messages are supported as a knowledge source for declarative agents via the TeamsMessages capability in the declarative agent manifest (or TypeSpec) and via the Knowledge configuration in Microsoft 365 Copilot/Agents Toolkit, not via Copilot Studio’s current knowledge source picker.
Key points from the documented behavior:
- Where Teams messages are supported as knowledge
- In Microsoft 365 Copilot “Agent Builder” (Configure → Knowledge → My Teams chats and meetings or specific chats).
- In declarative agents built with Microsoft 365 Agents Toolkit (VS Code / TypeSpec) by adding the
TeamsMessagescapability in the manifest or TypeSpec.
- How Teams messages are configured in declarative agents
- Manifest-based configuration (Agents Toolkit):
{ "capabilities": [ { "name": "TeamsMessages", "urls": [ { "url": "https://teams.microsoft.com/l/team/..." } ] } ] }- Using
TeamsMessageswithouturlsmakes all Teams channels, meetings, 1:1, and group chats available to the agent for the signed-in user. - Using
urlsscopes the agent to up to five specific Teams resources (channels, group/1:1 chats, or meeting chats).
- Using
- TypeSpec configuration (Agents Toolkit):
namespace MyAgent { op teamsMessages is AgentCapabilities.TeamsMessages<TeamsMessagesByUrl = [ { url: "https://teams.microsoft.com/l/team/...", } ]>; }- Omitting
TeamsMessagesByUrlhas the same effect as omittingurlsin the manifest: all accessible chats and meetings are available.
- Omitting
- Manifest-based configuration (Agents Toolkit):
- Getting correct Teams URLs for scoping
- Channel or team: use Get link to channel in Teams.
- Meeting: open the meeting → arrow next to Join → Copy join link.
- Group or 1:1 chat: must use a deep link with
chatId:- In Teams, go to a message in the chat →
...→ Copy link. - From the copied URL, extract the segment between
chat/and the next/(usually starts with19:). This is thechatId. - Build the deep link:
https://teams.microsoft.com/l/chat/<chatId>/conversations.
- In Teams, go to a message in the chat →
- These URLs are then used in the
urlsarray (manifest) orTeamsMessagesByUrl(TypeSpec).
- Licensing and access requirements
- Teams messages as a knowledge source require a Microsoft 365 Copilot license for the user.
- The agent can only retrieve Teams content that the signed-in user has permission to access.
- Why Copilot Studio behaves differently
- The documentation and examples for Teams messages as a knowledge source are tied to declarative agents in Microsoft 365 Copilot and Agents Toolkit, not Copilot Studio’s current knowledge configuration UI.
- Copilot Studio’s “Work IQ Teams (Preview)” tool is a separate capability that can query Teams, but it is explicitly in Preview, and its long-term behavior or GA path is not defined in the provided material.
- Recommended way forward based on the documented capabilities
- For a declarative agent that must reliably use Teams messages as knowledge:
- Build and configure the agent using Microsoft 365 Agents Toolkit (VS Code / TypeSpec) or the Agent Builder experience where
TeamsMessagesis officially supported. - Add the
TeamsMessagescapability in the manifest or TypeSpec, and scope it with the appropriate Teams URLs or omit URLs to use all accessible chats. - Ensure all intended users have the required Microsoft 365 Copilot license and Teams permissions.
- Build and configure the agent using Microsoft 365 Agents Toolkit (VS Code / TypeSpec) or the Agent Builder experience where
- Copilot Studio can still be used for other knowledge sources (SharePoint, connectors, etc.), but for Teams messages, the supported path in the documentation is via declarative agents + Agents Toolkit/Agent Builder, not via Copilot Studio’s knowledge picker.
- For a declarative agent that must reliably use Teams messages as knowledge:
Given the documentation, relying on TeamsMessages in the declarative agent manifest/TypeSpec is the supported and forward-compatible approach. The “Work IQ Teams (Preview)” tool can be used experimentally, but for production scenarios and predictable behavior, configuring Teams messages via the declarative agent capabilities is the recommended path.
References:
- Add knowledge sources to your declarative agent
- Add knowledge sources to a declarative agent created with Microsoft 365 Agents Toolkit
- Create declarative agents using Microsoft 365 Agents Toolkit and TypeSpec
- Add knowledge sources to your declarative agent in Microsoft 365 Copilot
- Best practices for building declarative agents