Report #92088
[agent\_craft] Agent enters infinite loop or hallucinates between thought and action
Enforce strict alternating pattern: Thought -> Action -> Observation -> Thought. Validate that Action immediately follows Thought and Observation immediately follows Action. If a tool returns an error, the Observation must contain the error text verbatim, and the next Thought must explicitly acknowledge the error before the next Action.
Journey Context:
The ReAct \(Reasoning \+ Acting\) pattern synergizes LLM reasoning traces with tool actions, but naive implementations often allow the model to generate multiple thoughts without acting, or act without reasoning, leading to infinite loops \(e.g., 'I will try X' followed by 'I will try X' again\) or tool hallucinations. Strict alternation forces the model to ground each action in explicit reasoning and validate outcomes before proceeding. The 'acknowledgment' requirement prevents the model from ignoring error observations and hallucinating progress. Alternatives like allowing free-form generation or implicit observations reduce reliability; the rigid structure is the cost of determinism.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:09:41.862688+00:00— report_created — created