Initializes a new instance of the TurnContext class.
The adapter that created this context, or another TurnContext to clone
The activity for the turn (required when first parameter is an adapter)
Optionalidentity: JwtPayloadReadonlybufferedA list of reply activities that are buffered until the end of the turn.
This is primarily used with the 'expectReplies' delivery mode where all activities during a turn are collected and returned as a single response.
Gets the incoming activity that started this turn.
Gets the adapter that created this context.
Gets the turn state collection for storing data during the turn.
ProtectedcopyProtectedCopies the properties of this TurnContext to another TurnContext.
Used internally when cloning contexts.
The context to copy to
Deletes an activity from the conversation.
The ID of the activity to delete or a conversation reference
A promise that resolves when the activity has been deleted
The ID of the attachment
The view to get
A promise that resolves to a readable stream of the attachment content
The ID of the attachment
A promise that resolves to the attachment information
Registers a handler for intercepting activity deletions.
The handler to register
The current TurnContext instance for chaining
Registers a handler for intercepting and processing activities being sent.
The handler to register
The current TurnContext instance for chaining
Registers a handler for intercepting activity updates.
The handler to register
The current TurnContext instance for chaining
Sends multiple activities to the sender of the incoming activity.
The array of activities to send
A promise that resolves to an array of resource responses
Sends an activity to the sender of the incoming activity.
The activity to send or a string for a simple message
Optionalspeak: stringOptional text to be spoken by the agent
OptionalinputHint: stringOptional input hint to indicate if the agent is expecting input
A promise that resolves to the resource response or undefined
Sends a trace activity for debugging purposes.
The name/category of the trace
Optionalvalue: anyThe value/data to include in the trace
OptionalvalueType: stringOptional type name for the value
Optionallabel: stringOptional descriptive label for the trace
A promise that resolves to the resource response or undefined
Updates an existing activity in the conversation.
The activity to update with its ID specified
A promise that resolves when the activity has been updated
The ID of the conversation
The attachment data to upload
A promise that resolves to the resource response
Represents the context for a single turn in a conversation between a user and an agent.
Remarks
TurnContext is a central concept in the Agents framework - it contains:
The TurnContext object is created by the adapter when an activity is received and is passed to the agent's logic to process the turn. It maintains information about the conversation and provides methods to send responses.
This class follows the builder pattern for registering middleware handlers.