< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.AgentGraphEntryAttribute
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/AgentGraphEntryAttribute.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 45
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
.ctor(...)100%11100%
get_GraphName()100%11100%
get_RoutingMode()100%11100%

File(s)

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

#LineLine coverage
 1namespace 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)]
 24public 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>
 1989830    public AgentGraphEntryAttribute(string graphName)
 31    {
 1989832        ArgumentException.ThrowIfNullOrWhiteSpace(graphName);
 1989733        GraphName = graphName;
 1989734    }
 35
 36    /// <summary>Gets the graph name this agent is the entry point for.</summary>
 136537    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>
 826844    public GraphRoutingMode RoutingMode { get; set; } = GraphRoutingMode.Deterministic;
 45}