< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.AgentFactoryOptions
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/AgentFactoryOptions.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 64
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
get_Description()100%11100%
get_Instructions()100%11100%
get_FunctionTypes()100%11100%
get_FunctionGroups()100%11100%
get_ChatClientFactory()100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/AgentFactoryOptions.cs

#LineLine coverage
 1using Microsoft.Agents.AI;
 2
 3namespace NexusLabs.Needlr.AgentFramework;
 4
 5/// <summary>
 6/// Per-agent configuration options passed to <c>IAgentFactory.CreateAgent(configure)</c>.
 7/// </summary>
 8public sealed class AgentFactoryOptions
 9{
 10    /// <summary>
 11    /// Gets or sets the agent's name. Used by MAF to populate <c>ExecutorId</c> in workflow events,
 12    /// making multi-agent output readable. When <see langword="null"/>, MAF assigns a generated identifier.
 13    /// </summary>
 64814    public string? Name { get; set; }
 15
 16    /// <summary>
 17    /// Gets or sets a human-readable description of this agent's purpose.
 18    /// </summary>
 60019    public string? Description { get; set; }
 20
 21    /// <summary>
 22    /// Gets or sets the system instructions for this specific agent.
 23    /// When set, overrides the default instructions configured on the factory.
 24    /// </summary>
 63125    public string? Instructions { get; set; }
 26
 27    /// <summary>
 28    /// Gets or sets the subset of function types to wire as tools for this agent.
 29    /// When <see langword="null"/> and <see cref="FunctionGroups"/> is also <see langword="null"/>,
 30    /// all function types registered with the factory are used.
 31    /// </summary>
 70432    public IReadOnlyList<Type>? FunctionTypes { get; set; }
 33
 34    /// <summary>
 35    /// Gets or sets the named function groups to wire as tools for this agent.
 36    /// Groups are declared using <see cref="AgentFunctionGroupAttribute"/> on function classes
 37    /// and registered via <c>AddAgentFunctionGroupsFromAssemblies()</c> or
 38    /// <c>AddAgentFunctionGroupsFromGenerated()</c>.
 39    /// When <see langword="null"/> and <see cref="FunctionTypes"/> is also <see langword="null"/>,
 40    /// all registered function types are used.
 41    /// </summary>
 65342    public IReadOnlyList<string>? FunctionGroups { get; set; }
 43
 44    /// <summary>
 45    /// Optional factory that wraps the <see cref="Microsoft.Extensions.AI.IChatClient"/>
 46    /// resolved for this agent. Use this to inject per-agent middleware such as
 47    /// <c>ContextWindowGuardMiddleware</c> with agent-specific limits.
 48    /// When <see langword="null"/>, the global chat client is used unmodified.
 49    /// </summary>
 50    /// <example>
 51    /// <code>
 52    /// var agent = agentFactory.CreateAgent(o =>
 53    /// {
 54    ///     o.Name = "ColdReader";
 55    ///     o.ChatClientFactory = inner => new ContextWindowGuardMiddleware(
 56    ///         innerClient: inner,
 57    ///         maxContextTokens: 40_000,
 58    ///         progressAccessor: progressAccessor,
 59    ///         pruneOnOverflow: true);
 60    /// });
 61    /// </code>
 62    /// </example>
 33763    public Func<Microsoft.Extensions.AI.IChatClient, Microsoft.Extensions.AI.IChatClient>? ChatClientFactory { get; set;
 64}