Microsoft Agent Framework: build a .NET agent with Ollama

Build a C# customer support agent with Ollama and Llama 3.2, then expose order status and delivery methods as tools through an ASP.NET Core API.

Player not loading? Watch on YouTube

This tutorial builds a customer support AI agent in C# using Microsoft Agent Framework, with Ollama running Llama 3.2 locally. The example uses a .NET 10 clean architecture solution with domain, application, infrastructure and API projects. It connects a local LLM to application methods that retrieve order information from the Northwind database.

The presenter keeps framework dependencies in infrastructure and defines the agent abstraction in the application layer. An IChatClient supplies the model connection, while an agent factory handles construction and tool registration. An ASP.NET Core controller passes customer questions to the agent through dependency injection. The demonstrated setup requires a running Ollama container and environment variables for its endpoint and model name.

An initial request produces a generic answer because the agent cannot retrieve order data yet. The tutorial then adds C# tools for order status and estimated delivery information. The presenter demonstrates missing-order responses and a question that calls both tools before combining their results.

The delivery example uses simplified logic: it treats a shipping date before today as a delivery date. This demo logic does not establish a reliable delivery estimate for a production order system.