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...

Agents that cannot retrieve will hallucinate about your business. Retrieval that cannot act is just a search box. Get both halves of the .NET AI stack — the Microsoft Agent Framework, RAG, MCP, GraphRAG, evaluation gates, and Azure deployment. 1,268 pages, 44 chapters, 174 runnable projects in C# 14 and .NET 10.
Bought separately
$86.98
Minimum price
$54.99
$74.99
About the Bundle
Two books, one stack.
Building AI Agents with C# and .NET 10 teaches you to build and orchestrate agents on the Microsoft Agent Framework — tools, workflows, multi-agent systems, and the runtime concerns that decide whether an agent survives contact with production.
Production-Grade RAG with C# and .NET teaches you to ground them in your own data — embeddings, chunking, hybrid retrieval, reranking, GraphRAG, evaluation gates, prompt-injection defense, and an EU AI Act-aware Azure deployment.
They are two halves of the same problem. An agent without retrieval is fluent and confident about a business it knows nothing about. Retrieval without an agent stops at the search box — it finds the passage but never acts on it. Together you get a system that can look something up, reason about what it found, and then do something with it.
In the bundle:
Both books are written for the same reader — a .NET developer with a few years of C# who wants to ship something real rather than a demo — and neither assumes you have read the other. Start with whichever problem is in front of you.
Most AI material is written for Python. This is the .NET path, end to end.
About the Books
Between the launch of ChatGPT and the GA release of the Microsoft Agent Framework in April 2026, a new class of .NET applications emerged: programs that hold a language model in one hand and a set of tools in the other, and decide for themselves how to string them together to reach a goal. The framework is ready. The guidance mostly isn’t — it lives scattered across API docs, conference talks, and GitHub samples pinned to preview builds that broke last Tuesday.
Building AI Agents with C# and .NET 10 is the picture on the puzzle box. Twenty chapters take you from your first LLM call in C# to a production-hosted, observability-instrumented, safety-filtered multi-agent system, all on the stable, generally available surface of Microsoft Agent Framework 1.20, .NET 10 LTS, and C# 14.
You will learn how to:
• Build your first ChatClientAgent, give it a persona, and expose it over HTTP with Minimal API
• Solve the amnesia problem with sessions, history providers, and context providers
• Get typed C# records back from the model instead of strings you have to regex
• Give agents tools and function calling, with human-in-the-loop approval for the dangerous ones
• Build and consume Model Context Protocol (MCP) servers in C#
• Ground answers in your own documents with retrieval-augmented generation
• Send images, audio, and video to multimodal agents — and treat them as untrusted input
• Coordinate specialists with multi-agent orchestration and typed workflow graphs
• Host agents with ASP.NET Core and .NET Aspire, and instrument them with OpenTelemetry
• Layer guardrails against the OWASP LLM Top 10 and the OWASP Top 10 for Agentic Applications
• Package domain expertise as Agent Skills and measure quality with local and cloud evaluation
• Compose the whole stack into one object with the Agent Harness — and know when not to
Along the way you build the Contoso FAQ agent, a small but real production system that grows chapter by chapter until it ships: hosted, observable, guarded, and evaluated.
What makes this book different is discipline. Every listing compiles and runs, and every one is paired with its expected console output, so you know what success looks like before you press F5. Chapters follow an Explain–Demonstrate–Practice rhythm. Exercises come in three tiers (Basic, Intermediate, Challenge) with full worked solutions in Appendix E. The companion repository — one solution, 125 runnable projects — works against Azure OpenAI, OpenAI, Microsoft Foundry, or a local Ollama model with a single configuration change, and ships a dedicated helper for Anthropic.
Written for intermediate C# developers. No AI or machine learning background required: if you can write a class, use LINQ, and wire up dependency injection, you’re ready. Coming from Semantic Kernel or AutoGen? Appendices B and C are your migration maps.
Buying for a team? Volume licenses are available from 3 copies, with team pricing up to 40% off for larger groups — one purchase, one invoice, a copy for everyone.
The companion code lives at https://github.com/RachidD68/building-ai-agents-with-csharp-and-dotnet-10
Production-Grade RAG with C# and .NET is the complete guide to building Retrieval-Augmented Generation systems on the Microsoft stack — from an 80-line Hello World to a fully deployed, audited, EU AI Act-aware Azure pipeline.
Most RAG material is written for Python. This book is written for you: a .NET developer with a few years of C# experience who wants to ship something real with your company's data. Across seven parts, twenty-five chapters and 682 pages, you'll build Contoso SmartDocs, a running enterprise project that grows chapter by chapter into a production system spanning six document silos — powered by the Microsoft Agent Framework 1.20, Microsoft.Extensions.AI, Azure AI Search, Qdrant, Neo4j, and .NET 10 / C# 14.
You'll learn to:
• Build the core pipeline component by component: embeddings, chunking with Anthropic's Contextual Retrieval, multimodal content, vector databases, indexing strategies, hybrid retrieval with RRF, reranking, and first-class SSE streaming
• Add query intelligence: metadata filters, query construction, routing, and conversational multi-turn rewriting
• Go beyond vectors with graph databases, hybrid storage, GraphRAG, LazyGraphRAG, and Vectorless RAG
• Serve retrieval as a tool over the Model Context Protocol — on the current 2026-07-28 revision of the spec — and orchestrate multi-agent RAG workflows with agentic memory
• Ship it for real: a 100-query golden eval gate on every pull request, latency and cost optimization, drift and model migration, prompt-injection defense, grounded citations, EU AI Act audit logging, and a full Bicep-deployed Azure capstone
Every chapter ships runnable code in the companion repository. Every snippet traces to a specific file. Every sample compiles; all 458 tests pass on a clean clone. The architecture is deliberately clean — small, named interfaces with swappable implementations — so what you learn maps directly onto the system you need to build, not just the one in the book.
Nine appendices round it out: worked exercise solutions, a design-pattern flashcard set, a vector database comparison, embedding benchmarks, a Python-to-.NET Rosetta Stone for readers arriving from LangChain or LlamaIndex, a debugging decision tree, prompt patterns, and the math behind RAG. A page-numbered index closes the book.
This is the production-concerns RAG book the .NET ecosystem has been missing. If you can write C#, you can ship RAG.
Buying for a team? Volume licenses are available from 3 copies, with team pricing up to 40% off for larger groups — one purchase, one invoice, a copy for everyone.
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
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
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
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.