@microsoft/agents-activity package
Classes
| Activity |
Represents an activity in a conversation. |
| ExceptionHelper |
Helper class for generating exceptions with error codes. |
Interfaces
| AIEntity |
Represents a generic Entity. |
| AdaptiveCardInvokeAction |
Represents an adaptive card invoke action. |
| AgentError |
Enhanced error type with additional properties for error code, help link, and inner exception. This interface extends the standard Error type with custom properties added by ExceptionHelper. |
| AgentErrorDefinition |
Represents an error definition for the Agents SDK. Each error definition includes an error code, description, and an optional help link. If helplink is not provided, a default help link will be used. |
| Attachment |
Represents an attachment. |
| CardAction |
Represents a card action. |
| ChannelAccount |
Represents a channel account. |
| ClientCitation |
Represents a Teams client citation to be included in a message. |
| ConversationAccount |
Represents a conversation account. |
| ConversationParameters |
Represents the parameters for creating a conversation. |
| ConversationReference |
Represents a reference to a conversation. |
| Entity |
Represents a generic Entity. |
| ExpectedReplies |
Represents expected replies in a conversation. |
| GeoCoordinates |
Represents geographical coordinates. |
| MembershipSource |
Interface representing a membership source. |
| Mention |
Represents a Mention entity. |
| MessageReaction |
Represents a message reaction. |
| Place |
Represents a Place entity. |
| SemanticAction |
Represents a semantic action. |
| SensitivityUsageInfo |
Sensitivity usage info for content sent to the user. |
| SuggestedActions |
Represents suggested actions. |
| TextHighlight |
Represents a text highlight. |
| Thing |
Represents a Thing entity. |
Enums
| ActionTypes |
Enum representing the types of actions. |
| ActivityEventNames |
Enum representing activity event names. |
| ActivityImportance |
Enum representing activity importance levels. |
| ActivityTreatments |
Enum representing treatment types for the activity. |
| ActivityTypes |
Enum representing activity types. |
| AttachmentLayoutTypes |
Enum representing the layout types for attachments. |
| Channels |
Enum representing the different channels an agent can communicate through. |
| DeliveryModes |
Enum representing delivery modes. |
| EndOfConversationCodes |
Enum representing the different end of conversation codes. |
| InputHints |
Enum representing input hints. |
| MembershipSourceTypes |
Enum defining the type of roster the user is a member of. |
| MembershipTypes |
Enum expressing the users relationship to the current channel. |
| MessageReactionTypes |
Enum representing message reaction types. |
| RoleTypes |
Enum representing the different role types in a conversation. |
| SemanticActionStateTypes |
Enum representing the state types of a semantic action. |
| TextFormatTypes |
Enum representing text format types. |
Variables
| Client |
Supported icon names for client citations. These icons are displayed in Teams to help users identify the type of content being referenced in AI-generated responses. The set of allowed values is defined by the
Add citations
section of the Microsoft Teams documentation (property
Example
|
| Activity |
Error definitions for the Activity system. This contains localized error codes for the Activity subsystem of the AgentSDK. Each error definition includes an error code (starting from -110000), a description, and a help link pointing to an AKA link to get help for the given error. Usage example:
|
| add |
Adds an AI entity to an activity to indicate that the content was generated by AI. Example
|
Variable Details
ClientCitationIconName
Supported icon names for client citations. These icons are displayed in Teams to help users identify the type of content being referenced in AI-generated responses.
The set of allowed values is defined by the
Add citations
section of the Microsoft Teams documentation (property citation.appearance.image.name).
ClientCitationIconName is both a value (a frozen object with named members, e.g.
ClientCitationIconName.MicrosoftWord) and a type alias (the string-literal union of all
supported icon names). Either form may be assigned to citation.appearance.image.name.
Example
const citation: ClientCitation = {
'@type': 'Claim',
position: 1,
appearance: {
'@type': 'DigitalDocument',
name: 'Quarterly report',
abstract: 'Q1 results',
image: { '@type': 'ImageObject', name: ClientCitationIconName.MicrosoftWord }
}
}
ClientCitationIconName: { AdobeFlash: "Adobe Flash", AdobeIllustrator: "Adobe Illustrator", AdobeInDesign: "Adobe InDesign", AdobePhotoshop: "Adobe Photoshop", GIF: "GIF", Image: "Image", MicrosoftExcel: "Microsoft Excel", MicrosoftLoop: "Microsoft Loop", MicrosoftOneNote: "Microsoft OneNote", MicrosoftPowerPoint: "Microsoft PowerPoint", MicrosoftSharePoint: "Microsoft SharePoint", MicrosoftVisio: "Microsoft Visio", MicrosoftWhiteboard: "Microsoft Whiteboard", MicrosoftWord: "Microsoft Word", PDF: "PDF", Sketch: "Sketch", Sound: "Sound", SourceCode: "Source Code", Text: "Text", Video: "Video", ZIP: "ZIP" }
Type
{ AdobeFlash: "Adobe Flash", AdobeIllustrator: "Adobe Illustrator", AdobeInDesign: "Adobe InDesign", AdobePhotoshop: "Adobe Photoshop", GIF: "GIF", Image: "Image", MicrosoftExcel: "Microsoft Excel", MicrosoftLoop: "Microsoft Loop", MicrosoftOneNote: "Microsoft OneNote", MicrosoftPowerPoint: "Microsoft PowerPoint", MicrosoftSharePoint: "Microsoft SharePoint", MicrosoftVisio: "Microsoft Visio", MicrosoftWhiteboard: "Microsoft Whiteboard", MicrosoftWord: "Microsoft Word", PDF: "PDF", Sketch: "Sketch", Sound: "Sound", SourceCode: "Source Code", Text: "Text", Video: "Video", ZIP: "ZIP" }
ActivityErrors
Error definitions for the Activity system. This contains localized error codes for the Activity subsystem of the AgentSDK.
Each error definition includes an error code (starting from -110000), a description, and a help link pointing to an AKA link to get help for the given error.
Usage example:
throw ExceptionHelper.generateException(
Error,
Errors.InvalidActivityTypeUndefined
);
ActivityErrors: {[key: string]: AgentErrorDefinition}
Type
{[key: string]: AgentErrorDefinition}
addAIToActivity
Adds an AI entity to an activity to indicate that the content was generated by AI.
Example
import { Activity } from '../activity';
import { addAIToActivity, ClientCitation } from './AIEntity';
const activity: Activity = {
type: 'message',
text: 'Based on the documents, here are the key findings...'
};
const citations: ClientCitation[] = [{
'@type': 'Claim',
position: 1,
appearance: {
'@type': 'DigitalDocument',
name: 'Research Report 2024',
abstract: 'Key findings from the annual research report',
url: 'https://example.com/report.pdf',
image: {
'@type': 'ImageObject',
name: 'PDF'
}
}
}];
// Add AI entity with citations
addAIToActivity(activity, citations);
addAIToActivity: (activity: Activity, citations?: ClientCitation[], usageInfo?: SensitivityUsageInfo) => void
Type
(activity: Activity, citations?: ClientCitation[], usageInfo?: SensitivityUsageInfo) => void
Remarks
This function enhances the activity with metadata that helps clients (like Microsoft Teams) understand that the content is AI-generated and optionally includes citations and sensitivity information.