← Back to Articles         
Building Agentic Systems on the Microsoft Enterprise Stack

Building Agentic Systems on the Microsoft Enterprise Stack

Published on 18 Nov 2026 8 min read Agentic AI (.NET)
Agentic AI - Fundamentals

Building Agentic Systems on the Microsoft Enterprise Stack

In the previous sections, we learned the individual building blocks of the .NET AI ecosystem. But an enterprise architect doesn't deploy isolated libraries. The real goal is to combine these technologies into a cohesive, production-ready agentic system.

For this purpose, we can create an enterprise blueprint with four architectural layers:

┌─────────────────────────────────────────────┐
│ Layer 4 – Infrastructure                    │
│ Microsoft Foundry + Azure OpenAI            │
├─────────────────────────────────────────────┤
│ Layer 3 – Hosting & Observability           │
│ .NET Aspire + OpenTelemetry                 │
├─────────────────────────────────────────────┤
│ Layer 2 – Orchestration                     │
│ Microsoft Agent Framework                   │
├─────────────────────────────────────────────┤
│ Layer 1 – Language & Runtime                │
│ C# + .NET                                   │
└─────────────────────────────────────────────┘

Each layer has a specific responsibility, and together they form the foundation for building enterprise-grade agentic applications.

Layer 1 – Language and Runtime: C# and .NET

The foundation of our system is C# and .NET.

C# is particularly suitable for enterprise applications because it provides strong typing, object-oriented programming, dependency injection, asynchronous programming, HTTP communication, logging, resilience patterns, and many other capabilities already familiar to enterprise developers.

This also means that an organization doesn't need to create a completely separate technology ecosystem just because it is introducing AI.

Existing .NET practices can continue to be used:

C# + .NET
   ↓
Dependency Injection
   ↓
Configuration
   ↓
Logging
   ↓
Resilience
   ↓
Security
   ↓
AI Application

The AI functionality becomes part of the existing enterprise application architecture rather than an isolated Python script or experimental service.

Layer 2 – Orchestration: Microsoft Agent Framework

The second layer introduces autonomy through the Microsoft Agent Framework.

This is where we define how agents reason, use tools, maintain state, and collaborate with other agents.

For simple applications, one agent may be enough. Enterprise applications often require multiple specialized agents working together.

For example:

                    Manager Agent
                         |
              +----------+----------+
              |                     |
         Data Agent            Writer Agent
              |                     |
          SQL Tool              Writing Tool

The manager agent receives the user's objective and determines how the work should be divided.

A Data Agent might retrieve information from SQL Server, while a Writer Agent could use that information to prepare an executive report or email.

The Agent Framework provides the orchestration capabilities required to define these interactions.

Structured Multi-Agent Workflows

One important advantage of an orchestration framework is that agent collaboration doesn't have to be completely unpredictable.

You can define explicit workflow patterns such as:

User Request
     ↓
Manager Agent
     ↓
Data Agent
     ↓
Writer Agent
     ↓
Human Approval
     ↓
Final Response

You can also use dynamic routing when the next step depends on the result of the previous agent.

This makes the system suitable for complex business processes where tasks may run for a long time and may require human-in-the-loop approval.

Layer 3 – Hosting and Observability: .NET Aspire

The third layer is .NET Aspire.

Aspire is particularly useful when your agentic application becomes a distributed system containing multiple services.

For example:

                    Aspire
                      |
        +-------------+-------------+
        |             |             |
   Blazor Web       Agent API     Data API
        |             |             |
        +-------------+-------------+
                      |
                 AI Services

Instead of manually managing every service during development, Aspire provides orchestration capabilities for running and connecting distributed application components.

But one of its most important benefits for AI applications is observability.

OpenTelemetry and AI Observability

AI applications are more difficult to troubleshoot than traditional applications because a single user request may involve many operations.

For example:

User Request
     ↓
Manager Agent
     ↓
LLM Call
     ↓
Data Agent
     ↓
SQL Query
     ↓
LLM Call
     ↓
Writer Agent
     ↓
LLM Call
     ↓
Final Response

If the final response takes 12 seconds, you need to know where those 12 seconds were spent.

With OpenTelemetry-based observability, you can trace the execution across services and operations.

Conceptually:

Request
  ├── Manager Agent ........ 1.2s
  ├── LLM Call ............. 2.5s
  ├── SQL Query ............ 0.4s
  ├── Data Agent ........... 3.1s
  ├── Writer Agent ......... 4.0s
  └── Final Response ....... 0.8s

This allows developers to investigate latency, failures, dependencies, and execution flow rather than simply seeing that "the AI was slow."

Aspire's developer dashboard can provide a visual representation of distributed application activity and telemetry.

Layer 4 – Infrastructure: Microsoft Foundry and Azure OpenAI

The final layer is the cloud infrastructure where the AI models and related services operate.

This is where Microsoft Foundry and Azure OpenAI become important.

The architecture can be represented as:

.NET Application
      ↓
Agent Framework
      ↓
Microsoft.Extensions.AI
      ↓
