Edit

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. To add sensitivity labels for citations, see add sensitivity label.
  • 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

If you're using Teams SDK to build your agent, Use addCitation() to include in-text references and citation metadata in your message. Following is an example code snippet:

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)
  );
});
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 responses might contain confidential information or be accessible only to certain individuals within the organization. Add a sensitivity label to help users identify the confidentiality of a message, enabling them to exercise caution when sharing it.

Note

Add a sensitivity label to your agent's messages only when they contain sensitive information.

Add sensitivity label

For agents built using Teams SDK, add a sensitivity label to your agent message by modifying the message to include usageInfo in the entities object.

The following code snippet shows how to add sensitivity labels to both agent messages and citation reference:

await context.sendActivity({
  type: ActivityTypes.Message,
  text: `Hey, I'm a friendly AI agent. This message is generated through AI [1]`,
  entities: [
    {
      type: "https://schema.org/Message",
      "@type": "Message",
      "@context": "https://schema.org",
      usageInfo: {
        "@type": "CreativeWork",
        name: "Sensitivity title",
        description: "Sensitivity description",
      },
    },
  ],
});
Property Type Required Description
usageInfo.@type String ✔️ Enables the sensitivity label in the agent message.
citation.usageInfo.@id String ✔️ Enables the sensitivity label in the citation reference. It's required when adding sensitivity label to citation reference.
usageInfo.name String ✔️ Specifies the title of the sensitivity label.
usageInfo.description String Specifies the pop-up window message that appears when a user hovers over the sensitivity label.

After you add the sensitivity label, your agent message displays a shield icon. Users can hover over the icon to see a disclaimer about the message's sensitivity.

Error handling

Error code Description
400 Multiple root message entities found under entities array.
400 Error parsing message entity from entities array.
400 Citation level usageInfo.@id value doesn't match the message level usageInfo.@id in at least one instance.
400 There are multiple citation-level usageInfo properties with the same @id, but their name and description properties are different.

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