| | | 1 | | namespace NexusLabs.Needlr.AgentFramework; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Marks an agent class as a member of a named sequential pipeline, specifying its position. |
| | | 5 | | /// The source generator reads these declarations to emit a strongly-typed |
| | | 6 | | /// <c>Create{PipelineName}SequentialWorkflow()</c> extension method on <see cref="IWorkflowFactory"/>. |
| | | 7 | | /// </summary> |
| | | 8 | | /// <remarks> |
| | | 9 | | /// Apply multiple instances of this attribute on different agent classes with the same |
| | | 10 | | /// <paramref name="pipelineName"/> to declare the full sequence. Agents are executed in ascending |
| | | 11 | | /// <paramref name="order"/> — output from each agent is passed as input to the next. |
| | | 12 | | /// </remarks> |
| | | 13 | | /// <example> |
| | | 14 | | /// <code> |
| | | 15 | | /// [NeedlrAiAgent(Instructions = "Extract key facts from the user's input.")] |
| | | 16 | | /// [AgentSequenceMember("ContentPipeline", order: 0)] |
| | | 17 | | /// public class ExtractorAgent { } |
| | | 18 | | /// |
| | | 19 | | /// [NeedlrAiAgent(Instructions = "Summarize extracted facts into a concise paragraph.")] |
| | | 20 | | /// [AgentSequenceMember("ContentPipeline", order: 1)] |
| | | 21 | | /// public class SummarizerAgent { } |
| | | 22 | | /// |
| | | 23 | | /// [NeedlrAiAgent(Instructions = "Format the summary as a structured JSON report.")] |
| | | 24 | | /// [AgentSequenceMember("ContentPipeline", order: 2)] |
| | | 25 | | /// public class FormatterAgent { } |
| | | 26 | | /// |
| | | 27 | | /// // The source generator emits: |
| | | 28 | | /// // workflowFactory.CreateContentPipelineSequentialWorkflow() |
| | | 29 | | /// </code> |
| | | 30 | | /// </example> |
| | | 31 | | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] |
| | 600 | 32 | | public sealed class AgentSequenceMemberAttribute(string pipelineName, int order) : Attribute |
| | | 33 | | { |
| | | 34 | | /// <summary>The name of the sequential pipeline this agent belongs to.</summary> |
| | 615 | 35 | | public string PipelineName { get; } = pipelineName; |
| | | 36 | | |
| | | 37 | | /// <summary>The zero-based position of this agent within the pipeline sequence.</summary> |
| | 612 | 38 | | public int Order { get; } = order; |
| | | 39 | | } |