.NET 10 is here — faster, smarter, and more powerful. What are you waiting for? Upgrade your skills today with us!
← Back to Blogs
AI & .NETNov 10, 2025
BUILD YOUR AI AGENTS IN .NET

Build AI Agents in .NET with Microsoft Workflow Agent Framework | Step-by-Step Tutorial 2025

👤 Rohan Kumawat⏱️ 15 min read

Build AI Agents in .NET with Microsoft Workflow Agent Framework | Step-by-Step Tutorial 2025

AI Agents are transforming modern applications by automating workflows, generating content, and executing intelligent tasks. In 2025, Microsoft introduced the powerful Workflow Agent Framework, enabling .NET developers to build fully automated, AI-driven agents with ease. This step-by-step tutorial will guide you through building AI Agents in .NET using Microsoft’s Workflow Agent Framework along with GitHub Models for intelligent processing.

What is the Microsoft Workflow Agent Framework?

The Microsoft Workflow Agent Framework is designed to help developers create structured AI workflows using .NET. It supports sequential flows, parallel processing, and multi-agent communication — making it perfect for automating tasks, building AI assistants, chatbots, and content-generation applications.

With this framework, AI Agents can follow instructions, handle user input, integrate with LLMs, and execute defined operations just like a human assistant.

Setting Up the Chat Client

To begin, you first configure a Chat Client that communicates with an LLM model. In this example, GitHub’s GPT model is used. Replace the API key with your own when implementing the code.

IChatClient chatClient = new ChatClient( "gpt-4o-mini", new ApiKeyCredential("github_pat_xxxxxxxxxxxxxxxxxxxxxxxxxx"), //add your github model token new OpenAIClientOptions { Endpoint = new Uri("https://models.github.ai/inference") }) .AsIChatClient(); AIAgent arabicAgent = new ChatClientAgent( chatClient, new ChatClientAgentOptions { Name = "HtmlCssTemplateAgent", Instructions = "You are an expert web developer who creates beautiful HTML and CSS templates. " + "When given a description of a website, you will generate a complete HTML and CSS code snippet that matches the description. " + "Ensure the code is well-structured, uses modern practices, and is visually appealing. " + "Provide only the code without any explanations or additional text.", }); Workflow workflow = AgentWorkflowBuilder .BuildSequential(arabicAgent); AIAgent workflowAgent = await workflow.AsAgentAsync(); Console.Write("\nYou:"); string userInput = Console.ReadLine() ?? string.Empty; AgentRunResponse workflowResponse = await workflowAgent.RunAsync(userInput); foreach(var message in workflowResponse.Messages) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(message.AuthorName+": "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(message.Text); Console.WriteLine(); }

How the Workflow Agent Works

The created workflow is sequential — meaning the agent processes tasks step-by-step in the specified order. The AI Agent uses the instructions you define, takes the user input, and generates the desired output such as HTML templates or automated responses.

You can extend this workflow to build multi-agent pipelines, integrate APIs, or perform automated decision-making based on user queries.

Running the Agent

Once the agent is configured, users can enter any prompt, and the system will process it through the workflow. The AI Agent then returns structured output, making it useful for .NET applications like admin dashboards, automation tools, or chat systems.

Conclusion

The Microsoft Workflow Agent Framework empowers developers to build next-generation AI automation in .NET. Whether you're constructing chatbots, creating code-generation tools, or designing enterprise automation, this framework gives you a scalable and future-ready approach for 2025 and beyond.

Experiment by adding more agents, parallel workflows, or custom tool integrations to unlock the full potential of AI inside your .NET applications.

Watch Full Video explanation here: https://www.youtube.com/watch?v=k2Z9PQl19Vo