Share via


AgentThread Class

Definition

Base abstraction for all Semantic Kernel agent threads. A thread represents a specific conversation with an agent.

public abstract class AgentThread
type AgentThread = class
Public MustInherit Class AgentThread
Inheritance
AgentThread
Derived

Remarks

This class is used to manage the lifecycle of an agent thread. The thread can be not-start, started or ended.

Constructors

AgentThread()

Properties

Id

Gets the id of the current thread.

IsDeleted

Gets a value indicating whether the thread has been deleted.

Methods

CreateAsync(CancellationToken)

Creates the thread and returns the thread id.

CreateInternalAsync(CancellationToken)

Creates the thread and returns the thread id. Checks have already been completed in the CreateAsync(CancellationToken) method to ensure that the thread can be created.

DeleteAsync(CancellationToken)

Deletes the current thread.

DeleteInternalAsync(CancellationToken)

Deletes the current thread. Checks have already been completed in the DeleteAsync(CancellationToken) method to ensure that the thread can be deleted.

OnNewMessageInternalAsync(ChatMessageContent, CancellationToken)

This method is called when a new message has been contributed to the chat by any participant. Checks have already been completed in the Microsoft.SemanticKernel.Agents.AgentThread.OnNewMessageAsync(Microsoft.SemanticKernel.ChatMessageContent,System.Threading.CancellationToken) method to ensure that the thread can be updated.

Applies to