The Microsoft Agent Framework (MAF) is Microsoft's unified, production-minded SDK for building AI agents in .NET — the consolidation of Semantic Kernel and AutoGen into one stack. This is the developer's first guide to it, built entirely on the and .
Building AI Agents with C# and .NET 10 — A Developer's First Guide to the Microsoft Agent Framework. Companion code: 125 runnable projects across 20 chapters, built on MAF 1.20.0, .NET 10 and C# 14.
2026-10-28
स्टार
4
टूल
—
अपटाइम
—
stable 1.22.0 release
.NET 10 / C# 14
Across twenty chapters in five parts you go from your first call to an LLM, through tools and function calling, the Model Context Protocol, retrieval-augmented generation, and multimodal agents (vision), into multi-agent orchestration and workflows, all the way to hosting, observability, safety guardrails, agent skills, and evaluation. Every concept is anchored in a runnable companion project in this repository, and every code listing targets MAF 1.22.0 — no preview ceremony, no alpha-only attributes, no shifting namespaces.
By the final chapter you will have built the Contoso FAQ agent — a small but real production system — and developed the intuition to design, build, and ship your own.
Who this book is for
This book is written for .NET developers who want to build AI-powered agent systems without abandoning the tools and patterns they already know. You should be comfortable with C# fundamentals, have written at least one ASP.NET Core service or console application, and have a working relationship with dependency injection. If you can write a class, use LINQ, and navigate your IDE without a tutorial, you're ready.
No prior machine-learning background is assumed. The book explains what you need to know about how LLMs behave, from a developer's point of view, as you go.
Table of Contents
#
Chapter
Part
1
The AI Revolution in .NET
I — Foundations
2
C# Essentials for AI Development
I
3
How LLMs Work: A Developer's Mental Model
I
4
Setting Up Your Dev Environment
I
5
Hello, Agent!
II — Your First Agents
6
Conversations and Memory
II
7
Structured Output and Typed Responses
II
8
Tools and Function Calling
III — Giving Agents Superpowers
9
The Model Context Protocol
III
10
Introduction to RAG
III
11
Multimodal Agents
III
12
Multi-Agent Systems
IV — Multi-Agent Collaboration
13
Introduction to Workflows
IV
14
Hosting and Deployment
V — Going to Production
15
Observability and Debugging
V
16
Safety and Guardrails
V
17
Agent Skills
V
18
Evaluation
V
19
The Agent Harness
V
20
Your Next Steps
V
Plus five appendices — a themed package reference, a Semantic Kernel and AutoGen migration guide, a troubleshooting catalogue, a glossary, and worked solutions to every exercise — followed by a keyword index.
Companion code
125 runnable projects across 127 in total: 82 chapter samples under src/ and 45 worked exercise solutions under exercises/, plus two shared libraries. Each one is self-contained — you don't need to run everything to follow along, so pick the project for the chapter you're reading.
Target stack
.NET 10 (LTS) / C# 14
Microsoft Agent Framework 1.22.0 (the first paperback printing was verified against 1.20.0; every listing it prints builds and runs unchanged on 1.22.0)
Microsoft.Extensions.AI 10.9.0
Visual Studio 2026, or VS Code with the C# Dev Kit
Every package version is pinned centrally in Directory.Packages.props (Central Package Management); individual .csproj files reference packages without version numbers. The full, themed package list is Appendix A of the book.
A model provider. The samples default to Ollama running locally — zero cost, no API key — using llama3.2. They also support Azure OpenAI, OpenAI, Anthropic, and Microsoft Foundry. Chapter 4 walks through each one.
For the multimodal samples (Chapter 11), a vision-capable model — ollama pull llava locally, or a cloud GPT-5.6-class model.
For the zero-config local default:
ollama pull llama3.2
Clone & build
git clone https://github.com/RachidD68/building-ai-agents-with-csharp-and-dotnet-10.git
cd building-ai-agents-with-csharp-and-dotnet-10
dotnet build AgenticAI.slnx
Open AgenticAI.slnx once and every chapter's projects load together.
Run a sample
dotnet run --project src/Ch05.HelloAgent/Ch05.BasicAgent
Configuration
Provider settings live in each project's appsettings.json; secrets belong in a gitignored appsettings.local.json or in .NET User Secrets — never in source control. For example, to use Azure OpenAI:
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://YOUR-RESOURCE.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "YOUR-KEY"
Azure/Foundry auth uses DefaultAzureCredential (run az login once for local dev; scope the credential chain in production).
Worked exercise solutions (also indexed in Appendix E)
Exercise solutions
The exercises/ folder holds the full worked answers to every Practice Exercise in the book — 45 projects across Chapters 2–16, one folder per chapter. Each solution matches the brief printed in its chapter and reproduced in Appendix E, and each runs on its own:
dotnet run --project exercises/Ch08.Exercises/Ex01.UnitConverterTool
Try the exercise yourself first — the chapter gives you hints, and Appendix E walks through the reasoning before you reach for the code here.
Errata & feedback
Found a typo, an outdated API, a code sample that doesn't compile, or a factual mistake? Help make the next printing better:
📋 Open an errata report — guided form that asks for the page number, chapter, and what's wrong.
🔍 Browse known errata — see what's already been reported before filing a duplicate.
For general feedback, questions about the companion code, or suggestions, use the Issues tab without the errata label.
License
The companion code in this repository is released under the MIT License — use it, fork it, build on it freely.
The book itself is sold separately — available on Leanpub; the full copyright page is inside the book.
B
Building Ai Agents With Csharp And Dotnet 10
RachidD68·4 स्टार·
Building AI Agents with C# and .NET 10 — A Developer's First Guide to the Microsoft Agent Framework. Companion code: 125 runnable projects across 20 chapters, built on MAF 1.20.0, .NET 10 and C# 14.
अभी टूल सूची नहीं है। रिमोट सर्वर को पहले हेल्थ चेक के बाद सूची मिलती है।
FAQ
सवाल
Building Ai Agents With Csharp And Dotnet 10 कैसे इंस्टॉल करें?
इस पेज पर Cursor, Claude Desktop, Claude Code या VS Code के लिए stdio कॉन्फ़िग कॉपी करें। यह पब्लिशर का इंस्टॉल इस्तेमाल करता है, PlugMCP प्रॉक्सी नहीं।
क्या Building Ai Agents With Csharp And Dotnet 10 के लिए API key चाहिए?
इस रिकॉर्ड में कोई ज़रूरी एनवायरनमेंट वेरिएबल दर्ज नहीं है।
Building Ai Agents With Csharp And Dotnet 10 कौन सा ट्रांसपोर्ट इस्तेमाल करता है?
Building Ai Agents With Csharp And Dotnet 10 stdio पर लोकल चलता है।
Building Ai Agents With Csharp And Dotnet 10 की पिछली जाँच कब हुई थी?
पिछली जाँच 2026-10-28 को हुई। Building AI Agents with C# and .NET 10 — A Developer's First Guide to the Microsoft Agent Framework. Companion code: 125 runnable projects across 20 chapters, built on MAF 1.20.0, .NET 10 and C# 14.