"My Agent Refused 96 Times": Building Self-Editing Agents with Hard Failure Modes A senior ML engineer's benchmark of a production support agent revealed that the system refused to answer a valid question 96 times in a test set, but engineering review showed the model correctly identified insufficient or contradictory context in those cases, choosing refusal over hallucination. The article advocates for designing agents with hard failure modes, treating 'I don't know' as a first-class return type, and implementing verification gates to prevent confident hallucinations in critical systems. Originally published on tamiz.pro. In the early days of shipping LLM-based agents, we optimized for output volume. If the model could not find the answer, it often generated a plausible one anyway. This is the "yes-man" problem. In critical systems—financial auditing, code generation, or compliance checks—this creates a dangerous class of errors: confident hallucinations . Recently, a senior ML engineer shared a benchmark result from a production support agent: the system refused to answer a valid question 96 times in a test set. While the product team initially flagged this as a failure rate, the engineering review revealed the opposite. In 96% of those cases, the model correctly identified that the retrieved context was insufficient or contradictory. It chose the hard failure mode: refusal. This is a pivotal shift in how we design autonomous systems. We are moving from probabilistic output to deterministic verification. This article explores how to architect agents with hard failure modes, treating "I don't know" as a first-class return type rather than an exception to be suppressed. Large Language Models are trained on corpora where the goal is often to be helpful and coherent. Consequently, they exhibit a strong bias toward generating a response, even when the semantic signal is absent. This is known as sycophancy in evaluation contexts. When you build a RAG Retrieval-Augmented Generation agent, the default pipeline is: The flaw lies in step 3. Without a gatekeeper, if the retrieved chunks contain irrelevant data due to embedding similarity thresholds being too loose , the model will attempt to bridge the gap with internal parametric knowledge, leading to hallucination. Consider the following naive implementation, which represents the "volume-first" architecture: php DANGEROUS: No verification gate async def get answer question: str - str: context = await retrieve context question prompt = f"Context:\n{context}\n\nQuestion: {question}" return await llm.complete prompt In a high-stakes environment, this function might return "The SQL query should use JOIN on table B" even if table B was never mentioned in the context. The agent has failed, but the API client sees a successful 200 OK with text. The error is silent. A hard failure mode is a deterministic exit path where the agent explicitly signals that it cannot fulfill the request based on verifiable criteria, rather than probabilistic guessing. This concept borrows heavily from systems programming e.g., Rust’s Result