Skip to content

AgentResiliencePlugin

NexusLabs.Needlr.AgentFramework.Workflows

NexusLabs.Needlr.AgentFramework.Workflows.Middleware

AgentResiliencePlugin Class

MAF agent-level middleware that wraps each agent run call in a Polly.ResiliencePipeline<> from Microsoft.Extensions.Resilience / Polly.

public sealed class AgentResiliencePlugin : NexusLabs.Needlr.AgentFramework.IAIAgentBuilderPlugin

Inheritance System.Object 🡒 AgentResiliencePlugin

Implements NexusLabs.Needlr.AgentFramework.IAIAgentBuilderPlugin

Remarks

This is the right middleware level for agent resilience because it wraps the entire RunAsync() call and catches LLM failures, tool failures, and orchestration errors together. Streaming RunStreamingAsync() passes through without retry.

Constructors

AgentResiliencePlugin(ResiliencePipeline<AgentResponse>) Constructor

public AgentResiliencePlugin(Polly.ResiliencePipeline<Microsoft.Agents.AI.AgentResponse> pipeline);

Parameters

pipeline Polly.ResiliencePipeline<Microsoft.Agents.AI.AgentResponse>

The resilience pipeline to wrap around each RunAsync call.

Methods

AgentResiliencePlugin.Configure(AIAgentBuilderPluginOptions) Method

Called during agent factory initialisation to configure the agent builder.

public void Configure(NexusLabs.Needlr.AgentFramework.AIAgentBuilderPluginOptions options);

Parameters

options NexusLabs.Needlr.AgentFramework.AIAgentBuilderPluginOptions

Implements Configure(AIAgentBuilderPluginOptions)