Skip to content

TerminationContext

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework

TerminationContext Class

Provides context to an IWorkflowTerminationCondition when evaluating whether a workflow should stop after an agent's response.

public sealed class TerminationContext

Inheritance System.Object 🡒 TerminationContext

Properties

TerminationContext.AgentId Property

Gets the executor ID of the agent that produced this response.

public string AgentId { get; init; }

Property Value

System.String

TerminationContext.ConversationHistory Property

Gets the accumulated conversation history up to and including this turn. Each entry corresponds to one completed agent response.

public System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> ConversationHistory { get; init; }

Property Value

System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage>

TerminationContext.ResponseText Property

Gets the complete response text emitted by the agent for this turn.

public string ResponseText { get; init; }

Property Value

System.String

TerminationContext.TurnCount Property

Gets the number of agent turns completed so far (1-based).

public int TurnCount { get; init; }

Property Value

System.Int32

TerminationContext.Usage Property

Gets token usage for this turn, if reported by the model. May be null when the model does not return usage metadata.

public Microsoft.Extensions.AI.UsageDetails? Usage { get; init; }

Property Value

Microsoft.Extensions.AI.UsageDetails