Contact us

Building AI Agents on .NET: Microsoft Agent Framework, Semantic Kernel, and MCP

15 mins read

how to create an ai agent from scratch
Blog Calculator Widget Logo

Estimate Your Software Project Cost

Describe your idea — get a budget breakdown in minutes.

Get Your Estimate

Leona, Leobit’s AI agent designed to find promising cooperation opportunities and automatically send requests for proposals (RFPs), has helped our sales team increase leads from outsourcing platforms by 20%. This is just one example of how AI agents can deliver business value through automation and intelligent support of company workflows. No wonder that in 2025, 61% of CEOs emphasized actively adopting and scaling AI agents across industries.

But the path to adopting such AI systems is not free from challenges. Common obstacles include giving an AI agent secure access to your system, ensuring its outputs are consistent and relevant, and integrating human oversight naturally into the workflow.

Microsoft has spent the past year consolidating the answers to these problems. The practical solution is now built into the Microsoft ecosystem: Semantic Kernel, Microsoft Agent Framework, and the Model Context Protocol (MCP) form one connected stack for building, connecting, and running agents in production. Moreover, this stack seamlessly integrates with .NET, making it an optimal choice for building AI agents on top of .NET-based systems.

This article breaks down the roles of each technology in AI agent development and outlines the benefits of such an approach. Here, you’ll also find a practical guide on how to build an AI agent using Semantic Kernel, Microsoft Agent Framework, and MCP.

What Are AI Agents and What Can They Cover?

An AI agent is a system that uses artificial intelligence capabilities to analyze its environment, process information, and make decisions to accomplish specific goals. Such a solution can act as a company’s virtual AI-powered employee. It typically relies on a large language model (LLM) that accesses task-specific information from the company’s curated knowledge base.

There are different classifications of AI agents. For example, we can sort them by decision-making style:

  • Simple reflex agents react to current input with fixed rules. They have no memory of the past.
  • Model-based reflex agents keep an internal model of the world to handle situations the current input alone can’t explain.
  • Goal-based agents plan actions toward a defined objective.
  • Utility-based agents weigh multiple possible outcomes and pick the one that maximizes a defined “value.”
  • Learning agents improve their behavior over time from feedback and new data.

Business agents built on LLMs don’t fit neatly into just one category. They’re mostly goal-based with a learning layer on top.

 Book Icon

AI agents can vary in their architecture, but many share a common pattern. Most include:

  • Model. The reasoning engine, typically an open-source or a custom corporate LLM.
  • Instructions. The system prompt that defines the agent’s role, boundaries, and escalation principles.
  • Tools. Services and technologies the model can use to follow the instructions. Tool access is what turns a language model into an agent.
  • Memory. Conversation history and long-term storage, allowing the agent to build its outputs on previous interactions.
  • Orchestration. The loop that routes between the model, tools, and memory and can trigger retries.

With such an architecture, the typical AI agent workflow looks as illustrated in the image below.

ai agent architecture diagram
AI agent workflows

As for their practical implementations, AI agent use cases can vary across business workflows, including customer support, document processing and management, knowledge search, analytics, etc. Depending on the agent’s purpose, it can boost workflow efficiency, improve customer experience, ensure more precise decision-making, and provide your employees with a consistent knowledge base required for their operations.

Sometimes, AI agents also unite into larger, multi-agent systems capable of covering complex, multi-step workflows. Such agentic systems can act proactively thanks to their ability to plan, execute, and adjust across a whole workflow with less human oversight.

The distinction matters for scoping a project: a single well-tooled agent often handles a defined task better and with far less complexity than an agentic AI setup built too early. Multi-agent architectures are a good fit when one agent’s instructions start pulling in different directions, tasks genuinely need to run in parallel, or distinct toolsets are difficult to manage under a single model.

 Book Icon

Just as AI agents come in different types, there’s more than one way to build and deploy them. This article focuses specifically on AI agent development with tools from the .NET stack used in combination with MCP.

Microsoft Agent Framework, Semantic Kernel, and MCP: An Overview of Technologies

In line with Azure AI consolidation trend, Microsoft now offers a single connected toolset for AI agent development. All these tools work well in combination with .NET.

What is Semantic Kernel?

Semantic Kernel is Microsoft’s original SDK for building LLM-powered applications on .NET, Python, and Java. It includes plugins, prompt templates, connectors to Azure OpenAI and other model providers, and memory management. Since 2023, it’s been the standard way for .NET teams to wire an LLM into an enterprise application.

Take an AI-powered HR assistance agent as an example. A plugin can pull an employee’s leave balance from the HR system, a prompt template shapes how the agent answers policy questions in the company’s tone, and the connector routes the reasoning to the AI model. AI agent memory lets the solution recall earlier turns in the conversation, so an employee can ask a follow-up question about their request without repeating context. Semantic Kernel provides tools to connect different parts of the system.

What is Microsoft Agent Framework?

