AI content labels

Teams offers three kinds of labels that your agent can apply to its messages to help users understand their contexts:

  • A standardized AI Generated label clearly marks the message as a product of AI.
  • Citations enable agents to direct users to information sources used to create their messages.
  • Sensitivity labels enable users to understand the confidentiality of the agent message.

Note

AI content labels are available for agents in personal chats, group chats, and channels. They are available in Government Community Cloud (GCC), GCC High, and Department of Defense (DoD) environments.

AI Generated label

Call AddAIGenerated() on a message activity before sending it to display a platform-standard AI Generated label next to the agent's name in the message header. Hovering over the label displays the tooltip AI-generated content may be incorrect..

async Task SendAILabel(IContext context)
{
    await context.Send(new MessageActivity
    {
        Text = "Hi, this message is generated by AI"
    }.AddAIGenerated());
}

Call add_ai_generated() on a message activity before sending it to display a platform-standard AI Generated label next to the agent's name in the message header. Hovering over the label displays the tooltip AI-generated content may be incorrect..

@app.on_message
async def add_ai_label(ctx: ActivityContext[MessageActivity]):
    await ctx.send(
        MessageActivityInput(
            text="Hi, this message is generated by AI",
        ).add_ai_generated()
    )

Call addAiGenerated() on a message activity before sending it to display a platform-standard AI Generated label next to the agent's name in the message header. Hovering over the label displays the tooltip AI-generated content may be incorrect..

app.message(async ({ send }) => {
  await send(new MessageActivity("Hi, this message is generated by AI").addAiGenerated());
});

Citations

Citing sources in agent messages helps users ask follow-up questions or conduct independent research. Cite data sources like files, messages, emails, and work items to provide valuable insights. Citations are crucial for agents using techniques like Retrieval-Augmented Generation (RAG).

Citations

Screenshot shows an AI-powered agent response with citations in the Teams desktop client.

Modal window

Screenshot shows a modal window pop-up from a citation in an AI-powered agent message in the Teams desktop client.

