AgentStageExecutor
NexusLabs.Needlr.AgentFramework.Workflows¶
NexusLabs.Needlr.AgentFramework.Workflows.Sequential¶
AgentStageExecutor Class¶
Executes a pipeline stage by running an Microsoft.Agents.AI.AIAgent with a dynamically constructed prompt.
public sealed class AgentStageExecutor : NexusLabs.Needlr.AgentFramework.Workflows.Sequential.IStageExecutor
Inheritance System.Object 🡒 AgentStageExecutor
Implements IStageExecutor
Example¶
var executor = new AgentStageExecutor(
writerAgent,
ctx => $"Write a draft about topic in workspace.");
var result = await executor.ExecuteAsync(context, cancellationToken);
Console.WriteLine(result.ResponseText);
Constructors¶
AgentStageExecutor(AIAgent, Func<StageExecutionContext,string>) Constructor¶
Initializes a new AgentStageExecutor.
public AgentStageExecutor(Microsoft.Agents.AI.AIAgent agent, System.Func<NexusLabs.Needlr.AgentFramework.Workflows.Sequential.StageExecutionContext,string> promptFactory);
Parameters¶
agent Microsoft.Agents.AI.AIAgent
The AI agent to execute.
promptFactory System.Func<StageExecutionContext,System.String>
Factory that produces the prompt string from the current stage context.
Methods¶
AgentStageExecutor.ExecuteAsync(StageExecutionContext, CancellationToken) Method¶
Executes the stage logic and returns a result indicating success or failure.
public System.Threading.Tasks.Task<NexusLabs.Needlr.AgentFramework.Workflows.Sequential.StageExecutionResult> ExecuteAsync(NexusLabs.Needlr.AgentFramework.Workflows.Sequential.StageExecutionContext context, System.Threading.CancellationToken cancellationToken);
Parameters¶
context StageExecutionContext
The execution context providing access to shared pipeline state.
cancellationToken System.Threading.CancellationToken
Token to observe for cancellation.
Implements ExecuteAsync(StageExecutionContext, CancellationToken)
Returns¶
System.Threading.Tasks.Task<StageExecutionResult>
A StageExecutionResult describing the outcome.