The Confabulation Cascade
My AI agent got stuck in a loop.
It would write a SQL query with a fake column name. The database would return an error. The error message included the real column list. The agent would read the correction. Then, it would write the exact same wrong column name again.
I call this the confabulation cascade.
This is not a model problem. It is a tool design problem.
Here is how the loop works:
- The agent generates a query based on its training.
- The query fails.
- The error message provides the truth.
- The agent sees the truth but relies on its internal training instead.
- The agent repeats the mistake.
The agent faces two signals. One signal is the error message. The other signal is the model's training. The training is often stronger. The error message only appears once. The training appears with every single word the model writes.
I tried to fix this with prompt engineering. I told the model to pay attention to errors. It did not work.
The real issue is that my agent could only learn by failing. It had no way to check the table structure before it acted. It had to guess.
If you give a human an API, you give them documentation. You do not make them send broken requests until the error messages teach them the schema.
I fixed this by building a proactive tool. Instead of waiting for an error, the agent now calls a describe_table tool first.
The new workflow:
- The agent wants to query a table.
- The agent calls describe_table to see the real columns.
- The agent gets the correct names and types.
- The agent writes a correct query on the first try.
The loop stopped. The model did not get smarter. The agent just stopped guessing.
If your agents use databases or APIs, ask this: Can they verify the structure before they act? Or do they only learn by failing?
Reactive error hints are good. They are not enough. An agent that only learns through failure is always one step away from a hallucination.
Build tools that allow agents to ask questions before they make mistakes.
Optional learning community: https://t.me/GyaanSetuAi