Microsoft Foundry
      ↓
Azure OpenAI / AI Models

Microsoft Foundry provides the enterprise platform for managing AI resources and model deployments, while Azure provides the underlying security, networking, identity, and cloud infrastructure.

Enterprise Security

Security becomes especially important when agents can access enterprise data and perform actions.

Instead of putting API keys directly into application configuration, Azure applications can authenticate using Microsoft Entra ID and Managed Identity.

.NET Application
       ↓
Managed Identity
       ↓
Microsoft Entra ID
       ↓
RBAC
       ↓
Azure AI Resource

This eliminates the need to distribute long-lived API keys throughout the application.

Network security can also be implemented using Azure networking capabilities such as Virtual Networks and Private Endpoints, depending on the architecture and service configuration.

Complete Enterprise Architecture

Now we can combine all four layers:

┌──────────────────────────────────────────────┐
│              Layer 4: Infrastructure         │
│       Microsoft Foundry + Azure OpenAI       │
│     Models | Security | Identity | Scale     │
├──────────────────────────────────────────────┤
│          Layer 3: Hosting & Observability    │
│              .NET Aspire + OTEL              │
│      Service Orchestration | Tracing         │
├──────────────────────────────────────────────┤
│             Layer 2: Orchestration           │
│           Microsoft Agent Framework          │
│       Agents | Tools | State | Workflows     │
├──────────────────────────────────────────────┤
│          Layer 1: Language & Runtime         │
│                    C# + .NET                 │
│      APIs | DI | Security | Business Logic   │
└──────────────────────────────────────────────┘

Example: Analyze Sales and Email the Board

Let's trace a real request through this architecture.

Suppose a user enters:

"Analyze the last quarter's sales and draft an email to the board."

The request could originate from a Blazor frontend or a REST API.

Step 1 – Application Layer

The .NET application receives the request.

Blazor / REST API
       ↓
C# Application

The application doesn't need to implement the entire AI workflow itself. It passes the request into the agent orchestration layer.

Step 2 – Manager Agent

The request reaches the Manager Agent.

The Manager Agent determines that this isn't a single-step operation.

It needs to:

  1. Retrieve sales information.
  2. Analyze the information.
  3. Prepare a board-level message.

So it creates a plan and delegates the work.

User Request
     ↓
Manager Agent
     ↓
+-------------+
| Data Agent  |
+-------------+
     ↓
+---------------+
| Writer Agent  |
+---------------+
     ↓
Final Email

Step 3 – Data Agent

The Data Agent uses a C# tool to query the application's SQL database.

Data Agent
    ↓
C# Tool
    ↓
SQL Server
    ↓
Sales Data

The important point is that the agent doesn't need direct unrestricted access to the database.

A properly designed application exposes a controlled tool with appropriate authorization and validation.

Step 4 – Writer Agent

The retrieved information is then provided to the Writer Agent.

The Writer Agent uses an LLM to transform the data into a suitable executive communication.

The AI interaction can be performed through the Microsoft.Extensions.AI abstractions, which connect the agent to the configured model.

Writer Agent
      ↓
Microsoft.Extensions.AI
      ↓
IChatClient
      ↓
Azure AI / Foundry
      ↓
GPT Model

Step 5 – Observability

While all of this is happening, .NET Aspire and OpenTelemetry can capture telemetry across the distributed application.

You can observe:

  • Agent execution
  • Service-to-service calls
  • LLM requests
  • Tool execution
  • SQL operations
  • Latency
  • Errors
  • Token usage, where the relevant telemetry is available

This provides visibility into what actually happened during the agent workflow.

Complete Request Lifecycle

The entire process can therefore be visualized as:

                 User
                  ↓
          Blazor / REST API
                  ↓
             C# + .NET
                  ↓
       Microsoft Agent Framework
                  ↓
             Manager Agent
              /          \
             ↓            ↓
        Data Agent     Writer Agent
             ↓            ↓
          C# Tool      LLM Call
             ↓            ↓
        SQL Server    Azure Foundry
             \            /
              \          /
               ↓        ↓
              Final Result
                  ↓
                 User

      Throughout the process:
              ↓
       .NET Aspire
              ↓
       OpenTelemetry
              ↓
      Tracing + Metrics

Why This Architecture Matters

The important change is that we are no longer thinking about AI as simply:

Prompt → LLM → Response

Instead, we are designing an intelligent distributed system:

User
 ↓
.NET Application
 ↓
Agent Orchestration
 ↓
Multiple Specialized Agents
 ↓
Enterprise Tools + Data
 ↓
AI Models
 ↓
Observability
 ↓
Secure Cloud Infrastructure

This is the real purpose of the Microsoft enterprise AI stack.

C#/.NET provides the application foundation, Microsoft Agent Framework provides autonomous orchestration, .NET Aspire provides distributed application hosting and observability, and Microsoft Foundry/Azure OpenAI provides the enterprise AI infrastructure.

The result is a shift from building simple AI chatbots to architecting production-grade intelligent distributed systems.

← Back to Articles