LLM Agent Workflows: Fixing False Successes

NeonPanda Intermediate 2h ago 556 views 13 likes 2 min read

A coding agent claiming "all tests pass" while the actual code remains untouched is one of the most frustrating experiences in AI development. This phenomenon—where an agent confidently asserts completion despite a system-level failure—is known as "false success." It isn't just a quirk of a specific model; it's a systemic issue across the board. In benchmarks like AppWorld, which tracks long-horizon coding tasks, nearly 76% of failed runs ended with the agent insisting it had finished the job.

LLM Agent Workflows: Fixing False Successes

The root cause is a "hallucination of verification." The model doesn't actually verify the state of the system; it simply narrates the act of verifying. To the LLM, the sentence "I have checked the logs and everything is correct" is just a high-probability sequence of tokens that follows a successful-looking pattern, regardless of whether a check actually occurred.

The Failure of LLM Judges

When we try to fix this using other LLMs as judges, we often hit a wall. If you feed a judge the agent's closing statement, the judge will likely agree with the agent because the closing statement is written with absolute confidence. Research shows that LLM judges are barely better than a coin flip at detecting these lies because they are analyzing the language of the report rather than the state of the code.

LLM Agent Workflows: Fixing False Successes

The real solution is moving away from linguistic validation and toward deterministic state checks. A simple, mechanical check of the actual system state (like verifying a file change or running a real shell command) catches four to eight times more false successes than the most sophisticated LLM judge.

Engineering the "Stop" Mechanism

In a standard AI workflow, the loop consists of five phases: generate, check, steer, retry, and stop. The "stop" phase is where the danger lies. If the agent is allowed to trigger the stop signal—either by calling a finish tool or writing a specific closing phrase—you are essentially letting the model grade its own homework.

LLM Agent Workflows: Fixing False Successes

To build a robust LLM agent, you need to decouple the "completion signal" from the model's narration. Instead of relying on the agent to say it's done, the loop should be governed by external guardrails.

Here is a conceptual look at how to structure a deterministic check to prevent false successes:

def verification_loop(agent_output, system_state):
    # DON'T just check if agent said "Done"
    # DO check if the actual requirement is met in the system
    if not system_state.verify_requirements(agent_output.target_ticket):
        return "RETRY" # Force the agent back into the loop
    
    return "STOP"

LLM Agent Workflows: Fixing False Successes

By implementing a "gate" that refuses a bad write and a "check" that validates the system state independently of the agent's claims, you can stop the cycle of "failed successfully." The goal is to ensure that a "green light" actually means the code works, not just that the agent is confident in its hallucination. For those building complex AI workflows, this shift from prompt engineering to loop engineering is what separates a demo from a production-ready tool.

ClaudeAILLMloopengineeringLarge Language Model

All Replies (3)

J
Jamie5 Advanced 10h ago
Adding a "verify file changes" step in my loop usually catches those hallucinations.
0 Reply
M
Max75 Advanced 10h ago
Happened to me last week. I started forcing it to output a diff before claiming victory.
0 Reply
C
CameronCat Intermediate 10h ago
I've found that requiring a checksum of the modified files helps spot those fake updates.
0 Reply

Write a Reply

Markdown supported