Skip to content

IProgressReporterFactory

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Progress

IProgressReporterFactory Interface

Creates IProgressReporter instances scoped to a specific orchestration run.

public interface IProgressReporterFactory

Remarks

Two creation patterns are supported: - Default sinks (Create(string)): Uses all IProgressSink instances registered in DI — including those auto-discovered by Needlr and any added manually via services.AddSingleton<IProgressSink, T>(). Best for simple applications with a single agentic workflow. - Per-orchestration sinks (Create(string, IEnumerable<IProgressSink>)): Uses only the sinks you provide — default DI sinks are ignored entirely. Best for complex server applications (multi-tenant, parallel workflows) where each orchestration requires its own reporting channel.

Methods

IProgressReporterFactory.Create(string) Method

Creates a reporter using the default sinks registered in DI.

NexusLabs.Needlr.AgentFramework.Progress.IProgressReporter Create(string workflowId);

Parameters

workflowId System.String

Correlation ID for the orchestration run.

Returns

IProgressReporter
A reporter that delivers events to all DI-registered IProgressSink instances, or NexusLabs.Needlr.AgentFramework.Progress.NullProgressReporter.Instance if no sinks are registered.

Remarks

Default sinks include all IProgressSink implementations auto-discovered by Needlr plus any registered manually via services.AddSingleton<IProgressSink, T>(). To prevent a specific sink from being auto-discovered, decorate it with NexusLabs.Needlr.DoNotAutoRegisterAttribute.

IProgressReporterFactory.Create(string, IEnumerable<IProgressSink>) Method

Creates a reporter with specific sinks for this orchestration only. Default DI sinks are \<strong>not\</strong> included — only the sinks you pass here receive events.

NexusLabs.Needlr.AgentFramework.Progress.IProgressReporter Create(string workflowId, System.Collections.Generic.IEnumerable<NexusLabs.Needlr.AgentFramework.Progress.IProgressSink> sinks);

Parameters

workflowId System.String

Correlation ID for the orchestration run.

sinks System.Collections.Generic.IEnumerable<IProgressSink>

Sinks to receive events for this orchestration only. Pass an empty collection to get NexusLabs.Needlr.AgentFramework.Progress.NullProgressReporter.Instance (zero-overhead no-op).

Returns

IProgressReporter
A reporter that delivers events exclusively to sinks, or NexusLabs.Needlr.AgentFramework.Progress.NullProgressReporter.Instance if the collection is empty.

Remarks

Use this overload in multi-tenant or multi-workflow server applications where each orchestration requires its own isolated reporting channel (e.g., per-tenant SSE streams, per-workflow log files). The caller is responsible for managing the lifetime and disposal of the provided sinks.