< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.AgentFunctionGroupAttribute
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/AgentFunctionGroupAttribute.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 46
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
.ctor(...)100%11100%
get_GroupName()100%11100%

File(s)

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

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework;
 2
 3/// <summary>
 4/// Assigns a class to a named function group so that it can be wired to agents by group name
 5/// rather than by explicit type reference.
 6/// </summary>
 7/// <remarks>
 8/// Apply this attribute to classes that contain methods decorated with
 9/// <see cref="AgentFunctionAttribute"/>. Register groups using
 10/// <c>AddAgentFunctionGroupsFromAssemblies()</c> or <c>AddAgentFunctionGroupsFromGenerated()</c>,
 11/// then reference them in <see cref="AgentFactoryOptions.FunctionGroups"/> at agent creation time.
 12/// <para>
 13/// A class may belong to multiple groups by applying this attribute more than once.
 14/// </para>
 15/// </remarks>
 16/// <example>
 17/// <code>
 18/// [AgentFunctionGroup("research")]
 19/// public class GeographyFunctions { ... }
 20///
 21/// [AgentFunctionGroup("research")]
 22/// [AgentFunctionGroup("general")]
 23/// public class FactFunctions { ... }
 24///
 25/// // At agent creation:
 26/// agentFactory.CreateAgent(opts => opts.FunctionGroups = ["research"]);
 27/// </code>
 28/// </example>
 29[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
 30public sealed class AgentFunctionGroupAttribute : Attribute
 31{
 32    /// <summary>
 33    /// Initializes a new instance of <see cref="AgentFunctionGroupAttribute"/>.
 34    /// </summary>
 35    /// <param name="groupName">The name of the group this class belongs to.</param>
 139636    public AgentFunctionGroupAttribute(string groupName)
 37    {
 139638        ArgumentException.ThrowIfNullOrWhiteSpace(groupName);
 139339        GroupName = groupName;
 139340    }
 41
 42    /// <summary>
 43    /// Gets the name of the group this class belongs to.
 44    /// </summary>
 17345    public string GroupName { get; }
 46}