AgentGraphEdgeAttribute
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework¶
AgentGraphEdgeAttribute Class¶
Declares a directed edge from the decorated agent to the specified target agent type within a named graph workflow. Apply multiple times for fan-out (multiple outgoing edges from one agent).
Inheritance System.Object 🡒 System.Attribute 🡒 AgentGraphEdgeAttribute
Example¶
[NeedlrAiAgent(Instructions = "Analyze the request.")]
[AgentGraphEntry("Research")]
[AgentGraphEdge("Research", typeof(WebAgent), Condition = "NeedsWebData")]
[AgentGraphEdge("Research", typeof(SummaryAgent))]
public class AnalyzerAgent { }
Remarks¶
Edge placement follows the same convention as AgentHandoffsToAttribute: the attribute is placed on the source agent and references the target.
When Condition is set, the edge is conditional. In Deterministic mode, the condition string names a predicate method on the agent class. In LlmChoice mode, the condition string becomes a tool description for LLM-based routing.
Constructors¶
AgentGraphEdgeAttribute(string, Type) Constructor¶
Initializes a new AgentGraphEdgeAttribute.
Parameters¶
graphName System.String
The name of the graph this edge belongs to.
targetAgentType System.Type
The downstream agent type.
Properties¶
AgentGraphEdgeAttribute.Condition Property¶
Gets or sets the optional routing condition. Interpretation depends on the graph's GraphRoutingMode. When null, the edge is unconditional.
Property Value¶
AgentGraphEdgeAttribute.GraphName Property¶
Gets the graph name this edge belongs to.
Property Value¶
AgentGraphEdgeAttribute.HasNodeRoutingMode Property¶
Gets whether NodeRoutingMode was explicitly set on this edge. When false, the graph-wide routing mode is used.
Property Value¶
AgentGraphEdgeAttribute.IsRequired Property¶
Gets or sets whether this edge's target is required for graph success. When true (default), a failure in the target node fails the entire graph. When false, the branch is marked degraded but parallel branches continue.
Property Value¶
AgentGraphEdgeAttribute.NodeRoutingMode Property¶
Gets or sets a per-node routing mode override for the source node of this edge. When set on any edge from a given source node, this overrides the graph-wide RoutingMode for that node's outgoing edges. Only needs to be set on one edge per source node (the generator reads the first non-null value). Use HasNodeRoutingMode to check if a value was explicitly set.
Property Value¶
AgentGraphEdgeAttribute.TargetAgentType Property¶
Gets the downstream agent type.