| | | 1 | | namespace 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<CustomerSupportAgent>(); |
| | | 27 | | /// </code> |
| | | 28 | | /// </example> |
| | | 29 | | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] |
| | | 30 | | public sealed class NeedlrAiAgentAttribute : Attribute |
| | | 31 | | { |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets or sets the system prompt instructions for this agent. |
| | | 34 | | /// </summary> |
| | 3444 | 35 | | public string? Instructions { get; set; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Gets or sets a human-readable description of this agent's purpose. |
| | | 39 | | /// </summary> |
| | 65 | 40 | | 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> |
| | 262 | 47 | | 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> |
| | 65 | 53 | | public string[]? FunctionGroups { get; set; } |
| | | 54 | | } |