Announced for preview in October 2025 and released as version 1.0 in April 2026, Agent Framework is Microsoft’s unified SDK for building and orchestrating agents. It merges Semantic Kernel’s enterprise plumbing, such as session state, type safety, middleware, and telemetry, with the multi-agent orchestration patterns from AutoGen, Microsoft’s earlier research framework.

Microsoft Agent Framework has its own abstractions, functions, and pipelines, but it can also build on top of Semantic Kernel. Agent Framework’s native abstractions are an effective default for new projects, while Semantic Kernel makes more sense for stable existing systems, or when its plugin and templating features are a better fit. For teams already running Semantic Kernel in production, that path avoids the cost and risk of re-architecting a working system just to move to a newer framework. In this article, we will focus on the second approach.

In this AI agent architecture, Semantic Kernel handles the plugin and connector layer underneath, while Microsoft Agent Framework adds graph-based workflows to coordinate multiple agents, human-in-the-loop checkpoints, and production concerns like observability.

 Book Icon

In an AI-powered sales assistant built with Microsoft Agent Framework, Semantic Kernel, and MCP, one agent handles the live call and qualifies the lead. It then hands the conversation to a second agent, which checks pricing and inventory before the first agent responds. Agent Framework’s graph-based workflows manage this handoff and save a checkpoint at each step. If the pricing lookup fails mid-call, the conversation can recover instead of dropping the customer.

What is MCP?

MCP is an open standard, originally introduced by Anthropic, for connecting AI agents to external tools and data sources through a consistent interface. It removes much of the need to build custom integrations for every database, API, or file system an agent needs to access. Agent Framework 1.0 includes native MCP client support, allowing agents to call MCP tools directly without a custom bridge.

 Book Icon

For example, in a database querying assistant developed by Leobit, MCP provides a consistent way for the AI model to access the database and retrieve the information it needs.

Where does .NET fit?

A .NET-based software back end integrates with Semantic Kernel, Microsoft Agent Framework, and MCP seamlessly. The engineers who already maintain a .NET-powered application can build and own the agent, using tools they already know for hosting, monitoring, and configuration. That translates into a faster path to production and a lower total cost than running AI as a parallel, disconnected system.

Benefits of AI Agent Development with Microsoft Agent Framework, Semantic Kernel, and MCP

Why is building AI agents on the .NET stack such a convenient option? First, the consistency and interoperability of Microsoft-backed technologies make development more efficient. But there are other benefits, too, and a practical roadmap can help you build AI agents on .NET more effectively.

One connected stack instead of a patchwork of vendors

Semantic Kernel handles the plugin and connector layer, Agent Framework adds orchestration and production controls on top, and MCP standardizes how agents reach external systems. All three technologies come from a single vendor, with one support relationship and one roadmap to track instead of three. This makes development easier and eliminates most integration and connectivity challenges.

Simple integration with existing .NET-based solutions

Teams with a .NET backend don’t need a separate runtime, deployment pipeline, or hosting model for the agent layer. Semantic Kernel and Agent Framework run as ordinary .NET packages via NuGet, register through standard dependency injection, and deploy through the same CI/CD and hosting infrastructure (Azure App Service, AKS, Azure Functions) already in use. The agent becomes another service in the existing solution, which also improves performance and time-to-release.

 Book Icon

Enterprise-ready by default

Session state, type safety, middleware, and built-in telemetry provided by Microsoft Agent Framework mean an agent built this way starts closer to production-ready than a framework-agnostic prototype. Paired with MCP’s standardized tool access, teams spend less time on integration plumbing and more on the agent’s actual logic, improving the product’s business value.

Faster, safer integration with company systems

MCP removes the need to hand-build a connector for every CRM, database, or internal API an agent touches. Combined with Agent Framework’s middleware and human-in-the-loop checkpoints, that means you can add new data sources without reopening the question of how the agent is governed and monitored. These features let businesses roll out AI agents faster and more easily.

A migration path built for growth

A team can start with a single Semantic Kernel-powered agent, and later add Agent Framework’s orchestration once multiple agents are genuinely needed. You can extend tool access at any point via MCP, without re-architecting the solution already in production. This makes such a combination suitable for projects that are likely to grow over time.

How to build an AI agent with the Microsoft stack? A practical guide

The path to creating an AI agent with .NET can vary, but there’s a general pattern for building these solutions.

ai agent builder
Building an AI agent on .NET: A step-by-step approach

