Language

GroupChatManager.OnCheckpointingAsync Method

Definition

Invoked when the hosting group chat workflow is checkpointing, giving subclasses a chance to persist any additional state they maintain (e.g., a round-robin cursor or an LLM session).

protected virtual System.Threading.Tasks.ValueTask OnCheckpointingAsync(Microsoft.Agents.AI.Workflows.IWorkflowContext context, System.Threading.CancellationToken cancellationToken = default);
abstract member OnCheckpointingAsync : Microsoft.Agents.AI.Workflows.IWorkflowContext * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
override this.OnCheckpointingAsync : Microsoft.Agents.AI.Workflows.IWorkflowContext * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Protected Overridable Function OnCheckpointingAsync (context As IWorkflowContext, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Parameters

context
IWorkflowContext

A wrapped workflow context that scopes state keys to the GroupChatManager subclass namespace.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

Remarks

The default implementation is a no-op. Base-class state (currently IterationCount) is persisted automatically by the hosting Microsoft.Agents.AI.Workflows.Specialized.GroupChatHost before this method is invoked; subclasses do not need to call base.OnCheckpointingAsync.

The supplied context is a wrapper that transparently prefixes every state key with "GroupChatManager_", isolating subclass state from the host's own state keys (and from the reserved base-state key). Implementations therefore may use any human-readable key (e.g., "next_index") without worrying about collisions.

Applies to