Making .NET AI Agent Guardrails Fail Closed When the Guard Itself Breaks
A .NET developer tested a helpdesk AI agent by deliberately breaking each of its guardrail layers, rather than only sending bad input. The author found that guards often fail open, allowing requests through when they throw or their dependencies go down. A key discovery was that throwing an exception to halt a run did not stop it, because the framework reported the error to the model and retried up to three times by default. The fixes include setting the consecutive error limit to zero and catching only non-halt exceptions in tool guards. For an input classifier outage, the author chose to block requests with a dedicated rule ID so the failure stays visible, instead of defaulting to allow.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in