DevWithAbhinav
Hands-on project · Microsoft Agent Framework

Agentic .NET Assistant

in progress · phase 6 of 7

Agentic .NET Assistant

A structured, phase-by-phase build covering the full AI agent lifecycle in .NET — from a raw LLM call to a production-shaped agent service — using Microsoft Agent Framework (MAF). Runs on the Gemini API via a community IChatClient adapter, so the whole build needs no Azure or OpenAI subscription.

  • Foundations — a console app calling IChatClient.GetResponseAsync directly against Gemini with token-by-token streaming, before bringing in any framework, to understand the raw mechanics first.
  • Core agent skills — AIAgent instances with custom C# tool methods (function/tool calling), structured JSON output deserialized into typed C# records, and multi-turn history via MAF's session/thread abstraction.
  • MAF architecture — refactored into a DI-registered service inside ASP.NET Core behind a /chat endpoint, with middleware logging every tool call and token count, and sessions persisted to SQLite so conversations survive a restart.
  • RAG — documents ingested into a vector store, a TextSearchProvider context provider grounding answers in retrieved passages, with inline citations back to source documents.
  • Multi-agent workflows — a researcher/writer pipeline wired as an explicit MAF workflow graph, with a human-in-the-loop approval gate before any irreversible action.
  • Tool ecosystem & security — tools sourced from an external Model Context Protocol (MCP) server instead of hand-rolled integrations, with input validation and least-privilege scoping against prompt-injection risk.
  • Production engineering (current phase) — OpenTelemetry tracing via Jaeger/.NET Aspire, a 10–20 prompt evaluation suite, and a multi-stage Dockerfile with secrets injected via environment variables.
C# ASP.NET Core Microsoft Agent Framework Microsoft.Extensions.AI RAG MCP Docker

View the repository on GitHub

Related reading

AI System Design Concepts

Production Execution Lifecycle