| | | 1 | | namespace NexusLabs.Needlr.AgentFramework; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Declares per-node configuration for a graph workflow participant. Apply to |
| | | 5 | | /// agents that receive multiple incoming edges to control join semantics. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <remarks> |
| | | 8 | | /// <para> |
| | | 9 | | /// This attribute is optional. Agents that do not carry it use the default |
| | | 10 | | /// <see cref="GraphJoinMode.WaitAll"/> join mode. |
| | | 11 | | /// </para> |
| | | 12 | | /// </remarks> |
| | | 13 | | /// <example> |
| | | 14 | | /// <code> |
| | | 15 | | /// [NeedlrAiAgent(Instructions = "Synthesize all research findings.")] |
| | | 16 | | /// [AgentGraphNode("Research", JoinMode = GraphJoinMode.WaitAll)] |
| | | 17 | | /// public class SummarizerAgent { } |
| | | 18 | | /// </code> |
| | | 19 | | /// </example> |
| | | 20 | | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] |
| | | 21 | | public sealed class AgentGraphNodeAttribute : Attribute |
| | | 22 | | { |
| | | 23 | | /// <summary> |
| | | 24 | | /// Initializes a new <see cref="AgentGraphNodeAttribute"/>. |
| | | 25 | | /// </summary> |
| | | 26 | | /// <param name="graphName">The graph this node configuration applies to.</param> |
| | 14084 | 27 | | public AgentGraphNodeAttribute(string graphName) |
| | | 28 | | { |
| | 14084 | 29 | | ArgumentException.ThrowIfNullOrWhiteSpace(graphName); |
| | 14083 | 30 | | GraphName = graphName; |
| | 14083 | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <summary>Gets the graph name this node belongs to.</summary> |
| | 663 | 34 | | public string GraphName { get; } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Gets or sets how this node handles multiple incoming edges. |
| | | 38 | | /// Defaults to <see cref="GraphJoinMode.WaitAll"/> (barrier). |
| | | 39 | | /// </summary> |
| | 14121 | 40 | | public GraphJoinMode JoinMode { get; set; } = GraphJoinMode.WaitAll; |
| | | 41 | | } |