Microsoft Agent Framework and Needlr: C# workflow tutorial
Learn to wire C# agents with Needlr source generation, then route questions through a triage workflow using an Azure Open AI client.
Player not loading? Watch on YouTube
This introductory tutorial builds a C# multi-agent workflow with Microsoft Agent Framework and Needlr. The presenter uses an Azure Open AI client with deployed models, reading the endpoint, API key and deployment name from configuration. The example uses a cloud service; it does not demonstrate running models locally.
Needlr handles dependency scanning and registration across a separate agents assembly. The presenter explains its reflection and source generation paths, including why he keeps them separate for AOT and trimming. Agent attributes describe prompts and handoff conditions, while generated factory methods provide named entry points for creating agents and workflows.
The demonstration starts with a triage agent that delegates questions to geography or lifestyle agents. It uses a sequential handoff rather than a conversation in which agents repeatedly take turns. Function groups determine which C# functions each specialist can call, and dependency injection supplies those functions with their dependencies.
One answer contains biographical details that the presenter says are false. He traces them to the demo's data provider rather than an unsupported model guess. He also stresses that Needlr is optional: its generated helpers reduce boilerplate around capabilities available in Microsoft Agent Framework itself.