Leanpub Header

Skip to main content

Microsoft Agent Framework in .NET

Build production-ready AI agents and multi-agent systems in C#

This book is 70% completeLast updated on 2026-08-10

A practical, code-first guide to building production-ready AI agents and multi-agent systems in C# with Microsoft Agent Framework, Microsoft.Extensions.AI, tools, context, orchestration, observability, workflows, and enterprise-ready patterns.

Minimum price

$29.99

$39.99

You pay

Author earns

$

Also available for 2 book credits with a Reader Membership

PDF
About

About

About the Book

Thank you for purchasing Microsoft Agent Framework in .NET: Build production-ready AI agents and multi-agent systems in C#.

This book helps .NET developers bridge the gap between conventional application development and agentic AI. You’ll learn how to use Microsoft Agent Framework—the unified SDK that brings together strengths from Semantic Kernel and AutoGen—to build practical, reliable AI agents and multi-agent systems in C#.

I wrote this book for intermediate and advanced C# developers who want to apply generative AI without first becoming AI specialists. Through clear explanations and hands-on examples, you’ll learn to design agents that integrate models, tools, context, workflows, and enterprise concerns such as observability, reliability, and governance.


This book goes beyond simple LLM integration. It equips you with practical patterns for building reliable, scalable agentic applications that address real-world needs—whether you are developing enterprise systems, experimenting with personal projects, or creating new products.

Happy coding and AI exploration!

—Daniel Costea

.NET software engineer, AI specialist, technical author, and Microsoft MVP for AI and .NET

Author

About the Author

Daniel Costea

Daniel Costea is a Senior AI Software Engineer with more than 20 years of experience building software with .NET technologies and artificial intelligence. Passionate about C# since its release in 2001, he has delivered more than 1,200 hours of .NET training to over 700 developers worldwide.

Daniel is a Microsoft MVP in both AI and .NET, recognized since 2019 for his technical expertise and community contributions. He is also an international speaker who has presented at major conferences across Europe and the United States for the past eight years.

He writes practical, code-first resources for .NET developers building AI-powered applications, agents, and multi-agent systems. He is the author of more books and writes technical articles on .NET and AI.

Contents

Table of Contents

  • 1 From conventional code to agents
  • 2 Building your first agent step by step
  • 3 Building chat clients for model providers
  • 4 Building responses and self-hosted clients
  • 5 Crafting agents from scratch
  • 6 Equipping agents with tools
  • 7 Adding agent memory with context and chat message history
  • 8 Standardizing tools using MCP (Model Context Protocol)
  • 9 Building enterprise-ready agents with ChatClient middleware
  • 10 Building enterprise-ready agents with Agent middleware
  • 11 Preparing reliable agents with observability and evaluation
  • 12 Orchestrating agents using sequential and concurrent patterns
  • 13 Iterative reasoning using the group chat pattern
  • 14 Conditional routing using the handoff pattern
  • 15 Orchestrating agents dynamically using AI skills
  • 16 Building custom orchestration using workflows

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub