IAgentStageResult
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework.Diagnostics¶
IAgentStageResult Interface¶
Result of a single agent stage within a multi-agent pipeline or group chat workflow, combining the response text with the captured diagnostics for that stage.
Example¶
var result = await workflow.RunWithDiagnosticsAsync(prompt, accessor);
foreach (var stage in result.Stages)
{
var tokens = stage.Diagnostics?.AggregateTokenUsage;
Console.WriteLine($"[{stage.AgentName}] {tokens?.TotalTokens ?? 0} tokens, " +
$"{stage.Diagnostics?.TotalDuration.TotalSeconds:F1}s");
Console.WriteLine($" Response: {stage.ResponseText[..Math.Min(100, stage.ResponseText.Length)]}...");
}
Remarks¶
Access stage results via Stages after calling
RunWithDiagnosticsAsync. Each stage corresponds to one agent turn in the
workflow.
Properties¶
IAgentStageResult.AgentName Property¶
Gets the agent's executor ID (agent name, possibly with a MAF-assigned GUID suffix).
Property Value¶
IAgentStageResult.Diagnostics Property¶
Gets the diagnostics captured during this agent's execution, including per-call
token usage, tool call details, and timing. null if diagnostics
were not enabled via UsingDiagnostics().
Property Value¶
IAgentStageResult.ResponseText Property¶
Gets the text content the agent produced during this stage. Empty if the agent responded only via tool calls.