BACK TO BLOGS

Engineering

Why Agents Contradict Themselves Across Sessions

An agent recommends PostgreSQL on Monday for your migration project. On Wednesday, you ask a follow-up. The agent recommends MySQL — same use case, same constraints. It has no idea it ever said PostgreSQL.

These contradictions are not hallucinations. They are the predictable result of stateless architecture meeting inconsistent retrieval.

How Contradictions Happen

Stateless agents generate responses from whatever context lands in the prompt. Each session retrieves fresh chunks via similarity search. Different sessions can surface different chunks for the same query — different document sections, different emphasis, different conclusions.

Monday's retrieval pulled chunks emphasizing PostgreSQL's advantages. Wednesday's retrieval, using a slightly rephrased query, surfaced chunks highlighting MySQL. Both responses were coherent within their respective contexts. Neither referenced the other because the agent has no memory of prior sessions.

The agent did not change its mind. It never had a mind to change.

Why Users Notice Immediately

Contradictions destroy trust faster than almost any other failure mode. A wrong answer can be corrected. A contradiction signals the agent does not actually understand the topic — it assembles plausible responses from whatever context scores highest.

Users who catch a contradiction begin questioning every prior recommendation. The trust damage extends backward to every previous interaction.

For enterprise agents advising on technical decisions or compliance, contradictions are disqualifying. No team will rely on an agent giving inconsistent guidance on important decisions.

The Retrieval Lottery

The underlying cause is retrieval variance. Similarity search is not deterministic across queries. Minor rephrasing changes the embedding, which changes nearest neighbors, which changes retrieved chunks.

For factual questions with single correct answers, variance is manageable. For nuanced questions with multiple valid perspectives, variance produces different answers depending on which perspective the chunks emphasize.

Without persistent state, every session is an independent draw from the retrieval distribution. Consistency across sessions is luck, not design.

The State-Based Solution

Stateful agents maintain consistency by persisting decisions and reasoning across sessions. When the agent recommends PostgreSQL on Monday, that recommendation is stored along with its reasoning and the user's context.

On Wednesday, the agent retrieves its prior recommendation before generating a response. It can reference the original reasoning, explain it, or revise it if new information warrants change. What it will not do is unknowingly contradict itself.

Effective stateful architecture tracks the full reasoning chain — which facts supported the recommendation, what constraints applied, and what alternatives were considered.

Frequently Asked Questions

Can prompt engineering reduce contradictions?

Within a single session, yes. Across sessions, no. The agent has no access to prior outputs unless they are persisted and retrieved by a memory system.

How should agents handle genuine recommendation changes?

Transparently. Reference the prior recommendation, explain what changed, present updated reasoning. Users accept changed recommendations. They do not accept unexplained contradictions.

Conclusion

Cross-session contradictions are the structural outcome of stateless architecture meeting variable retrieval. Every session generates independently, and independent generation produces inconsistency. Agents with persistent context can be consistent by design — anchoring new responses to prior reasoning rather than generating from scratch.

Enjoying this article?

Get the latest blogs and insights straight to your inbox.