Overview

1 From Conventional Code to Agents

Chapter 1 introduces the shift from conventional software development toward agentic AI in the .NET ecosystem. It explains how generative AI and Large Language Models have expanded AI from prediction and classification into content generation, reasoning, summarization, code assistance, and conversational interfaces. The chapter frames Microsoft Agent Framework as a practical SDK for .NET developers who want to build applications where AI agents can reason, use tools, coordinate workflows, and integrate with real systems rather than simply call an LLM API.

The chapter presents Agent Framework as a production-oriented foundation that combines ideas from Semantic Kernel and AutoGen into a unified approach for building single-agent and multi-agent systems. It highlights capabilities such as orchestration, provider integration, tool calling, graph-based workflows, observability, checkpointing, governance, human approval flows, and support for open standards such as MCP, A2A communication, and OpenAPI. It also positions Agent Framework within the broader .NET AI stack, explaining that it builds on Microsoft.Extensions.AI, which provides common abstractions for chat clients, embeddings, and function invocation across different model providers.

The chapter also compares Agent Framework with related tools. Microsoft.Extensions.AI is described as sufficient for simple prompt-response interactions, while Agent Framework is useful when applications need agents, tools, context, orchestration, and lifecycle control. LangChain is presented as flexible and popular in the Python ecosystem, whereas Agent Framework is more naturally aligned with C#, .NET, and enterprise integration. ML.NET is described as complementary: it supports traditional machine learning and some local model scenarios, while Agent Framework focuses on orchestrating LLM-powered agents. Finally, the chapter outlines basic agent architecture, from stateless prompt-to-response flows to richer agents that use context, tools, providers, middleware, sessions, checkpointing, observability, and governance for production-ready systems.

Microsoft AI stack dependencies: Microsoft.Agents.AI uses Microsoft.Extensions.AI, which uses a variety of providers, such as Microsoft.Extensions.AI.OpenAI, Microsoft.Extensions.AI.AzureAIInference, and Microsoft.Extensions.AI.Ollama.
This image compares human cognitive processes with Agent Framework’s architecture, showing how sensory systems (such as eyes and ears) gather data, how the brain processes it and forms memories, and how the mind filters irrelevant stimuli while focusing on important details—simulating planning and adaptation. (Image generated using Bing Copilot)
Agent components showing context, tools, and providers as core resource modules.
The diagram presents a lower-level view, showing the agent’s three primary resources (Context, Tools, and Providers) and the components of each.
The Stateless Agent Architecture diagram shows how an agent queries a model provider via a chat client to produce a result.
The Agent Architecture diagram shows how an Agent enriches a Prompt with Context, queries a Model Provider via a Chat client, optionally calls Tools, and iterates until it produces a Result.

Summary

  • What generative AI, LLMs, and agentic AI mean, and how they differ from traditional machine learning.
  • Why production integration is difficult: fragmented providers, reliability, security, governance, and lifecycle complexity.
  • What Agent Framework is and how it supports single- and multi-agent applications in .NET.
  • How Agent Framework builds on Microsoft.Extensions.AI to stay provider-agnostic across multiple model backends.
  • Where Agent Framework fits relative to LangChain and ML.NET in the broader AI and .NET ecosystem.
  • The core building blocks of agents are: tools, context, providers, and how they map to human cognitive functions.
  • Key orchestration patterns include sequential, concurrent, group chat, and handoff patterns, represented as workflows and graphs.
  • Enterprise capabilities for agents are identity, security, content safety, governance, and inventory management.
  • Observability, durability, and human-in-the-loop support using OpenTelemetry, Azure Monitor, and Application Insights.

FAQ

What is Microsoft Agent Framework?

Microsoft Agent Framework is an SDK for building AI agents and multi-agent workflows in .NET. It helps developers define agents, connect them to LLMs and other services, and coordinate them into reliable workflows without manually wiring together models, tools, and orchestration logic.

Why does the chapter use the name Agent Framework instead of Microsoft Agent Framework?

The chapter uses Agent Framework as a shorter name for readability and brevity. The official name remains Microsoft Agent Framework.

How is generative AI different from earlier AI systems?

Earlier AI systems usually focused on classification and prediction, such as detecting spam, recommending products, or forecasting trends. Generative AI systems create new content, including text, images, music, video, voice, and code, based on patterns learned from existing data.

What role do Large Language Models play in generative AI applications?

Large Language Models, or LLMs, are core components in many generative AI applications. They are transformer-based neural networks trained on very large text datasets. By predicting the most likely next token from a given context, they can perform tasks such as text generation, summarization, conversation, and code completion.

Why was Agent Framework introduced?

Agent Framework was introduced to help developers manage the complexity of integrating generative AI into production systems. It streamlines connecting, orchestrating, and monitoring models from different providers while helping with issues such as evolving APIs, provider differences, security, error handling, rate limits, and cost constraints.

What are the key enterprise features of Agent Framework?

Agent Framework includes enterprise-focused features such as security and governance controls, OpenTelemetry-based observability, checkpointing for long-running workflows, durable execution with pause and resume support, retry and error handling, and Human-in-the-Loop approval for critical operations.

How does Agent Framework relate to Microsoft.Extensions.AI?

Agent Framework is built on top of Microsoft.Extensions.AI. Microsoft.Extensions.AI provides standard .NET abstractions such as IChatClient, IEmbeddingGenerator<TInput, TEmbedding>, AIFunction, and AIFunctionFactory. These abstractions make it easier to work with different AI providers using common interfaces. Agent Framework builds on this foundation to add agent orchestration, tools, context, workflows, and multi-agent capabilities.

When should I use Microsoft.Extensions.AI without Agent Framework?

If your application only needs to send prompts to an AI provider and receive responses, Microsoft.Extensions.AI may be sufficient on its own. It supports chat completions, streaming, tool invocation, embeddings, dependency injection, and middleware composition. Agent Framework becomes useful when you need agents, orchestration, context, tools, workflows, or multi-agent collaboration.

How does Agent Framework compare with LangChain and ML.NET?

LangChain is popular in the Python ecosystem and focuses heavily on LLM chains and flexible prompt-based workflows. Agent Framework is a natural fit for C# and .NET developers, with stronger emphasis on enterprise integration, modularity, and advanced multi-agent orchestration. ML.NET, by contrast, focuses on traditional machine learning and AutoML scenarios. Agent Framework and ML.NET are complementary: ML.NET can support machine learning tasks, while Agent Framework orchestrates LLMs, tools, services, and agent workflows.

What are the primary components of an agent in Agent Framework?

The chapter describes three primary resource groups for an agent: Context, Tools, and Providers. Context includes instructions, chat history, sessions, RAG, and memory providers. Tools include conventional C# code, MCP tools, OpenAPI-based integrations, APIs, databases, and other actions. Providers include model services such as OpenAI, Azure OpenAI, Azure AI Foundry, Ollama, Anthropic, and ONNX-backed models.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building AI Agents in .NET ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building AI Agents in .NET ebook for free