AI Agent Hallucination & Memory Leak Fix
Hallucination Fix
- Grounding: Require tool observation citation - "According to [tool X] result..."
- Ask agent to say "I don't know" - add to system prompt: If confidence <70%, say unsure.
- Reduce temperature to 0.1 for factual tasks
- Add verification step: second agent checks first agent's answer vs source
Memory Leak Fix
Symptoms: Agent gets slower, more confused after 10+ turns. Cause: never pruning. Fix:
Every 5 steps: - Summarize last 5 turns into 1 sentence - Keep only summary + last 2 observations - Store full log to DB, not context
Tool We Use
LangFuse for memory tracing. Shows which memory chunk caused hallucination.