AgentFactoryOptions
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework¶
AgentFactoryOptions Class¶
Per-agent configuration options passed to IAgentFactory.CreateAgent(configure).
Inheritance System.Object 🡒 AgentFactoryOptions
Properties¶
AgentFactoryOptions.ChatClientFactory Property¶
Optional factory that wraps the Microsoft.Extensions.AI.IChatClient
resolved for this agent. Use this to inject per-agent middleware such as
ContextWindowGuardMiddleware with agent-specific limits.
When null, the global chat client is used unmodified.
public System.Func<Microsoft.Extensions.AI.IChatClient,Microsoft.Extensions.AI.IChatClient>? ChatClientFactory { get; set; }
Property Value¶
System.Func<Microsoft.Extensions.AI.IChatClient,Microsoft.Extensions.AI.IChatClient>
Example¶
var agent = agentFactory.CreateAgent(o =>
{
o.Name = "ColdReader";
o.ChatClientFactory = inner => new ContextWindowGuardMiddleware(
innerClient: inner,
maxContextTokens: 40_000,
progressAccessor: progressAccessor,
pruneOnOverflow: true);
});
AgentFactoryOptions.Description Property¶
Gets or sets a human-readable description of this agent's purpose.
Property Value¶
AgentFactoryOptions.FunctionGroups Property¶
Gets or sets the named function groups to wire as tools for this agent.
Groups are declared using AgentFunctionGroupAttribute on function classes
and registered via AddAgentFunctionGroupsFromAssemblies() or
AddAgentFunctionGroupsFromGenerated().
When null and FunctionTypes is also null,
all registered function types are used.
Property Value¶
System.Collections.Generic.IReadOnlyList<System.String>
AgentFactoryOptions.FunctionTypes Property¶
Gets or sets the subset of function types to wire as tools for this agent. When null and FunctionGroups is also null, all function types registered with the factory are used.
Property Value¶
System.Collections.Generic.IReadOnlyList<System.Type>
AgentFactoryOptions.Instructions Property¶
Gets or sets the system instructions for this specific agent. When set, overrides the default instructions configured on the factory.
Property Value¶
AgentFactoryOptions.Name Property¶
Gets or sets the agent's name. Used by MAF to populate ExecutorId in workflow events,
making multi-agent output readable. When null, MAF assigns a generated identifier.