< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.NeedlrAiAgentAttribute
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/NeedlrAiAgentAttribute.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 54
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_Instructions()100%11100%
get_Description()100%11100%
get_FunctionTypes()100%11100%
get_FunctionGroups()100%11100%

File(s)

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

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework;
 2
 3/// <summary>
 4/// Marks a class as a declared agent type for Needlr's Agent Framework integration.
 5/// Apply this attribute to a class to enable compile-time registration via the source generator
 6/// and <see cref="IAgentFactory.CreateAgent{TAgent}"/> lookup.
 7/// </summary>
 8/// <remarks>
 9/// When the <c>NexusLabs.Needlr.AgentFramework.Generators</c> package is referenced,
 10/// a <c>[ModuleInitializer]</c> is emitted that automatically registers the agent type
 11/// with <see cref="AgentFrameworkGeneratedBootstrap"/>. <c>UsingAgentFramework()</c>
 12/// then discovers and registers these types without any explicit <c>Add*FromGenerated()</c> calls.
 13/// </remarks>
 14/// <example>
 15/// <code>
 16/// [NeedlrAiAgent(
 17///     Instructions = "You are a helpful customer support agent. Answer questions about orders.",
 18///     Description = "Customer support agent for order inquiries")]
 19/// [AgentHandoffsTo(typeof(BillingAgent), "Escalate billing or payment questions to the billing agent")]
 20/// public class CustomerSupportAgent
 21/// {
 22/// }
 23///
 24/// // In your composition root:
 25/// var agentFactory = syringe.BuildAgentFactory();
 26/// var agent = agentFactory.CreateAgent&lt;CustomerSupportAgent&gt;();
 27/// </code>
 28/// </example>
 29[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
 30public sealed class NeedlrAiAgentAttribute : Attribute
 31{
 32    /// <summary>
 33    /// Gets or sets the system prompt instructions for this agent.
 34    /// </summary>
 344435    public string? Instructions { get; set; }
 36
 37    /// <summary>
 38    /// Gets or sets a human-readable description of this agent's purpose.
 39    /// </summary>
 6540    public string? Description { get; set; }
 41
 42    /// <summary>
 43    /// Gets or sets the function types whose <see cref="AgentFunctionAttribute"/>-tagged methods
 44    /// are wired as tools for this agent. When null and <see cref="FunctionGroups"/> is also null,
 45    /// all registered function types are used.
 46    /// </summary>
 26247    public Type[]? FunctionTypes { get; set; }
 48
 49    /// <summary>
 50    /// Gets or sets named function groups (registered via <see cref="AgentFunctionGroupAttribute"/>)
 51    /// whose types are wired as tools for this agent.
 52    /// </summary>
 6553    public string[]? FunctionGroups { get; set; }
 54}