< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.TerminationContext
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/TerminationContext.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 43
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_AgentId()100%11100%
get_LastMessage()100%11100%
get_TurnCount()100%11100%
get_ConversationHistory()100%11100%
get_Usage()100%11100%
get_ToolCallNames()100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/TerminationContext.cs

#LineLine coverage
 1using Microsoft.Extensions.AI;
 2
 3namespace NexusLabs.Needlr.AgentFramework;
 4
 5/// <summary>
 6/// Provides context to an <see cref="IWorkflowTerminationCondition"/> when evaluating whether a
 7/// workflow should stop after an agent's response.
 8/// </summary>
 9public sealed class TerminationContext
 10{
 11    /// <summary>Gets the executor ID of the agent that produced this response.</summary>
 12612    public required string AgentId { get; init; }
 13
 14    /// <summary>
 15    /// Gets the last <see cref="ChatMessage"/> emitted by the agent for this turn
 16    /// (preserving full content including function calls, role, and metadata), or
 17    /// <see langword="null"/> if the agent produced no message. Use the <c>.Text</c>
 18    /// property on the message for a flat text view.
 19    /// </summary>
 10220    public ChatMessage? LastMessage { get; init; }
 21
 22    /// <summary>Gets the number of agent turns completed so far (1-based).</summary>
 6923    public required int TurnCount { get; init; }
 24
 25    /// <summary>
 26    /// Gets the accumulated conversation history up to and including this turn.
 27    /// Each entry corresponds to one completed agent response.
 28    /// </summary>
 6929    public required IReadOnlyList<ChatMessage> ConversationHistory { get; init; }
 30
 31    /// <summary>
 32    /// Gets token usage for this turn, if reported by the model. May be <see langword="null"/>
 33    /// when the model does not return usage metadata.
 34    /// </summary>
 435    public UsageDetails? Usage { get; init; }
 36
 37    /// <summary>
 38    /// Gets the names of tools/functions called by the agent during this turn.
 39    /// Extracted from <see cref="FunctionCallContent"/> entries in the last message's
 40    /// <see cref="ChatMessage.Contents"/>. Empty if no tool calls were made.
 41    /// </summary>
 10942    public IReadOnlyList<string> ToolCallNames { get; init; } = [];
 43}