AgentFrameworkAccessorServiceCollectionExtensions
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework¶
AgentFrameworkAccessorServiceCollectionExtensions Class¶
Extension methods that register the small set of Needlr Agent Framework accessors that tools and test harnesses depend on, without registering the full IAgentFactory / NexusLabs.Needlr.AgentFramework.WorkflowFactory / iterative-loop infrastructure.
Inheritance System.Object 🡒 AgentFrameworkAccessorServiceCollectionExtensions
Remarks¶
Use this when you need the Needlr accessors (IAgentExecutionContextAccessor, IAgentDiagnosticsAccessor, IInFlightAgentDiagnosticsAccessor, IAgentDiagnosticsWriter) but do not want the rest of the Agent Framework wiring — typically because you are constructing a minimal service provider for a tool-level test.
The UsingAgentFramework() extension on NexusLabs.Needlr.Injection.ConfiguredSyringe
already registers these accessors as part of its broader infrastructure setup. Calling
AddAgentFrameworkAccessors(this IServiceCollection) after UsingAgentFramework() is a no-op because
every registration uses Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(Microsoft.Extensions.DependencyInjection.IServiceCollection,Microsoft.Extensions.DependencyInjection.ServiceDescriptor).
Methods¶
AgentFrameworkAccessorServiceCollectionExtensions.AddAgentFrameworkAccessors(this IServiceCollection) Method¶
Registers the Needlr Agent Framework accessor singletons: IAgentExecutionContextAccessor, IAgentDiagnosticsAccessor, IInFlightAgentDiagnosticsAccessor, and IAgentDiagnosticsWriter.
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddAgentFrameworkAccessors(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
Parameters¶
services Microsoft.Extensions.DependencyInjection.IServiceCollection
The service collection to add registrations to.
Returns¶
Microsoft.Extensions.DependencyInjection.IServiceCollection
The same services instance for chaining.
Remarks¶
All registrations use TryAddSingleton, so calling this method is safe even if the
accessors have already been registered by UsingAgentFramework() or another path.