scienceDeep Dive
AI Engineering
·
Apr 18, 2026
·
16 min read Use middleware to wrap agent runs, intercept tool calls, and redact PII before the LLM sees it in both Python and .NET safely.
scienceDeep Dive
.NET
·
Dec 1, 2024
·
6 min read An unhandled exception in a default ASP.NET Core API gives the client an empty 500 and gives you a stack trace in a log nobody is watching. The only thing worse is the API that returns the stack trace to the caller. The Contact Management Application takes the middle path: one middleware catches everything, maps known exception types to sensible status codes, returns a predictable JSON shape, and logs the details server-side. This post walks through that implementation and where I would lean on the newer built-in alternatives instead.