Citations in your agent's messages can include the following:

  • In-text citations denote the citation numbers added to the agent message in the [#] format, each corresponding to a reference. A citation can be inserted anywhere within the text.
  • Details of the citation reference include the title, icon, keywords, abstract, hyperlink, sensitivity information, and a button to open a modal window with additional content. References appear as pop-up windows for each in-text citation.
  • Sensitivity labels to citations indicate the confidentiality of the citation content referenced and aren't added automatically.
  • Modal window with additional content renders an Adaptive Card without any interactive items.

Note

  • A maximum of 20 citations are displayed in a message.
  • Citations with Adaptive Cards are available in public developer preview.
  • Adaptive Cards aren't rendered in the citation pop-up window. However, Adaptive Cards can be rendered in the agent's message or in the citation's modal window accessible from the pop-up window.

Add citations

Use addCitation() to include in-text references and citation metadata in your message.

app.message(/citation/i, async ({ send }) => {
  const card = new AdaptiveCard(new TextBlock("Adaptive Card text"))
    .withOptions({ version: "1.6" });
  const appearance: CitationAppearance = {
    name: "AI messages agent",
    url: "https://example.com/claim-1",
    abstract: "Excerpt description",
    text: JSON.stringify(card),
    keywords: ["keyword 1", "keyword 2", "keyword 3"],
    icon: "Microsoft Word",
  };
  await send(
    new MessageActivity("Hey I'm a friendly AI agent. This message is generated through AI [1]")
      .addCitation(1, appearance)
  );
});

Use add_citation() to include in-text references and citation metadata in your message.

@app.on_message_pattern(re.compile(r"citation", re.IGNORECASE))
async def add_citations(ctx: ActivityContext[MessageActivity]):
    await ctx.send(
        MessageActivityInput(
            text="Hey I'm a friendly AI agent. This message is generated through AI [1]",
        ).add_citation(
            position=1,
            appearance=CitationAppearance(
                name="AI messages agent",
                url="https://example.com/claim-1",
                abstract="Excerpt description",
                text=AdaptiveCard(version="1.6", body=[TextBlock(text="Adaptive Card text")]).model_dump_json(by_alias=True, exclude_none=True),
                keywords=["keyword 1", "keyword 2", "keyword 3"],
                icon=CitationIconName.MICROSOFT_WORD,
            ),
        )
    )

Use AddCitation() to include in-text references and citation metadata in your message.

async Task SendCitations(IContext context)
{
    var message = new MessageActivity
    {
        Text = "Hey I'm a friendly AI agent. This message is generated through AI [1]"
    };

    message.AddCitation(1, new CitationAppearance
    {
        Name = "AI messages agent",
        Url = "https://example.com/claim-1",
        Abstract = "Excerpt description",
        Keywords = new List<string> { "keyword 1", "keyword 2", "keyword 3" },
        Icon = CitationIcon.MicrosoftWord
    });

    await context.Send(message);
}
Property Type Required Description
citation Object ✔️ Details of the citation.
citation.@type String ✔️ Object of the citation.
Allowed value: Claim
citation.position Integer ✔️ Displays the citation number. This value must be unique for every citation.
citation.appearance Object ✔️ Information about the appearance of the citation.
citation.appearance.@type String ✔️ Object of the citation appearance.
Allowed value: DigitalDocument
citation.appearance.name String ✔️ Title of the referenced content. Maximum characters: 80
citation.appearance.url String URL of the referenced content.
citation.appearance.abstract String An abstract of the referenced content. Maximum characters: 160
citation.appearance.text String A stringified Adaptive Card with additional information about the citation. It renders within the modal window accessible from the pop-up window.
citation.appearance.keywords Array Keywords from the referenced content. You can't add more than three keywords. Each keyword can only contain 28 characters.
citation.appearance.encodingFormat String The encoding format of the citation.appearance.text field.
Allowed value: application/vnd.microsoft.card.adaptive
citation.appearance.image Object Information about the citation's icon.
citation.appearance.image.@type String ✔️ The object of the citation icon. Must be ImageObject.
citation.appearance.image.name String ✔️ The name of the predefined icon. It renders the citation icon in the details of the citation reference.
Allowed values: Microsoft Word, Microsoft Excel, Microsoft PowerPoint, Microsoft OneNote, Microsoft SharePoint, Microsoft Visio, Microsoft Loop, Microsoft Whiteboard, Source Code, Sketch, Adobe Illustrator, Adobe Photoshop, Adobe InDesign, Adobe Flash, Image, GIF, Video, Sound, ZIP, Text, PDF

After you enable citations, the agent message includes in-text citations and references. The in-text citations display the reference details when users hover over the citation.

Error handling

Error code Description
400 Multiple root message entities found under entities array.
400 Error parsing message entity from entities array.
400 Agent message with more than 20 citations.
400 The appearance object is empty.
400 Error while parsing citation entity with ID: X.

Sensitivity label

Agent messages might contain confidential information or be accessible only to certain individuals within the organization. Use sensitivity labels to mark these message with Microsoft Purview labels, helping users understand the sensitivity of a message and enabling them to exercise caution when sharing it.

Labels must be configured in Microsoft Purview before they can be used. Add a message-level label with addSensitivityLabel, passing the Purview label ID as '@id', which is sent to Teams as @id. Calling it again replaces the previous label. To label an individual source, set usageInfo on the citation appearance.

const labelId = '<purview-label-id>';

const reply = new MessageActivityInput('Here is the quarterly summary [1].')
  .addSensitivityLabel({ '@id': labelId, name: 'Confidential' })
  .addCitation(1, {
    name: 'Quarterly report',
    abstract: 'Revenue and forecast for the quarter.',
    usageInfo: { '@id': labelId, name: 'Confidential' },
  });
  • name is optional but recommended. Teams shows it when it cannot resolve @id, for example for a deleted label, and shows no label at all if there is no name either. Set it whenever you set description, because Teams can reject a message whose label has a description but no name.
  • The sensitivity label, the AI-generated label, and citations are all written to the same root message entity, so an activity always carries exactly one root message entity, regardless of the order you call them in.

Labels must be configured in Microsoft Purview before they can be used. Add a message-level label with add_sensitivity_label, passing the Purview label ID as at_id, which is sent to Teams as @id. Calling it again replaces the previous label. To label an individual source, set usage_info on the citation appearance.

from microsoft_teams.api import CitationAppearance, MessageActivityInput, SensitivityUsageInfo

label_id = "<purview-label-id>"

reply = (
    MessageActivityInput(text="Here is the quarterly summary [1].")
    .add_sensitivity_label(SensitivityUsageInfo(at_id=label_id, name="Confidential"))
    .add_citation(
        position=1,
        appearance=CitationAppearance(
            name="Quarterly report",
            abstract="Revenue and forecast for the quarter.",
            usage_info=SensitivityUsageInfo(at_id=label_id, name="Confidential"),
        ),
    )
)
  • name is optional but recommended. Teams shows it when it cannot resolve @id, for example for a deleted label, and shows no label at all if there is no name either. Set it whenever you set description, because Teams can reject a message whose label has a description but no name.
  • The sensitivity label, the AI-generated label, and citations are all written to the same root message entity, so an activity always carries exactly one root message entity, regardless of the order you call them in.

Labels must be configured in Microsoft Purview before they can be used. Add a message-level label with AddSensitivityLabel, passing the Purview label ID as Id, which is sent to Teams as @id. Calling it again replaces the previous label. To label an individual source, set SensitivityUsageInfo on the citation appearance.

string labelId = "<purview-label-id>";

MessageActivityInput reply = new MessageActivityInput()
    .WithText("Here is the quarterly summary [1].")
    .AddSensitivityLabel(new SensitivityUsageInfo { Id = labelId, Name = "Confidential" })
    .AddCitation(1, new CitationAppearance
    {
        Name = "Quarterly report",
        Abstract = "Revenue and forecast for the quarter.",
        SensitivityUsageInfo = new SensitivityUsageInfo { Id = labelId, Name = "Confidential" }
    });
  • Name is optional but recommended. Teams shows it when it cannot resolve @id, for example for a deleted label, and shows no label at all if there is no Name either. Set it whenever you set Description, because Teams can reject a message whose label has a description but no name.
  • The sensitivity label, the AI-generated label, and citations are all written to the same root message entity, so an activity always carries exactly one root message entity, regardless of the order you call them in.

Code sample

Sample Name Description Node.js .NET Python
Teams conversation agent This sample app displays AI labels, citations, and sensitivity labels in messages. View View View

See also