Below, we outline the critical steps:

  1. Define the agent’s job narrowly. Start with one workflow with a clear, machine-checkable success condition. Map out the exact workflow that requires AI support, such as document processing, customer communication, or analytics.
  2. Establish the model connection. At this stage, your team configures Semantic Kernel’s connector layer to point to Azure OpenAI, Microsoft Foundry, or another supported provider.
  3. Expose your tools as MCP servers. Software engineers wrap the databases, APIs, and internal systems the agent needs to use inside an MCP server, giving the agent a standard interface to call them through. Even if the underlying API or configuration later changes, that MCP interface stays the same.
  4. Build the agent in Agent Framework. The AI development team defines the agent’s capabilities using Agent Framework’s AIAgent abstraction, then wires in the MCP tools through its function-calling layer.
  5. Add guardrails through middleware. Microsoft Agent Framework’s middleware pipeline lets your team build approval steps for high-stakes actions directly into the workflow, so agent outputs are properly validated before they take effect. This is also the stage to set up monitoring, configure tool-call logging, and add rate limits where needed.
  6. (Optional) Move to graph-based orchestration for multi-agent workflows. If the task genuinely needs more than one agent, your engineers can use Agent Framework’s workflow graphs to structure the process. It supports sequential, concurrent, and handoff patterns.
  7. Test under real conditions before rollout. Run the agent against actual data and edge cases. Clean demo scenarios won’t surface the problems that show up in real-world use. A solid trial run is the only way to know how the agent actually performs.

Using the combination of Semantic Kernel, Microsoft Agent Framework, and MCP, all running naturally on .NET, your team can build a production-ready AI agent in a relatively short time. Timelines can range from weeks to months, depending on your agent’s purpose and complexity.

Having an approximate roadmap for building an AI agent on .NET is a good starting point, but real challenges tend to surface once implementation begins. Using all these tools properly and turning them into an agent that delivers actual business value takes a team with strong expertise in AI agent development services and equally strong experience in the Microsoft ecosystem.

That’s where Leobit comes in.

How Can Leobit Help You Build AI Agents Using the Microsoft Stack?

We bring hands-on AI expertise backed by our own experience with AI transformation. Our teams have established an AI-native software development lifecycle. In fact, Leobit’s engineering team received the Gold Stevie Award as Technology Team of the Year for its AI-driven software delivery model that embeds AI into the entire delivery process and helps customers bring their products to market faster.

Over the past year, the company has scaled AI across its internal teams and expanded its AI transformation services, from AI readiness assessments and discovery workshops to corporate LLMs, AI agents, multi-agent systems, and AI-native software delivery, supporting organizations at every stage of AI maturity.

Leobit also holds Microsoft Solutions Partner designations for Digital & App Innovation and Data & AI, backed by a team of 78 Microsoft- and Azure-certified engineers. We use Azure AI services and Azure AI Foundry to build custom AI solutions across industries. Our broader Microsoft expertise extends to Blazor, ASP.NET, .NET MAUI, Dynamics 365, and Power BI. That range means we can connect an agent to the CRMs, dashboards, and line-of-business applications a client already runs on Microsoft technology.

Leobit works with Semantic Kernel and Microsoft Agent Framework as part of its agentic AI practice, and has shipped MCP-based solutions. In particular, our team has built Leonardo, our AI-powered HR assistant, a database querying AI agent relying on MCP, and Leora, our AI-powered voice sales assistant.

Final Thoughts

The success in building an AI agent on .NET lies in assembling the right stack where each piece does one job well. An optimal option is using:

  • Semantic Kernel for plugins, prompt templates, connectors to model providers, and memory management
  • Microsoft Agent Framework for AI agent orchestration and production guardrails
  • MCP for connecting your agent to external tools and data sources

The upside of doing this on .NET specifically is that none of it requires a parallel stack. The same engineers, the same hosting infrastructure, the same monitoring already in place for your application can carry the agent too. That’s less a technical convenience than a business one because AI can easily become a natural extension of the software you already run.

But even the best stack cannot replace careful scoping and solid technical expertise in AI agent development. That’s exactly the kind of expertise Leobit can provide. Whether you need to build an AI agent on top of your existing .NET app or develop an AI-first solution, we’re ready to help. Contact us to discuss your AI adoption needs.

FAQ

Together, they form one connected stack instead of a patchwork of vendors. Semantic Kernel handles plugins and connectors, Agent Framework adds orchestration and production controls, and MCP standardizes access to external systems, all from a single vendor with one roadmap to track. For .NET teams, that stack runs as ordinary packages on infrastructure they already have. It also allows software engineers to start closer to production-ready thanks to built-in session state, telemetry, and middleware, and can grow over time, starting with a single agent and adding orchestration or new tool access later.

The integration itself is native and straightforward. The real challenge is scoping. During the planning stage, decide which systems to expose as MCP servers and with what access boundaries, so the agent doesn’t end up with broader system access than the workflow actually needs.

Not for every team. Agent Framework is Microsoft’s recommended default for new projects, but Semantic Kernel remains a solid choice for stable systems that are already in production. It is also a better choice for projects where its plugin templating and Java support are the better fit.

Start with narrow scoping that outlines a single clear success condition for a single workflow. That’s what actually speeds things up, since it gives you something specific to build and test against. Using an established stack like Semantic Kernel, Agent Framework, and MCP also saves you from rebuilding plumbing that already exists.

Yes, they are mainly related to access control and auditability. Agents touching regulated data need tightly scoped tool access, full logging, and human approval on high-stakes actions. MCP’s standardized interface and Agent Framework’s middleware make that discipline easier to enforce, allowing teams to build secure and compliant AI agents for industries like fintech, healthcare, insurtech, etc.