Skip to content

IAgentOutputCollectorAccessor T

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Collectors

IAgentOutputCollectorAccessor<T> Interface

System.Threading.AsyncLocal<>-scoped accessor for IAgentOutputCollector<T>. Each pipeline run gets its own collector scope, isolated from concurrent runs.

public interface IAgentOutputCollectorAccessor<T>

Type parameters

T

The record type to collect.

Remarks

The orchestrator opens a scope before running an agent stage:

var accessor = serviceProvider.GetRequiredService<IAgentOutputCollectorAccessor<ReviewIssue>>();
using (accessor.BeginScope())
{
    await agent.RunAsync(prompt);
    var issues = accessor.Current?.Items ?? [];
}

Tools inject the accessor and call Add(T) during execution.

Properties

IAgentOutputCollectorAccessor<T>.Current Property

Gets the collector for the current scope, or null if no scope is active.

NexusLabs.Needlr.AgentFramework.Collectors.IAgentOutputCollector<T>? Current { get; }

Property Value

NexusLabs.Needlr.AgentFramework.Collectors.IAgentOutputCollector<T>

Methods

IAgentOutputCollectorAccessor<T>.BeginScope() Method

Opens a new collector scope. Disposing the handle restores the previous scope.

System.IDisposable BeginScope();

Returns

System.IDisposable

IAgentOutputCollectorAccessor<T>.BeginScope(IAgentOutputCollector<T>) Method

Opens a new collector scope using the provided collector instance. Useful when the orchestrator needs to supply a pre-populated or custom collector.

System.IDisposable BeginScope(NexusLabs.Needlr.AgentFramework.Collectors.IAgentOutputCollector<T> collector);

Parameters

collector NexusLabs.Needlr.AgentFramework.Collectors.IAgentOutputCollector<T>

Returns

System.IDisposable