| | | 1 | | namespace NexusLabs.Needlr.AgentFramework; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Marks the decorated agent as the entry point for a named graph workflow. |
| | | 5 | | /// Exactly one agent per graph must carry this attribute. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <remarks> |
| | | 8 | | /// <para> |
| | | 9 | | /// Graph-wide routing mode is declared here. Per-node overrides for routing |
| | | 10 | | /// mode can be specified on the first <see cref="AgentGraphEdgeAttribute"/> |
| | | 11 | | /// from a given source node. |
| | | 12 | | /// </para> |
| | | 13 | | /// </remarks> |
| | | 14 | | /// <example> |
| | | 15 | | /// <code> |
| | | 16 | | /// [NeedlrAiAgent(Instructions = "Analyze the request.")] |
| | | 17 | | /// [AgentGraphEntry("Research", RoutingMode = GraphRoutingMode.AllMatching)] |
| | | 18 | | /// [AgentGraphEdge("Research", typeof(WebAgent), Condition = "NeedsWebData")] |
| | | 19 | | /// [AgentGraphEdge("Research", typeof(SummaryAgent))] |
| | | 20 | | /// public class AnalyzerAgent { } |
| | | 21 | | /// </code> |
| | | 22 | | /// </example> |
| | | 23 | | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] |
| | | 24 | | public sealed class AgentGraphEntryAttribute : Attribute |
| | | 25 | | { |
| | | 26 | | /// <summary> |
| | | 27 | | /// Initializes a new <see cref="AgentGraphEntryAttribute"/>. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name="graphName">The name of the graph this agent is the entry point for.</param> |
| | 19898 | 30 | | public AgentGraphEntryAttribute(string graphName) |
| | | 31 | | { |
| | 19898 | 32 | | ArgumentException.ThrowIfNullOrWhiteSpace(graphName); |
| | 19897 | 33 | | GraphName = graphName; |
| | 19897 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary>Gets the graph name this agent is the entry point for.</summary> |
| | 1365 | 37 | | public string GraphName { get; } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets or sets the graph-wide default routing mode. Individual nodes can |
| | | 41 | | /// override this via a <c>RoutingMode</c> property on their first |
| | | 42 | | /// <see cref="AgentGraphEdgeAttribute"/>. |
| | | 43 | | /// </summary> |
| | 8268 | 44 | | public GraphRoutingMode RoutingMode { get; set; } = GraphRoutingMode.Deterministic; |
| | | 45 | | } |