AgentHandoffsToAttribute
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework¶
AgentHandoffsToAttribute Class¶
Declares a handoff target for a NeedlrAiAgentAttribute-annotated agent. Apply this attribute one or more times to specify which agents the decorated agent can hand off to when used as the initial agent in a handoff workflow via CreateHandoffWorkflow<TInitialAgent>().
Inheritance System.Object 🡒 System.Attribute 🡒 AgentHandoffsToAttribute
Example¶
[NeedlrAiAgent(Instructions = "Triage incoming customer requests.")]
[AgentHandoffsTo(typeof(BillingAgent), "Route billing or payment questions to the billing agent")]
[AgentHandoffsTo(typeof(SupportAgent), "Route general support requests to the support agent")]
public class TriageAgent { }
// The source generator emits:
// workflowFactory.CreateTriageAgentHandoffWorkflow()
// which wires all handoffs without requiring direct type references at the call site.
Remarks¶
When the NexusLabs.Needlr.AgentFramework.Generators package is referenced, the source
generator emits a strongly-typed extension method (e.g. CreateTriageHandoffWorkflow)
on IWorkflowFactory for each agent type that carries this attribute. The generated
method encapsulates the agent type so the composition root requires no direct type references.
Constructors¶
AgentHandoffsToAttribute(Type, string) Constructor¶
Initializes a new instance of AgentHandoffsToAttribute.
Parameters¶
targetAgentType System.Type
The type of the target agent. Must be annotated with NeedlrAiAgentAttribute.
handoffReason System.String
A description of when the decorated agent should hand off to targetAgentType. Passed to the underlying MAF handoff builder as the tool description. When null, MAF derives the reason from the target agent's description or name.
Properties¶
AgentHandoffsToAttribute.HandoffReason Property¶
Gets the optional reason describing when to hand off to TargetAgentType.
Property Value¶
AgentHandoffsToAttribute.TargetAgentType Property¶
Gets the type of the target agent to hand off to.