< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Progress.AgentInvokedEvent
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/Progress/IProgressEvent.cs
Line coverage
25%
Covered lines: 3
Uncovered lines: 9
Coverable lines: 12
Total lines: 285
Line coverage: 25%
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
.ctor(...)100%11100%
get_Timestamp()100%210%
get_WorkflowId()100%210%
get_AgentId()100%210%
get_ParentAgentId()100%210%
get_Depth()100%210%
get_SequenceNumber()100%210%
get_AgentName()100%210%
get_GraphName()100%210%
get_NodeId()100%11100%
get_BranchId()100%210%
get_IncomingEdgeLabel()100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/Progress/IProgressEvent.cs

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework.Progress;
 2
 3/// <summary>
 4/// Base interface for all progress events emitted during agent/workflow execution.
 5/// Every event carries correlation context enabling hierarchical trace reconstruction.
 6/// </summary>
 7public interface IProgressEvent
 8{
 9    /// <summary>When the event occurred.</summary>
 10    DateTimeOffset Timestamp { get; }
 11
 12    /// <summary>Top-level workflow correlation ID.</summary>
 13    string WorkflowId { get; }
 14
 15    /// <summary>Which agent emitted this event, or <see langword="null"/> for workflow-level events.</summary>
 16    string? AgentId { get; }
 17
 18    /// <summary>Parent agent ID for sub-agent runs, enabling tree reconstruction.</summary>
 19    string? ParentAgentId { get; }
 20
 21    /// <summary>Nesting depth: 0 = workflow, 1 = agent, 2 = sub-agent, etc.</summary>
 22    int Depth { get; }
 23
 24    /// <summary>Globally ordered sequence number for event ordering.</summary>
 25    long SequenceNumber { get; }
 26}
 27
 28// ---------------------------------------------------------------------------
 29// Workflow-level events
 30// ---------------------------------------------------------------------------
 31
 32/// <summary>Workflow execution has started.</summary>
 33public sealed record WorkflowStartedEvent(
 34    DateTimeOffset Timestamp,
 35    string WorkflowId,
 36    string? AgentId,
 37    string? ParentAgentId,
 38    int Depth,
 39    long SequenceNumber) : IProgressEvent;
 40
 41/// <summary>Workflow execution has completed.</summary>
 42public sealed record WorkflowCompletedEvent(
 43    DateTimeOffset Timestamp,
 44    string WorkflowId,
 45    string? AgentId,
 46    string? ParentAgentId,
 47    int Depth,
 48    long SequenceNumber,
 49    bool Succeeded,
 50    string? ErrorMessage,
 51    TimeSpan TotalDuration) : IProgressEvent;
 52
 53// ---------------------------------------------------------------------------
 54// Agent lifecycle events
 55// ---------------------------------------------------------------------------
 56
 57/// <summary>An agent has been invoked (turn started).</summary>
 23358public sealed record AgentInvokedEvent(
 059    DateTimeOffset Timestamp,
 060    string WorkflowId,
 061    string? AgentId,
 062    string? ParentAgentId,
 063    int Depth,
 064    long SequenceNumber,
 065    string AgentName,
 066    string? GraphName = null,
 2367    string? NodeId = null,
 068    string? BranchId = null,
 23369    string? IncomingEdgeLabel = null) : IProgressEvent;
 70
 71/// <summary>An agent has completed its turn.</summary>
 72public sealed record AgentCompletedEvent(
 73    DateTimeOffset Timestamp,
 74    string WorkflowId,
 75    string? AgentId,
 76    string? ParentAgentId,
 77    int Depth,
 78    long SequenceNumber,
 79    string AgentName,
 80    TimeSpan Duration,
 81    long TotalTokens,
 82    long? InputTokens = null,
 83    long? OutputTokens = null,
 84    int? ToolCallCount = null,
 85    string? TerminationReason = null) : IProgressEvent;
 86
 87/// <summary>An agent run failed.</summary>
 88public sealed record AgentFailedEvent(
 89    DateTimeOffset Timestamp,
 90    string WorkflowId,
 91    string? AgentId,
 92    string? ParentAgentId,
 93    int Depth,
 94    long SequenceNumber,
 95    string AgentName,
 96    string ErrorMessage) : IProgressEvent;
 97
 98/// <summary>A chunk of streaming response text from an agent.</summary>
 99public sealed record AgentResponseChunkEvent(
 100    DateTimeOffset Timestamp,
 101    string WorkflowId,
 102    string? AgentId,
 103    string? ParentAgentId,
 104    int Depth,
 105    long SequenceNumber,
 106    string AgentName,
 107    string Text) : IProgressEvent;
 108
 109/// <summary>An agent handed off to another agent.</summary>
 110public sealed record AgentHandoffEvent(
 111    DateTimeOffset Timestamp,
 112    string WorkflowId,
 113    string? AgentId,
 114    string? ParentAgentId,
 115    int Depth,
 116    long SequenceNumber,
 117    string FromAgentId,
 118    string ToAgentId) : IProgressEvent;
 119
 120// ---------------------------------------------------------------------------
 121// LLM call events
 122// ---------------------------------------------------------------------------
 123
 124/// <summary>An LLM request has been sent.</summary>
 125public sealed record LlmCallStartedEvent(
 126    DateTimeOffset Timestamp,
 127    string WorkflowId,
 128    string? AgentId,
 129    string? ParentAgentId,
 130    int Depth,
 131    long SequenceNumber,
 132    int CallSequence) : IProgressEvent;
 133
 134/// <summary>An LLM response has been received.</summary>
 135public sealed record LlmCallCompletedEvent(
 136    DateTimeOffset Timestamp,
 137    string WorkflowId,
 138    string? AgentId,
 139    string? ParentAgentId,
 140    int Depth,
 141    long SequenceNumber,
 142    int CallSequence,
 143    string Model,
 144    TimeSpan Duration,
 145    long InputTokens,
 146    long OutputTokens,
 147    long TotalTokens) : IProgressEvent;
 148
 149/// <summary>An LLM call failed.</summary>
 150public sealed record LlmCallFailedEvent(
 151    DateTimeOffset Timestamp,
 152    string WorkflowId,
 153    string? AgentId,
 154    string? ParentAgentId,
 155    int Depth,
 156    long SequenceNumber,
 157    int CallSequence,
 158    string ErrorMessage,
 159    TimeSpan Duration) : IProgressEvent;
 160
 161// ---------------------------------------------------------------------------
 162// Tool call events
 163// ---------------------------------------------------------------------------
 164
 165/// <summary>A tool invocation has started.</summary>
 166public sealed record ToolCallStartedEvent(
 167    DateTimeOffset Timestamp,
 168    string WorkflowId,
 169    string? AgentId,
 170    string? ParentAgentId,
 171    int Depth,
 172    long SequenceNumber,
 173    string ToolName) : IProgressEvent;
 174
 175/// <summary>A tool invocation has completed.</summary>
 176public sealed record ToolCallCompletedEvent(
 177    DateTimeOffset Timestamp,
 178    string WorkflowId,
 179    string? AgentId,
 180    string? ParentAgentId,
 181    int Depth,
 182    long SequenceNumber,
 183    string ToolName,
 184    TimeSpan Duration,
 185    IReadOnlyDictionary<string, object?>? CustomMetrics) : IProgressEvent;
 186
 187/// <summary>A tool invocation failed.</summary>
 188public sealed record ToolCallFailedEvent(
 189    DateTimeOffset Timestamp,
 190    string WorkflowId,
 191    string? AgentId,
 192    string? ParentAgentId,
 193    int Depth,
 194    long SequenceNumber,
 195    string ToolName,
 196    string ErrorMessage,
 197    TimeSpan Duration) : IProgressEvent;
 198
 199// ---------------------------------------------------------------------------
 200// Budget events
 201// ---------------------------------------------------------------------------
 202
 203/// <summary>Token budget usage has been updated.</summary>
 204public sealed record BudgetUpdatedEvent(
 205    DateTimeOffset Timestamp,
 206    string WorkflowId,
 207    string? AgentId,
 208    string? ParentAgentId,
 209    int Depth,
 210    long SequenceNumber,
 211    long CurrentInputTokens,
 212    long CurrentOutputTokens,
 213    long CurrentTotalTokens,
 214    long? MaxInputTokens,
 215    long? MaxOutputTokens,
 216    long? MaxTotalTokens) : IProgressEvent;
 217
 218/// <summary>A token budget limit has been exceeded.</summary>
 219public sealed record BudgetExceededEvent(
 220    DateTimeOffset Timestamp,
 221    string WorkflowId,
 222    string? AgentId,
 223    string? ParentAgentId,
 224    int Depth,
 225    long SequenceNumber,
 226    string LimitType,
 227    long CurrentValue,
 228    long MaxValue) : IProgressEvent;
 229
 230// ---------------------------------------------------------------------------
 231// Workflow control-flow events (MAF SuperSteps)
 232// ---------------------------------------------------------------------------
 233
 234/// <summary>A workflow control-flow step (SuperStep) has started. Represents one
 235/// cycle of the orchestration loop: send work to agents → collect results → decide next.</summary>
 236public sealed record SuperStepStartedProgressEvent(
 237    DateTimeOffset Timestamp,
 238    string WorkflowId,
 239    string? AgentId,
 240    string? ParentAgentId,
 241    int Depth,
 242    long SequenceNumber,
 243    int StepNumber,
 244    int? ParallelBranchCount = null) : IProgressEvent;
 245
 246/// <summary>A workflow control-flow step (SuperStep) has completed.</summary>
 247public sealed record SuperStepCompletedProgressEvent(
 248    DateTimeOffset Timestamp,
 249    string WorkflowId,
 250    string? AgentId,
 251    string? ParentAgentId,
 252    int Depth,
 253    long SequenceNumber,
 254    int StepNumber) : IProgressEvent;
 255
 256// ---------------------------------------------------------------------------
 257// Phase lifecycle events
 258// ---------------------------------------------------------------------------
 259
 260/// <summary>A pipeline phase has started execution.</summary>
 261public sealed record PhaseStartedEvent(
 262    DateTimeOffset Timestamp,
 263    string WorkflowId,
 264    string? AgentId,
 265    string? ParentAgentId,
 266    int Depth,
 267    long SequenceNumber,
 268    string PhaseName,
 269    int PhaseIndex,
 270    int TotalPhases,
 271    int StageCount) : IProgressEvent;
 272
 273/// <summary>A pipeline phase has completed execution.</summary>
 274public sealed record PhaseCompletedEvent(
 275    DateTimeOffset Timestamp,
 276    string WorkflowId,
 277    string? AgentId,
 278    string? ParentAgentId,
 279    int Depth,
 280    long SequenceNumber,
 281    string PhaseName,
 282    int PhaseIndex,
 283    int TotalPhases,
 284    bool Succeeded,
 285    TimeSpan Duration) : IProgressEvent;