Prevent secrets from reaching the LLM in .NET Microsoft Agent Framework and Ollama

Authorised Territory shows how to stop passwords, API keys, and other secrets from being sent to an LLM when building AI agents with the Microsoft Agent Framework in .NET and Ollama, by adding middleware that detects and redacts sensitive values before model calls.

Overview

The tutorial covers a practical pattern for protecting sensitive data in agentic applications: