A hands-on, comprehensive workshop for .NET developers to build production-ready AI agents using Microsoft Agent Framework and the Model Context Protocol (MCP).
Building AI Agents with Microsoft Agent Framework and Model Context Protocol using .NET
2-day workshop for .NET Developers
Course Description
A hands-on, comprehensive workshop for .NET developers to build production-ready AI agents using Microsoft Agent Framework and the Model Context Protocol (MCP). This two-day intensive combines Microsoft's enterprise-grade agentic AI framework with the open standard for AI-context integration. You'll learn to create intelligent agents that orchestrate multiple services, integrate with business systems, and provide seamless user experiences—all while leveraging familiar .NET patterns and Microsoft.Extensions.AI abstractions.
Day 1 focuses on core concepts: building chat-based agents, implementing tools and function calling, working with multiple AI providers, and understanding agent orchestration patterns. Day 2 dives into advanced topics: integrating MCP servers and clients, building custom tools, implementing workflows with human-in-the-loop, security and identity integration, and preparing agents for production deployment.
Overall Learning Objectives
By the end of this workshop, participants will be able to:
- Understand the architecture and core concepts of Microsoft Agent Framework and how it builds on Microsoft.Extensions.AI.
- Create simple and multi-agent systems using different orchestration patterns (sequential, concurrent, handoff, magentic).
- Implement function calling and custom tools to extend agent capabilities.
- Integrate multiple AI inference services (Azure OpenAI, OpenAI, Ollama, Azure AI Foundry) using IChatClient abstraction.
- Understand and implement the Model Context Protocol (MCP) for standardizing AI context integration.
- Build MCP servers to expose resources, tools, and prompts to AI agents.
- Build MCP clients to consume context from external MCP servers.
- Implement workflows with conditional logic, external integrations, and checkpointing.
- Apply enterprise-grade security using Microsoft Entra Agent ID for agent authentication and authorization.
- Integrate agents with UI frameworks using the AG-UI protocol and CopilotKit.
- Monitor and observe agent behavior using OpenTelemetry and responsible AI features.
- Deploy and scale agents in production environments (containers, Azure, multi-cloud).
Day 1: Agent Framework Fundamentals
Modules & Agenda
Introduction to Agentic AI with .NET
- What are AI agents vs. traditional applications
- Microsoft Agent Framework overview and architecture
- Evolution: Semantic Kernel + AutoGen = Agent Framework (GA v1.0.0, current v1.1.0)
- Microsoft.Extensions.AI abstractions (IChatClient, IEmbeddingGenerator)
- Key capabilities: multi-agent orchestration, cloud/provider flexibility, enterprise features
- Standards-based interoperability: Agent-to-Agent (A2A) protocol and MCP
Building Your First Agent
- Setting up the development environment
- Creating a ChatClientAgent from an IChatClient
- Understanding agent configuration: instructions, model parameters, tools
- Running agents: Run() vs. RunStreamingAsync()
- Working with chat history and conversation context
- Structured output and response formats
Function Calling and Tools
- Understanding function calling in AI agents
- Creating AIFunction instances with AIFunctionFactory.Create()
- Tool execution lifecycle and error handling
- Approval modes and human-in-the-loop for sensitive operations
- Invoking command-line tools (CLI) directly from agents: wrapping shell commands and executables as AIFunctions without an MCP server
- Agent Skills: file-based and class-based skills using FileAgentSkillsProvider for script and executable invocation
- Best practices for tool design and security
Multi-Provider Integration
- Working with Azure OpenAI Service
- Integrating OpenAI directly
- Using local models with Ollama
- Azure AI Foundry integration
- Provider-agnostic design patterns
- Switching and comparing providers
Agent Orchestration Patterns
- Single agent vs. multi-agent systems
- Sequential orchestration: step-by-step agent chains
- Concurrent orchestration: parallel agent execution
- Handoff orchestration: specialized agent collaboration
- Magentic orchestration: lead agent directing other agents
- Group chat patterns for collaborative agents
Introduction to Model Context Protocol (MCP)
- What is MCP and why it matters
- MCP architecture: servers, clients, and transports
- Core MCP concepts: resources, tools, prompts, and sampling
- MCP C# SDK overview (ModelContextProtocol.* packages, now stable at v1.2.0)
- MCP ecosystem and the registry
- Standards-based context integration benefits
Hands-On Exercises (Day 1)
- Create your first agent with Azure OpenAI and test basic chat interactions
- Implement custom tools using AIFunctionFactory.Create() for file operations and external API calls
- Invoke CLI tools directly from an agent: wrap a shell command or executable as an AIFunction and test it without any MCP server
- Build a file-based skill using FileAgentSkillsProvider to expose scripts and executables as agent tools
- Build a function-calling agent with approval workflow for sensitive actions using ApprovalRequiredAIFunction
- Create a multi-agent system using handoff orchestration (e.g., triage → specialist agents)
- Implement a magentic orchestration pattern with a coordinator and specialized agents
- Set up Ollama locally and run the same agent with different providers
- Explore existing MCP servers from the registry and understand their capabilities
Outcomes (Day 1)
Participants can build single and multi-agent systems using Agent Framework, implement custom tools with AIFunctionFactory, invoke CLI tools and scripts directly as agent tools using Skills and AIFunctionFactory, work with multiple AI providers, and understand how MCP standardizes context integration.
Day 2: Advanced Topics and Production-Ready Agents
Modules & Agenda
Deep Dive: Model Context Protocol Implementation
- Building MCP servers with the C# SDK
- Implementing resources: exposing data sources to agents
- Implementing tools: server-side functions for agents
- Implementing prompts: reusable prompt templates
- Server transports: stdio, Streamable HTTP; legacy SSE transport now opt-in via EnableLegacySse
- Building MCP clients to consume external context
- Using McpClient to discover and invoke tools from servers
- Integrating MCP tools (McpClientTool) into Agent Framework agents
Building Custom MCP Tools and Resources
- Design patterns for MCP server architecture
- Exposing enterprise data sources as MCP resources
- Creating domain-specific tools with proper descriptions and schemas
- Handling authentication and authorization in MCP servers
- Sampling: allowing MCP servers to query LLMs via the client
- When to use MCP vs. direct CLI invocation: trade-offs between MCP servers and AIFunction/Skill-based tool wrappers
- Best practices for MCP server development and testing
Workflows and Advanced Orchestration
- Understanding Agent Framework Workflows
- Workflows vs. Agents: when to use each
- Executors and edges: building the workflow graph
- Conditional routing and dynamic execution paths
- External integration patterns: request/response, webhooks
- Checkpointing: save and resume long-running workflows
- Human-in-the-loop patterns in workflows
Agent Identity, Security, and Governance
- Microsoft Entra Agent ID overview (agent identity platform)
- Agent identity blueprints and agent identities
- Authentication and authorization for AI agents
- OAuth 2.0 and OIDC for agents
- Agent registry and discovery
- Responsible AI features: prompt injection protection, task adherence
- Security best practices for production agents
User Interfaces and Integration
- AG-UI protocol overview
- Integrating agents with CopilotKit
- ASP.NET Core integration: MapAGUI endpoint
- Server-Sent Events (SSE) for streaming responses
- Frontend tool calling and shared state
- Handling approvals and confirmations in the UI
- Building chat interfaces with AG-UI Dojo samples
Observability, Monitoring, and Deployment
- OpenTelemetry integration for agent observability
- Tracing agent execution and tool invocations
- Metrics and logging best practices
- Debugging and troubleshooting agents
- Containerizing agents for deployment
- Deployment patterns: Azure Container Apps, Kubernetes, on-premises
- Scaling strategies and performance optimization
- CI/CD pipelines for agent applications
Hands-On Exercises (Day 2)
- Build a custom MCP server exposing company data as resources and tools
- Create an MCP client that consumes multiple external MCP servers
- Integrate MCP tools from a custom server into an Agent Framework agent
- Implement a workflow with conditional routing, external API calls, and checkpointing
- Set up Microsoft Entra Agent ID for agent authentication
- Build a web UI for your agent using CopilotKit and the AG-UI protocol
- Add OpenTelemetry instrumentation to observe agent behavior
- Containerize and deploy an agent application to Azure Container Apps
Outcomes (Day 2)
Participants can implement production-ready agents with custom MCP integrations, workflows, security, UI, observability, and deployment strategies.
Target Audience
.NET developers, solution architects, and AI engineers building intelligent agent systems for enterprise applications. Suitable for those familiar with C#, ASP.NET Core, and cloud development.
Prerequisites
- Solid C# and .NET experience
- Familiarity with ASP.NET Core, dependency injection, and async programming
- Basic understanding of AI/LLMs and REST APIs
- Access to Azure subscription (for Azure OpenAI) or OpenAI API key
- Docker basics helpful for deployment exercises
Hands-On Lab Environment
Participants will work with:
- Visual Studio 2026 or Visual Studio Code with C# Dev Kit
- .NET 10 SDK
- Azure OpenAI Service or OpenAI API access
- Docker Desktop (for MCP servers and deployment)
- Sample MCP servers from the official registry
Materials Provided
- Complete sample code for all exercises
- Reference implementations of MCP servers and clients
- Agent orchestration pattern templates
- Deployment configuration samples
- Links to official documentation and resources
Summary
After two days, participants possess the skills to design, build, secure, and deploy production-grade AI agents using Microsoft Agent Framework and the Model Context Protocol. They understand how to integrate enterprise data sources, orchestrate multiple agents, implement workflows, and provide seamless user experiences—all within the .NET ecosystem and using open standards.
Advanced Learning Paths
After this workshop, participants can explore:
- Advanced Multi-Agent Patterns
- Building Domain-Specific Agent Systems (customer service, analytics, etc.)
- Agent-to-Agent (A2A) Protocol Deep Dive
- Responsible AI and Compliance for Agent Systems
- Large-Scale Agent Deployment and Monitoring
- Integration with Microsoft 365 and Microsoft Agent 365 SDK
- Building Custom Inference Services and Fine-Tuning