Generative AI

The Managed Code AI agent stack: .NET, Orleans, and the Microsoft Agent Framework

Konstantin SemenenkoAugust 26, 20263minutes read

The stack Managed Code uses to build production AI agents — .NET, Orleans, and the Microsoft Agent Framework — and why agents that touch real data need it.

Most AI agent tutorials are written in Python. At Managed Code we build production AI agents on .NET — C#, Orleans, and the Microsoft Agent Framework — because an agent that touches money, data, and real users needs state, concurrency, and reliability, not just a prompt loop. Here's the stack we use, and why each part is there.

The short version: the model is the easy part. The engineering around it is what decides whether the agent survives real traffic.

Why .NET for AI agents

When an AI agent runs a real workflow, it becomes a long-running, stateful system that has to handle many requests at once, recover from failures, and integrate with the tools a business already runs. That's server engineering, and it's what .NET is built for. For the enterprises Managed Code works with — often already on C# and Azure — agents on .NET fit the systems and the compliance posture they already have, rather than bolting a separate Python service onto the side. For a deeper look at runtime trade-offs, see our guide on .NET vs Python for AI agents in 2026.

Orleans for agent state and concurrency

Agents have to hold state — what a user asked, which steps are done, what the agent is allowed to do next — and they have to do it for many users at once without collisions. We use Microsoft Orleans and its virtual-actor model for exactly this: each agent, session, or workflow becomes an addressable actor with its own state, and Orleans handles the concurrency, distribution, and recovery underneath. It's how a Managed Code AI agent stays consistent under load instead of double-booking or double-paying when two requests arrive at once.

The Microsoft Agent Framework for orchestration

On top of that we use the Microsoft Agent Framework to orchestrate the agent's steps: calling tools, following the workflow, deciding when to escalate. It gives us a structured way to define what the agent can do and when, instead of a loose prompt chain that's hard to test and harder to trust. Learn more in our overview on building AI agents with C# and .NET.

Retrieval, guardrails, and verification

Around the core, a Managed Code AI agent retrieves from approved sources (RAG) so answers trace back to something a person can open, runs behind explicit guardrails on which tools and data it can touch, and is verified with tests — including the mistakes it made before, kept as regression checks. Our open-source framework MCAF ties that verification to the build, so a change can't quietly break behavior that worked.

Deploying agents where the data lives

For regulated work, the agent is deployed inside the client's own boundary — on-prem or their cloud — with role-based access and a full audit trail. We've shipped under HIPAA, GDPR, and financial-compliance requirements, so where the data sits and who can process it is designed in from day one, not bolted on at audit time.

Why the stack matters

None of this shows up in a demo. It shows up in the busy hour, the retried message, the prompt change on a Thursday. Managed Code builds AI agents on .NET, Orleans, and the Microsoft Agent Framework because that's the stack that holds up when the demo becomes a system real people depend on.

If you're weighing how to build an AI agent that has to run in production, that's the work we do. See our AI agent development services or contact our team to map your workflow.

News & Insights

View all
How much does AI save in customer support?

How much does AI save in customer support?

AI can significantly improve customer support efficiency, with the biggest gains coming from repetitive tasks and less experienced teams.
The AI productivity paradox: why time saved isn't money saved

The AI productivity paradox: why time saved isn't money saved

AI can save time without creating value. Real ROI comes from better outcomes, not faster work alone.
AI ROI by industry: where the returns are highest

AI ROI by industry: where the returns are highest

AI delivers the highest ROI in industries with repetitive document processing and back-office workflows, especially financial services.

Start here

Bring us the agent that keeps braking

Tell us which workflow eats time, creates errors, or keeps landing back in a human review queue. We map the data, tools, risks, and escalation path before recommending anything.